key0-96/
key0-96/doc/key/
key0-96/doc/key/credits/
key0-96/doc/key/developers/
key0-96/doc/key/developers/resources/
key0-96/setup/caves/
key0-96/setup/help/
key0-96/setup/ruins/
key0-96/src/
key0-96/src/commands/
key0-96/src/events/
key0-96/src/hack/
key0-96/src/sql/
key0-96/src/swing/
key0-96/src/talker/forest/
key0-96/src/talker/objects/
key0-96/src/terminals/
/*
**               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 );
	}
}