diff --git a/app/src/main/java/com/codigoparallevar/minicards/CanvasView.java b/app/src/main/java/com/codigoparallevar/minicards/CanvasView.java index c6f36f9..ab0e011 100644 --- a/app/src/main/java/com/codigoparallevar/minicards/CanvasView.java +++ b/app/src/main/java/com/codigoparallevar/minicards/CanvasView.java @@ -21,6 +21,7 @@ import com.codigoparallevar.minicards.types.Part; import com.codigoparallevar.minicards.types.PartGrid; import com.codigoparallevar.minicards.types.Position; import com.codigoparallevar.minicards.types.Selectable; +import com.codigoparallevar.minicards.types.Tuple4; import org.json.JSONArray; import org.json.JSONException; @@ -54,7 +55,7 @@ class CanvasView extends View implements PartGrid { private final static float touchTimeForLongTouchInMillis = 500; private boolean _isDragging = false; private MainActivity parentActivity = null; - private Tuple _dropToRemoveZone = new Tuple<>(0, 0, 0, 0); + private Tuple4 _dropToRemoveZone = new Tuple4<>(0, 0, 0, 0); private boolean _devMode = false; public CanvasView(Context context) { @@ -362,31 +363,11 @@ class CanvasView extends View implements PartGrid { } public void setDropZone(float x1, float x2, float y1, float y2) { - _dropToRemoveZone = new Tuple<>((int) x1, (int) x2, (int) y1, (int) y2); + _dropToRemoveZone = new Tuple4<>((int) x1, (int) x2, (int) y1, (int) y2); } public void setDevMode(boolean devMode) { _devMode = devMode; this.invalidate(); } - - private class Tuple { - - final T _x1; - final T1 _x2; - final T2 _y1; - final T3 _y2; - - public Tuple(T x1, T1 x2, T2 y1, T3 y2) { - _x1 = x1; - _x2 = x2; - _y1 = y1; - _y2 = y2; - } - - @Override - public String toString(){ - return "(" + _x1 + " - " + _x2 + ", " + _y1 + " - " + _y2 + ")"; - } - } } diff --git a/app/src/main/java/com/codigoparallevar/minicards/types/PartConnection.java b/app/src/main/java/com/codigoparallevar/minicards/types/PartConnection.java new file mode 100644 index 0000000..a7af930 --- /dev/null +++ b/app/src/main/java/com/codigoparallevar/minicards/types/PartConnection.java @@ -0,0 +1,14 @@ +package com.codigoparallevar.minicards.parts; + +import com.codigoparallevar.minicards.types.Part; + +public class PartConnection { + public final Part outputPart; + public final String inputPartId; + + + public PartConnection(Part outputPart, String inputPartId) { + this.outputPart = outputPart; + this.inputPartId = inputPartId; + } +} diff --git a/app/src/main/java/com/codigoparallevar/minicards/types/Tuple2.java b/app/src/main/java/com/codigoparallevar/minicards/types/Tuple2.java new file mode 100644 index 0000000..baa4dad --- /dev/null +++ b/app/src/main/java/com/codigoparallevar/minicards/types/Tuple2.java @@ -0,0 +1,11 @@ +package com.codigoparallevar.minicards.parts; + +public class Tuple { + public final T1 item1; + public final T2 item2; + + public Tuple(T1 item1, T2 item2) { + this.item1 = item1; + this.item2 = item2; + } +} diff --git a/app/src/main/java/com/codigoparallevar/minicards/types/Tuple4.java b/app/src/main/java/com/codigoparallevar/minicards/types/Tuple4.java new file mode 100644 index 0000000..3f10b97 --- /dev/null +++ b/app/src/main/java/com/codigoparallevar/minicards/types/Tuple4.java @@ -0,0 +1,21 @@ +package com.codigoparallevar.minicards.types; + +public class Tuple4 { + + public final T _x1; + public final T1 _x2; + public final T2 _y1; + public final T3 _y2; + + public Tuple4(T x1, T1 x2, T2 y1, T3 y2) { + _x1 = x1; + _x2 = x2; + _y1 = y1; + _y2 = y2; + } + + @Override + public String toString(){ + return "(" + _x1 + " - " + _x2 + ", " + _y1 + " - " + _y2 + ")"; + } +}