Class Position
java.lang.Object
Position
-
Constructor Summary
ConstructorsConstructorDescriptionPosition(int x, int y) Constructor to initialize position by x and y instance variables. -
Method Summary
Modifier and TypeMethodDescriptionbooleanMethod to compare two objects of Position class.findNeighbours(double radius) The method for getting neighbours to a node in a network.intgetX()The method for retrieving the x-coordinate value.intgetY()The method for retrieving the y-coordinate value.inthashCode()Method to return hash value for position.toString()Returns position as a string in the format (x, y)
-
Constructor Details
-
Position
public Position(int x, int y) Constructor to initialize position by x and y instance variables.- Parameters:
x- the x-coordinate value.y- the y-coordinate value.
-
-
Method Details
-
getX
public int getX()The method for retrieving the x-coordinate value.- Returns:
- the x-coordinate value.
-
getY
public int getY()The method for retrieving the y-coordinate value.- Returns:
- the y-coordinate value.
-
findNeighbours
The method for getting neighbours to a node in a network.- Parameters:
radius- the radius where to search for neighbours- Returns:
- the arraylist of positions of these nodes.
-
equals
Method to compare two objects of Position class. -
hashCode
public int hashCode()Method to return hash value for position. -
toString
Returns position as a string in the format (x, y)
-