From 9393cac1dbba2402ccc8e928d7aff0cf5f4f5265 Mon Sep 17 00:00:00 2001 From: Eric Tobias Date: Thu, 29 Oct 2015 15:36:35 +0100 Subject: [PATCH] 2.1.2 - Fixed bug where verticality, specifically what was below wasn't computed correctly. Added documentation. --- .../itis/dkd/tui/space/SpatialMatrix.java | 47 ++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/TULIP/src/lu/list/itis/dkd/tui/space/SpatialMatrix.java b/TULIP/src/lu/list/itis/dkd/tui/space/SpatialMatrix.java index b10b98f..7d6e206 100644 --- a/TULIP/src/lu/list/itis/dkd/tui/space/SpatialMatrix.java +++ b/TULIP/src/lu/list/itis/dkd/tui/space/SpatialMatrix.java @@ -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.
+ * 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.
+ * 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 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. + *
+ * 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.
+ * 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 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. + *
+ * 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.
+ * 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 below(int objectId) { - int index = findHorizontalIndexFor(objectId) + 1; + int index = findVerticalIndexFor(objectId) + 1; return new ArrayList<>(vertical.subList(index, vertical.size())); } -- GitLab