Commit 9393cac1 authored by Eric Tobias's avatar Eric Tobias

2.1.2 - Fixed bug where verticality, specifically what was below wasn't...

2.1.2 - Fixed bug where verticality, specifically what was below wasn't computed correctly. Added documentation.
parent fc0ba325
......@@ -175,18 +175,63 @@ public class SpatialMatrix {
return new ArrayList<>(horizontal.subList(0, index));
}
/**
* Method used to retrieve all {@link TangibleObject} instances to the right of the
* parameterized object (by ID). The method will return a new list build from the sublist of the
* horizontal space.<br />
* To determine whether something is "right", the method will make a sub-list of all elements
* with a higher index in the list than the parameterized object.<br />
* The returned list is to be read from left to right, that is, to be treated as if the object
* was added to the front. Hence, the first element is closest while the last element is
* furthest away.
*
* @param objectId
* The object for which to retrieve all objects to the right of.
* @return A {@link List} of {@link TangibleObject} instances which are considered to be to the
* right of the given object.
*/
public synchronized List<TangibleObject> rightOf(int objectId) {
int index = findHorizontalIndexFor(objectId) + 1;
return new ArrayList<>(horizontal.subList(index, horizontal.size()));
}
/**
* Method used to retrieve all {@link TangibleObject} instances above the parameterized object
* (by ID). The method will return a new list build from the sublist of the vertical space.
* <br />
* To determine whether something is "above", the method will make a sub-list of all elements
* with a lower index in the list than the parameterized object.<br />
* The returned list is to be read from left to right, that is, to be treated as if the object
* was added to the end. Hence, the first element is furthest away while the last element is
* closest.
*
* @param objectId
* The object for which to retrieve all objects above.
* @return A {@link List} of {@link TangibleObject} instances which are considered to be to the
* above the given object.
*/
public synchronized List<TangibleObject> above(int objectId) {
int index = findVerticalIndexFor(objectId);
return new ArrayList<>(vertical.subList(0, index));
}
/**
* Method used to retrieve all {@link TangibleObject} instances below the parameterized object
* (by ID). The method will return a new list build from the sublist of the horizontal space.
* <br />
* To determine whether something is "below", the method will make a sub-list of all elements
* with a higher index in the list than the parameterized object.<br />
* The returned list is to be read from left to right, that is, to be treated as if the object
* was added to the front. Hence, the first element is closest while the last element is
* furthest away.
*
* @param objectId
* The object for which to retrieve all objects below.
* @return A {@link List} of {@link TangibleObject} instances which are considered to be below
* the given object.
*/
public synchronized List<TangibleObject> below(int objectId) {
int index = findHorizontalIndexFor(objectId) + 1;
int index = findVerticalIndexFor(objectId) + 1;
return new ArrayList<>(vertical.subList(index, vertical.size()));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment