rle.core.board
Class Thing

java.lang.Object
  extended by rle.core.vm.PlugInBase
      extended by rle.core.board.Thing
All Implemented Interfaces:
java.lang.Cloneable, RuntimeDataListener, PlugIn
Direct Known Subclasses:
Creature, Item, Terrain

public abstract class Thing
extends PlugInBase
implements RuntimeDataListener, java.lang.Cloneable

Base class for all Objects that can reside in a Board.


Field Summary
protected  java.util.HashMap<java.lang.String,java.lang.Object> attributes
           
protected  RuntimeData data
           
protected  java.util.List<Thing> enclosed
           
protected  Thing enclosing
           
protected  Locator locator
           
protected  java.util.HashMap<java.lang.String,TemporaryCharm> temporaryCharms
           
 
Fields inherited from class rle.core.vm.PlugInBase
config, context, parameters
 
Constructor Summary
Thing()
           
 
Method Summary
 void addThingListener(ThingListener listener)
          Add a ThingListener.
 java.util.Set<java.lang.String> attributeKeySet()
          The set of keys for which attributes have been mapped.
 java.util.Map<java.lang.String,java.lang.Object> attributeMap()
           
 boolean checkAttribute(java.lang.String s)
          Attempt to retrieve a boolean version of the value mapped to s, or false if no such mapping exists.
 java.lang.Object clone()
          Cloneable
 void dataChange(RuntimeDataEvent event)
           
 Thing enclosingObject()
           
 void fireLocationChange(Locator oldLoc, Locator newLoc)
          Notify listeners that a Thing has changed locations.
 java.lang.Object getAttribute(java.lang.String key)
          Retrieve the value mapped to key, or null if no such mapping exists.
 long getId()
           
 RuntimeData getRuntimeData()
           
 RLDimension getSize()
          Get the dimensions of this Object in the Board.
 TemporaryCharm getTemporaryCharm(java.lang.String key)
          Retrieve the TemporaryCharm mapped to key, or null if no such mapping exists.
 Locator locator()
           
 void putAttribute(java.lang.String key, java.lang.Object value)
          Map a value to an attribute.
 void putTemporaryCharm(java.lang.String key, TemporaryCharm value)
          Map a key to a TemporaryCharm.
 void removeAttribute(java.lang.String key)
          Remove a mapping.
 void removeTemporaryCharm(java.lang.String key)
          Remove a TemporaryCharm mapping.
 void removeThingListener(ThingListener listener)
          Remove a ThingListener.
 void setConfig(InfoView i)
          Set the configuring InfoView.
 void setEnclosingObject(Thing enclosing)
           
 void setRuntimeData(RuntimeData rd)
           
 void setSize(RLDimension d)
          Set the dimensions of this Object in the Board.
 java.util.Set<java.lang.String> temporaryCharmKeySet()
          The set of keys for TemporaryCharm's.
 java.lang.String toString()
           
 
Methods inherited from class rle.core.vm.PlugInBase
config, getContext, getParameters, paramMap, setParameters
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

enclosing

protected Thing enclosing

locator

protected Locator locator

enclosed

protected java.util.List<Thing> enclosed

attributes

protected java.util.HashMap<java.lang.String,java.lang.Object> attributes

temporaryCharms

protected java.util.HashMap<java.lang.String,TemporaryCharm> temporaryCharms

data

protected RuntimeData data
Constructor Detail

Thing

public Thing()
Method Detail

clone

public java.lang.Object clone()
Cloneable

Overrides:
clone in class java.lang.Object

locator

public Locator locator()

setConfig

public void setConfig(InfoView i)
Description copied from interface: PlugIn
Set the configuring InfoView.

Specified by:
setConfig in interface PlugIn
Overrides:
setConfig in class PlugInBase

enclosingObject

public Thing enclosingObject()

setEnclosingObject

public void setEnclosingObject(Thing enclosing)

fireLocationChange

public void fireLocationChange(Locator oldLoc,
                               Locator newLoc)
Notify listeners that a Thing has changed locations. If oldLoc is null, the object is assumed to have been newly placed. If newLoc is null, the object is assumed to have been removed.


addThingListener

public void addThingListener(ThingListener listener)
Add a ThingListener.

Parameters:
listener -

removeThingListener

public void removeThingListener(ThingListener listener)
Remove a ThingListener.

Parameters:
listener -

getId

public long getId()

getRuntimeData

public RuntimeData getRuntimeData()

setRuntimeData

public void setRuntimeData(RuntimeData rd)

attributeMap

public java.util.Map<java.lang.String,java.lang.Object> attributeMap()

attributeKeySet

public java.util.Set<java.lang.String> attributeKeySet()
The set of keys for which attributes have been mapped.


getAttribute

public java.lang.Object getAttribute(java.lang.String key)
Retrieve the value mapped to key, or null if no such mapping exists.


checkAttribute

public boolean checkAttribute(java.lang.String s)
Attempt to retrieve a boolean version of the value mapped to s, or false if no such mapping exists.

Parameters:
s -
Returns:

putAttribute

public void putAttribute(java.lang.String key,
                         java.lang.Object value)
Map a value to an attribute.


removeAttribute

public void removeAttribute(java.lang.String key)
Remove a mapping.


temporaryCharmKeySet

public java.util.Set<java.lang.String> temporaryCharmKeySet()
The set of keys for TemporaryCharm's.


getTemporaryCharm

public TemporaryCharm getTemporaryCharm(java.lang.String key)
Retrieve the TemporaryCharm mapped to key, or null if no such mapping exists.


putTemporaryCharm

public void putTemporaryCharm(java.lang.String key,
                              TemporaryCharm value)
Map a key to a TemporaryCharm.


removeTemporaryCharm

public void removeTemporaryCharm(java.lang.String key)
Remove a TemporaryCharm mapping.


getSize

public RLDimension getSize()
Get the dimensions of this Object in the Board.

Returns:

setSize

public void setSize(RLDimension d)
Set the dimensions of this Object in the Board.

Parameters:
d -

dataChange

public final void dataChange(RuntimeDataEvent event)
Specified by:
dataChange in interface RuntimeDataListener

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object