Class Position
java.lang.Object
|
+--Position
- public class Position
- extends java.lang.Object
Definition of a Ship's position.
- See Also:
Ship
Constructor Summary |
Position(double x,
double y)
Create the (immutable) (x,y) pair. |
Method Summary |
boolean |
equals(java.lang.Object o)
Does this position match another? |
double |
getX()
Return the X-value of this position. |
double |
getY()
Return the Y-value of this position. |
java.lang.String |
toString()
Return a string representation of this position. |
Methods inherited from class java.lang.Object |
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Position
public Position(double x,
double y)
- Create the (immutable) (x,y) pair.
getX
public double getX()
- Return the X-value of this position.
getY
public double getY()
- Return the Y-value of this position.
toString
public java.lang.String toString()
- Return a string representation of this position.
- Overrides:
- toString in class java.lang.Object
equals
public boolean equals(java.lang.Object o)
- Does this position match another?
- Returns:
- true if o is a Position with matching
x and y attributes.
- Overrides:
- equals in class java.lang.Object