|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsim.portrayal.LocationWrapper
A LocationWrapper is used to embody the objects stored in a FieldPortrayal; for example, those returned by a hitObjects test on a FieldPortrayal2D. The wrapper contains the FieldPortrayal, the original object, and the original location. We say "original object" and "original location", because some Fields move objects about. To get the current object and the current location, you need to call the getObject() and getLocation() methods. LocationWrappers are most commonly used to provide inspectors.
FieldPortrayals should subclass this class according to their needs. For example, ValueGrid2DPortrayal and ObjectGrid2DPortrayal lock inspectors to point at certain locations, rather than follow objects around. In this case, these portrayals will override getObject() to return the object currently at the given location. On the other hand, SparseGrid2DPortrayal and Continuous2DPortrayal lock inspectors to point at certain objects regardless of where the object is located. In this case, these portrayals will override getLocation() instead to return the object's current location.
Field Summary | |
FieldPortrayal |
fieldPortrayal
The field portrayal depicting this object |
protected java.lang.Object |
location
The ORIGINAL location of the object |
protected java.lang.Object |
object
The ORIGINAL object |
Constructor Summary | |
LocationWrapper(java.lang.Object object,
java.lang.Object location,
FieldPortrayal fieldPortrayal)
|
Method Summary | |
FieldPortrayal |
getFieldPortrayal()
|
java.lang.Object |
getLocation()
Override this to provide the current location |
java.lang.String |
getLocationName()
Override this to provide the current location's name |
java.lang.Object |
getObject()
Override this to provide the current object |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.Object object
protected java.lang.Object location
public FieldPortrayal fieldPortrayal
Constructor Detail |
public LocationWrapper(java.lang.Object object, java.lang.Object location, FieldPortrayal fieldPortrayal)
Method Detail |
public FieldPortrayal getFieldPortrayal()
public java.lang.Object getObject()
public java.lang.Object getLocation()
public java.lang.String getLocationName()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |