/* ** j###t ########## #### #### ** j###t ########## #### #### ** j###T "###L J###" ** ######P' ########## ######### ** ######k, ########## T######T ** ####~###L #### ** #### q###L ########## .##### ** #### \###L ########## #####" */ package key.talker.objects; import key.*; import java.util.Enumeration; import java.util.StringTokenizer; import java.util.Vector; import java.io.*; /** */ public class Wearable extends Prop implements Thing { public static final AtomicElement[] ELEMENTS = { AtomicElement.construct( Wearable.class, String.class, "wearLocations", AtomicElement.PUBLIC_ACCESSORS, "comma seperated list of locations that this object is worn" ) }; public static final AtomicStructure STRUCTURE = new AtomicStructure( Prop.STRUCTURE, ELEMENTS ); private String[] wearLocs = new String[0]; public Wearable() { } public AtomicStructure getDeclaredStructure() { return( STRUCTURE ); } public String getWearLocations() { return( Grammar.commaSeperate( wearLocs ) ); } public void setWearLocations( String s ) { StringTokenizer st = new StringTokenizer( s, "," ); Vector v = new Vector( 5, 20 ); while( st.hasMoreTokens() ) { v.addElement( st.nextToken() ); } if( wearLocs.length != v.size() ) wearLocs = new String[ v.size() ]; v.copyInto( wearLocs ); v.setSize( 0 ); } public String[] wearLocations( Player p ) { return( wearLocs ); } }