public class Point
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
Point.NullPoint
Use objects of type NullPoint as an equivalent to null
|
static class |
Point.Vector |
Modifier and Type | Field and Description |
---|---|
protected int |
xCoord |
protected int |
yCoord |
Constructor and Description |
---|
Point(int x,
int y)
Constructor to build a Point from two values.
|
Modifier and Type | Method and Description |
---|---|
Point |
add(Point other)
Method to add another Point to this.
|
boolean |
equals(java.lang.Object obj) |
int |
getX()
Method to return the X coordinate of this Point.
|
int |
getY()
Method to return the Y coordinate of this Point.
|
int |
hashCode() |
Point |
mirror() |
Point |
scale(int scaleFactor)
Method to scale this Point by a given factor.
|
Point |
scale(int scaleFactorX,
int scaleFactorY)
Method to scale this Point by X and Y factors.
|
int[] |
toArray() |
java.lang.String |
toString() |
Point |
transform(ManhattanOrientation orientation)
Method to transform this by a Manhattan orientation.
|
Point |
withX(int xCoord)
Method to build a new Point with a different X coordinate.
|
Point |
withY(int yCoord)
Method to build a new Point with a different Y coordinate.
|
public Point(int x, int y)
x
- [-LayoutCell.MAX_COORD, LayoutCell.MAX_COORD]y
- [-LayoutCell.MAX_COORD, LayoutCell.MAX_COORD]public int getX()
public Point withX(int xCoord)
xCoord
- the new X coordinate.public int getY()
public Point withY(int yCoord)
yCoord
- the new Y coordinate.public int[] toArray()
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public Point add(Point other)
other
- the other Point to add.public Point scale(int scaleFactor)
scaleFactor
- the factor to apply to X and Y.public Point scale(int scaleFactorX, int scaleFactorY)
scaleFactorX
- the X factor for scaling.scaleFactorY
- the Y factor for scaling.public Point mirror()
public Point transform(ManhattanOrientation orientation)
orientation
- the Manhattan orientation to transform by.