- All Implemented Interfaces:
Serializable
, Cloneable
A position with integers.
- Author:
- Christopher Mindus
- See Also:
Field Summary 
Fields
Constructor Summary 
Constructors
Constructs a position initialized to 0,0.
Constructs and initializes position.
Constructs and initializes position.
Method Summary 
static int
Compares to position by first X, then Y.
boolean
int
Creates the string representation of this position.
Field Details 
x 
public int x
The X position.
y 
public int y
The Y position.
Constructor Details 
Position 
public Position()
Constructs a position initialized to 0,0.
Position 
public Position(int x, int y)
Constructs and initializes position.
- Parameters:
x
- The X position.y
- The Y position.
Position 
Constructs and initializes position.
- Parameters:
p
- The position to clone.
Method Details 
equals 
public boolean equals(Object o) Check for equality.
- Overrides:
equals
in class Object
- Parameters:
o
- Another object.- Returns:
- true if it's the same Position object values, false otherwise.
hashCode 
public int hashCode()
Hash code.
- Overrides:
hashCode
in class Object
- Returns:
- Returns the hash code.
toString 
Creates the string representation of this position.
- Overrides:
toString
in class Object
- Returns:
- Position String as "className[x=NN,y=NN]".
compare 
Compares to position by first X, then Y.
- Parameters:
p1
- Position 1 (null allowed).p2
- Position 2 (null allowed).- Returns:
- 1 if p1 is "larger" than p2 (or p2 is null), -1 if "smaller" (or p2 is null), 0 if equal (both null).