]> gerrit.simantics Code Review - simantics/district.git/blobdiff - org.simantics.district.route/src/org/simantics/district/route/Route.java
Initial version of the district network Routes view.
[simantics/district.git] / org.simantics.district.route / src / org / simantics / district / route / Route.java
diff --git a/org.simantics.district.route/src/org/simantics/district/route/Route.java b/org.simantics.district.route/src/org/simantics/district/route/Route.java
new file mode 100644 (file)
index 0000000..fcd9117
--- /dev/null
@@ -0,0 +1,47 @@
+package org.simantics.district.route;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public interface Route {
+
+    default String getName() {
+        return "empty"; //$NON-NLS-1$
+    }
+
+    void setName(String name);
+
+    Waypoint createWaypoint(Object backend);
+
+    default void addWaypoint(Waypoint r) {
+        addWaypoint(count(), r);
+    }
+
+    default void addWaypoint(int index, Waypoint r) {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Removes the specified waypoint from the route
+     */
+    default void removeWaypoint(Waypoint r) {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * @return amount of points in the route
+     */
+    default int count() {
+        return waypoints().size();
+    }
+
+    default List<Waypoint> waypoints() {
+        return Collections.emptyList();
+    }
+
+    // TODO: reorder route points
+
+}