Documentatie Coordinate
This commit is contained in:
@@ -6,11 +6,18 @@ import be.kuleuven.cs.som.annotate.Value;
|
||||
|
||||
@Value
|
||||
public class Coordinate extends Tuple<Double, Double> {
|
||||
|
||||
/**
|
||||
* Initialize this new Tuple as a Tuple with the given items.
|
||||
* @param coordinateX
|
||||
* @param coordinateY
|
||||
*
|
||||
* @param coordinateX The x-coordinate for this Coordinate
|
||||
* @param coordinateY The y-coordinate for this Coordinate
|
||||
* @post ...
|
||||
* |new.this.item1 == coordinateX
|
||||
* @post ...
|
||||
* |new.this.item2 == coordinateY
|
||||
*
|
||||
* @throws IllegalArgumentException ...
|
||||
* |
|
||||
*/
|
||||
public Coordinate(double coordinateX, double coordinateY) throws IllegalArgumentException {
|
||||
super(coordinateX, coordinateY);
|
||||
@@ -19,12 +26,10 @@ public class Coordinate extends Tuple<Double, Double> {
|
||||
/**
|
||||
*
|
||||
* @param coordinateX
|
||||
* The value for the x-coordinate.
|
||||
* @param coordinateY
|
||||
* The value for the y-coordinate.
|
||||
* @return
|
||||
* The coordinate created from coordinateX and coordinateY.
|
||||
* | result == new Coordinate(coordinateX, coordinateY);
|
||||
*
|
||||
* @return ...
|
||||
* |result == new Coordinate(coordinateX, coordinateY);
|
||||
*/
|
||||
@Immutable
|
||||
public static Coordinate create(double coordinateX, double coordinateY){
|
||||
@@ -32,16 +37,13 @@ public class Coordinate extends Tuple<Double, Double> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a new Coordinate created from the elements of the array.
|
||||
*
|
||||
* @param arr
|
||||
* The Array to create the Coordinate of.
|
||||
* @return The Tuple created from the elements of the given array.
|
||||
* | result == new Coordinate(arr[0], arr[1])
|
||||
* @throws IllegalArgumentException
|
||||
* The given array is null or the length of the given array
|
||||
* is not 2.
|
||||
* | arr == null || arr.length != 2
|
||||
*
|
||||
* @return ...
|
||||
* |result == new Coordinate(arr[0], arr[1])
|
||||
*
|
||||
* @throws IllegalArgumentException ...
|
||||
* |arr == null || arr.length != 2
|
||||
*/
|
||||
@Immutable
|
||||
public static Coordinate create(double[] arr) throws IllegalArgumentException {
|
||||
@@ -50,15 +52,27 @@ public class Coordinate extends Tuple<Double, Double> {
|
||||
return new Coordinate(arr[0], arr[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ...
|
||||
* |result == new double[]{getX(), getY()}
|
||||
*/
|
||||
public double[] toArray() {
|
||||
|
||||
return new double[]{getX(), getY()};
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ...
|
||||
* |result == this.item1
|
||||
*/
|
||||
@Basic @Immutable
|
||||
public double getX() {
|
||||
return this.item1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ...
|
||||
* |result == this.item2
|
||||
*/
|
||||
@Basic @Immutable
|
||||
public double getY() {
|
||||
return this.item2;
|
||||
|
Reference in New Issue
Block a user