]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.district.route/src/org/simantics/district/route/Route.java
Minor usability fixes for routing in district diagrams
[simantics/district.git] / org.simantics.district.route / src / org / simantics / district / route / Route.java
1 package org.simantics.district.route;
2
3 import java.util.Collections;
4 import java.util.List;
5
6 /**
7  * @author Tuukka Lehtonen
8  */
9 public interface Route {
10
11     default String getName() {
12         return "empty"; //$NON-NLS-1$
13     }
14
15     void setName(String name);
16
17     Waypoint createWaypoint(Object backend);
18
19     boolean persisted();
20
21     default void addWaypoint(Waypoint r) {
22         addWaypoint(count(), r);
23     }
24
25     default void addWaypoint(int index, Waypoint r) {
26         throw new UnsupportedOperationException();
27     }
28
29     /**
30      * Removes the specified waypoint from the route
31      */
32     default void removeWaypoint(Waypoint r) {
33         throw new UnsupportedOperationException();
34     }
35
36     /**
37      * @return amount of points in the route
38      */
39     default int count() {
40         return waypoints().size();
41     }
42
43     default List<Waypoint> waypoints() {
44         return Collections.emptyList();
45     }
46
47     // TODO: reorder route points
48
49 }