org.molwind.model
Class LayeredPosition

java.lang.Object
  extended by org.molwind.model.LayeredPosition
All Implemented Interfaces:
java.io.Serializable, Place

public class LayeredPosition
extends java.lang.Object
implements Place, java.io.Serializable

LayeredPosition provides an implementation of a world postion.

Version:
1.0
Author:
Oliver Karch
See Also:
Serialized Form

Field Summary
static LayeredPosition ORIGIN
           
 
Constructor Summary
LayeredPosition(double newX, double newY, int newLayer)
          LayeredPosition constructor.
 
Method Summary
 boolean equals(java.lang.Object object)
          Indicates whether some other layered position is "equal to" this one.
 int getLayer()
          Get the Layer value.
 double getX()
          Get the X value.
 double getY()
          Get the Y value.
 int hashCode()
          Returns a hash code value for this layered position.
 boolean isOrigin()
          Tests whether this object represents the origin position (0,0,0).
 void setLayer(int newLayer)
          Set the Layer value.
 void setX(int newX)
          Set the X value.
 void setY(int newY)
          Set the Y value.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ORIGIN

public static final LayeredPosition ORIGIN
Constructor Detail

LayeredPosition

public LayeredPosition(double newX,
                       double newY,
                       int newLayer)
LayeredPosition constructor.

Parameters:
newX - the X value
newY - the Y value
newLayer - the Layer value
Method Detail

getX

public double getX()
Get the X value.

Specified by:
getX in interface Place
Returns:
the X value.

setX

public void setX(int newX)
Set the X value.

Parameters:
newX - the new X value

getY

public double getY()
Get the Y value.

Specified by:
getY in interface Place
Returns:
the Y value

setY

public void setY(int newY)
Set the Y value.

Parameters:
newY - the new Y value

getLayer

public int getLayer()
Get the Layer value.

Returns:
the Layer value

setLayer

public void setLayer(int newLayer)
Set the Layer value.

Parameters:
newLayer - the new Layer value

isOrigin

public boolean isOrigin()
Tests whether this object represents the origin position (0,0,0).

Returns:
true if this object represents the origin, otherwise false

equals

public boolean equals(java.lang.Object object)
Indicates whether some other layered position is "equal to" this one. A layered position is equal if the x-axis, y-axis and layer is equal.

Overrides:
equals in class java.lang.Object
Parameters:
object - the reference object with which to compare
Returns:
true if object position equals this is, false otherwise

toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the object

hashCode

public int hashCode()
Returns a hash code value for this layered position. It is computed by returning the hashcode of the output of this.toString().

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value for this object


Copyright © 2008-2010. All Rights Reserved.