Commit 1d0b280d authored by Nicolas Gilmard's avatar Nicolas Gilmard
Browse files

Use Java 8 Lambda expressions to iterate over lists

parent 08cee378
......@@ -27,7 +27,6 @@ import TUIO.TuioClient;
import TUIO.TuioCursor;
import TUIO.TuioListener;
import TUIO.TuioObject;
import TUIO.TuioPoint;
import TUIO.TuioTime;
import com.google.common.base.Preconditions;
......@@ -123,16 +122,15 @@ public class TuioConcreteAdapter extends TuiAdapter implements TuioListener {
Preconditions.checkArgument(tangibleObject != null, "The passed tangible cursor cannot be null!"); //$NON-NLS-1$
Vector<Point> tempPath = new Vector<>();
for (TuioPoint point : tangibleObject.getPath()) {
Point temp = new Point(point.getX(), point.getY(), tangibleObject.getAngle());
tempPath.addElement(temp);
}
tangibleObject.getPath().forEach(path -> tempPath.addElement(new Point(path.getX(), path.getY(), tangibleObject.getAngle())));
TangibleObject convertedTangibleObject = new TangibleObjectBuilder(tangibleObject.getSymbolID(), Type.OBJECT, tangibleObject.getPath().lastElement().getX(), tangibleObject.getPath().lastElement().getY()).withSeconds(tangibleObject.getTuioTime().getSeconds()).withMicroSeconds(tangibleObject.getTuioTime().getMicroseconds()).withxSpeed(tangibleObject.getXSpeed()).withySpeed(tangibleObject.getYSpeed()).withMotionSpeed(tangibleObject.getMotionSpeed()).withMotionAccel(tangibleObject.getMotionAccel()).withRotationSpeed(tangibleObject.getRotationSpeed()).withRotationAccel(tangibleObject.getRotationAccel()).withPath(tempPath).withState(tangibleObject.getTuioState()).build();
return convertedTangibleObject;
}
/**
* Convert a TUIO cursor into a tangibleObject
*
......@@ -145,10 +143,7 @@ public class TuioConcreteAdapter extends TuiAdapter implements TuioListener {
Preconditions.checkArgument(tangibleCursor != null, "The passed tangible cursor cannot be null!"); //$NON-NLS-1$
Vector<Point> tempPath = new Vector<>();
for (TuioPoint point : tangibleCursor.getPath()) {
Point temp = new Point(point.getX(), point.getY(), 0);
tempPath.addElement(temp);
}
tangibleCursor.getPath().forEach(path -> tempPath.addElement(new Point(path.getX(), path.getY(), 0)));
TangibleObject convertedTangibleObject = new TangibleObjectBuilder(IDMapper.remapCursorID(tangibleCursor.getCursorID()), Type.CURSOR, tangibleCursor.getPath().lastElement().getX(), tangibleCursor.getPath().lastElement().getY()).withSeconds(tangibleCursor.getTuioTime().getSeconds()).withMicroSeconds(tangibleCursor.getTuioTime().getMicroseconds()).withxSpeed(tangibleCursor.getXSpeed()).withySpeed(tangibleCursor.getYSpeed()).withMotionSpeed(tangibleCursor.getMotionSpeed()).withMotionAccel(tangibleCursor.getMotionAccel()).withPath(tempPath).withState(tangibleCursor.getTuioState()).build();
......
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