Class Position
- java.lang.Object
-
- edu.ubo.satellitebeacons.main.space.Position
-
public class Position extends java.lang.Object
Represents 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 int
getX()
Get x coordinate.int
getY()
Get y coordinate.Position
next(Vector vector)
Add a vector to the position.Position
nextX(int x)
Add a int on the x axis.Position
nextY(int y)
Add a int on the y axis.Position
previous(Vector vector)
Remove a vector to the position.Position
previousX(int x)
Remove a int on the x axis.Position
previousY(int y)
Remove a int on the y axis.java.lang.String
toString()
-
-
-
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:
toString
in classjava.lang.Object
-
-