Class Position
- java.lang.Object
-
- edu.ubo.satellitebeacons.main.space.Position
-
public class Position extends java.lang.ObjectRepresents a position in 2d.
-
-
Constructor Summary
Constructors Constructor Description Position(int x, int y)Create a new 2d position.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetX()Get x coordinate.intgetY()Get y coordinate.Positionnext(Vector vector)Add a vector to the position.PositionnextX(int x)Add a int on the x axis.PositionnextY(int y)Add a int on the y axis.Positionprevious(Vector vector)Remove a vector to the position.PositionpreviousX(int x)Remove a int on the x axis.PositionpreviousY(int y)Remove a int on the y axis.java.lang.StringtoString()
-
-
-
Method Detail
-
next
public Position next(Vector vector)
Add a vector to the position.- Parameters:
vector- 2d vector with x and y coordinates.- Returns:
- New position which represents the result of adding of the vector.
-
nextX
public Position nextX(int x)
Add a int on the x axis.- Parameters:
x- Int to add to the current position.- Returns:
- New position which represents the result of adding of the int on x axis.
-
nextY
public Position nextY(int y)
Add a int on the y axis.- Parameters:
y- Int to add to the current position.- Returns:
- New position which represents the result of adding of the int on y axis.
-
previousX
public Position previousX(int x)
Remove a int on the x axis.- Parameters:
x- Int to remove to the current position.- Returns:
- New position which represents the result of removing of the int on x axis.
-
previousY
public Position previousY(int y)
Remove a int on the y axis.- Parameters:
y- Int to remove to the current position.- Returns:
- New position which represents the result of removing of the vector.
-
previous
public Position previous(Vector vector)
Remove a vector to the position.- Parameters:
vector- 2d vector with x and y coordinates.- Returns:
- New position which represents the result of removing of the int on y axis.
-
getX
public int getX()
Get x coordinate.- Returns:
- x coordinate.
-
getY
public int getY()
Get y coordinate.- Returns:
- y coordinate.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-