Commit 5ff4cc20 authored by Eric Tobias's avatar Eric Tobias

Minor modification, added Null Analysis related annotations

parent 03974785
......@@ -17,6 +17,7 @@
package lu.list.itis.dkd.tui.space;
import lu.list.itis.dkd.dbc.annotation.NonNullByDefault;
import lu.list.itis.dkd.dbc.annotation.Nullable;
import lu.list.itis.dkd.tui.TangibleObjectManager;
import lu.list.itis.dkd.tui.adapter.TangibleObject;
import lu.list.itis.dkd.tui.widget.BaseWidget;
......@@ -316,8 +317,11 @@ public class SpatialMatrix {
* @return The object with the smallest x-axis coordinate. Returns the first if more than one
* are tied.
*/
public TangibleObject getLeftMostObject() {
return horizontal.get(0);
public @Nullable TangibleObject getLeftMostObject() {
if (horizontal.size() > 0) {
return horizontal.get(0);
}
return null;
}
/**
......@@ -327,8 +331,11 @@ public class SpatialMatrix {
* @return The object with the largest x-axis coordinate. Returns the last if more than one are
* tied.
*/
public TangibleObject getRightMostObject() {
return horizontal.get(horizontal.size() - 1);
public @Nullable TangibleObject getRightMostObject() {
if (horizontal.size() > 0) {
return horizontal.get(horizontal.size() - 1);
}
return null;
}
/**
......@@ -339,7 +346,10 @@ public class SpatialMatrix {
* are tied.
*/
public TangibleObject getTopObject() {
return vertical.get(0);
if (vertical.size() > 0) {
return vertical.get(0);
}
return null;
}
/**
......@@ -350,7 +360,10 @@ public class SpatialMatrix {
* tied.
*/
public TangibleObject getBottomObject() {
return vertical.get(vertical.size() - 1);
if (vertical.size() > 0) {
return vertical.get(vertical.size() - 1);
}
return null;
}
/**
......
......@@ -16,6 +16,8 @@
*/
package lu.list.itis.dkd.tui.space;
import lu.list.itis.dkd.dbc.annotation.NonNullByDefault;
import lu.list.itis.dkd.dbc.annotation.Nullable;
import lu.list.itis.dkd.tui.TangibleObjectManager;
import lu.list.itis.dkd.tui.adapter.TangibleObject;
import lu.list.itis.dkd.tui.event.SpatialEvent;
......@@ -54,6 +56,7 @@ import java.util.logging.Logger;
* @since 2.1
* @version 2.1.3
*/
@NonNullByDefault
public class SpatialPositioningManager implements SpatialEventListener {
private static final Logger logger = Logger.getLogger(SpatialPositioningManager.class.getSimpleName());
......@@ -66,6 +69,7 @@ public class SpatialPositioningManager implements SpatialEventListener {
* Enumeration showing all alignment types this class supports.
*
* @author Eric Tobias [eric.tobias@list.lu]
* @author Valérie Maquil [valerie.maquil@list.lu]
* @since 2.1
* @version 2.1.3
*/
......@@ -172,7 +176,7 @@ public class SpatialPositioningManager implements SpatialEventListener {
* @return The widget with the smallest x-axis coordinate. Returns the first if more than one
* are tied. Will return <code>null</code> if no object is present.
*/
public BaseWidget getLeftMostWidget() {
public @Nullable BaseWidget getLeftMostWidget() {
if (getLeftMostObject() == null) {
return null;
}
......@@ -185,7 +189,7 @@ public class SpatialPositioningManager implements SpatialEventListener {
*
* @return The object with the smallest x coordinate.
*/
public TangibleObject getLeftMostObject() {
public @Nullable TangibleObject getLeftMostObject() {
return spatialMatrix.getLeftMostObject();
}
......@@ -197,9 +201,10 @@ public class SpatialPositioningManager implements SpatialEventListener {
* @return The widget with the largest x-axis coordinate. Returns the last if more than one are
* tied. Will return <code>null</code> if no object is present.
*/
public BaseWidget getRightMostWidget() {
if (getRightMostObject() == null)
public @Nullable BaseWidget getRightMostWidget() {
if (null == getRightMostObject()) {
return null;
}
return TangibleObjectManager.getWidget(getRightMostObject().getObjectId());
}
......@@ -209,7 +214,7 @@ public class SpatialPositioningManager implements SpatialEventListener {
*
* @return The object with the largest x coordinate.
*/
public TangibleObject getRightMostObject() {
public @Nullable TangibleObject getRightMostObject() {
return spatialMatrix.getRightMostObject();
}
......@@ -220,8 +225,8 @@ public class SpatialPositioningManager implements SpatialEventListener {
* @return The widget with the smallest y-axis coordinate. Returns the first if more than one
* are tied. Will return <code>null</code> if no object is present.
*/
public BaseWidget getTopWidget() {
if (getTopObject() == null) {
public @Nullable BaseWidget getTopWidget() {
if (null == getTopObject()) {
return null;
}
......@@ -233,7 +238,7 @@ public class SpatialPositioningManager implements SpatialEventListener {
*
* @return The object with the smallest y coordinate.
*/
public TangibleObject getTopObject() {
public @Nullable TangibleObject getTopObject() {
return spatialMatrix.getTopObject();
}
......@@ -244,7 +249,7 @@ public class SpatialPositioningManager implements SpatialEventListener {
* @return The widget with the largest y-axis coordinate. Returns the last if more than one are
* tied. Will return <code>null</code> if no object is present.
*/
public BaseWidget getBottomWidget() {
public @Nullable BaseWidget getBottomWidget() {
if (getBottomObject() == null) {
return null;
}
......@@ -257,7 +262,7 @@ public class SpatialPositioningManager implements SpatialEventListener {
*
* @return The object with the largest y coordinate.
*/
public TangibleObject getBottomObject() {
public @Nullable TangibleObject getBottomObject() {
return spatialMatrix.getBottomObject();
}
......@@ -284,7 +289,6 @@ public class SpatialPositioningManager implements SpatialEventListener {
public List<TangibleObject> getObjectToLeftOf(BaseWidget widget) {
return spatialMatrix.leftOf(TangibleObjectManager.getIdentifier(widget));
}
/**
......
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