public class LocationWrapper
extends java.lang.Object
FieldPortrayals should subclass this class according to their needs. For example, ValueGridPortrayal2D and ObjectGridPortrayal2D 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, SparseGridPortrayal2D and ContinuousPortrayal2D 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.
LocationWrapper is used for nearly identical functions in FieldPortrayal3Ds as well.
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
LocationWrapper(java.lang.Object object,
java.lang.Object location,
FieldPortrayal fieldPortrayal) |
Modifier and Type | Method and Description |
---|---|
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
|
java.lang.String |
toString() |
protected java.lang.Object object
protected java.lang.Object location
public FieldPortrayal fieldPortrayal
public LocationWrapper(java.lang.Object object, java.lang.Object location, FieldPortrayal fieldPortrayal)
public FieldPortrayal getFieldPortrayal()
public java.lang.Object getObject()
public java.lang.Object getLocation()
public java.lang.String getLocationName()
public java.lang.String toString()
toString
in class java.lang.Object