com.threerings.stage.data
Class StageLocation

java.lang.Object
  extended by com.threerings.io.SimpleStreamableObject
      extended by com.threerings.stage.data.StageLocation
All Implemented Interfaces:
Streamable, Location, Cloneable

public class StageLocation
extends SimpleStreamableObject
implements Location

Contains information on a scene occupant's position and orientation.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.threerings.io.Streamable
Streamable.Closure
 
Field Summary
 byte orient
          The user's orientation (defined by DirectionCodes).
 int x
          The user's x position (interpreted by the display system).
 int y
          The user's y position (interpreted by the display system).
 
Constructor Summary
StageLocation()
          A zero-argument constructor used when unserializing instances.
StageLocation(int x, int y, byte orient)
          Constructs a location with the specified coordinates and orientation.
 
Method Summary
 StageLocation clone()
          Locations are cloneable.
 boolean equals(Object other)
          Location equality is determined by coordinates.
 boolean equivalent(Location oloc)
          Location equivalence means that the coordinates and orientation are the same.
 Location getOpposite()
          Get a new Location instance that is equals() to this one but that has an orientation facing the opposite direction.
 int hashCode()
          Computes a reasonable hashcode for location instances.
 String orientToString()
          Object.toString() helper function.
 
Methods inherited from class com.threerings.io.SimpleStreamableObject
toString, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public int x
The user's x position (interpreted by the display system).


y

public int y
The user's y position (interpreted by the display system).


orient

public byte orient
The user's orientation (defined by DirectionCodes).

Constructor Detail

StageLocation

public StageLocation()
A zero-argument constructor used when unserializing instances.


StageLocation

public StageLocation(int x,
                     int y,
                     byte orient)
Constructs a location with the specified coordinates and orientation.

Method Detail

orientToString

public String orientToString()
Object.toString() helper function.


getOpposite

public Location getOpposite()
Description copied from interface: Location
Get a new Location instance that is equals() to this one but that has an orientation facing the opposite direction.

Specified by:
getOpposite in interface Location

equivalent

public boolean equivalent(Location oloc)
Location equivalence means that the coordinates and orientation are the same.

Specified by:
equivalent in interface Location

equals

public boolean equals(Object other)
Location equality is determined by coordinates.

Specified by:
equals in interface Location
Overrides:
equals in class Object

hashCode

public int hashCode()
Computes a reasonable hashcode for location instances.

Specified by:
hashCode in interface Location
Overrides:
hashCode in class Object

clone

public StageLocation clone()
Description copied from interface: Location
Locations are cloneable.

Specified by:
clone in interface Location
Overrides:
clone in class Object