1 package org.kite9.diagram.primitives;
2
3 import org.kite9.diagram.position.Direction;
4
5 /***
6 * This generic interface allows you to specify a bi-directional, optionally directed from-to relationships, where from and to are
7 * both objects of generic class X.
8 *
9 * @author robmoffat
10 *
11 * @param <X>
12 */
13 public interface BiDirectional<X> {
14
15 public X getFrom();
16
17 public X getTo();
18
19 public void setFrom(X v);
20
21 public void setTo(X v);
22
23 /***
24 * Returns from, if to is the argument, or to if from is the argument.
25 * @param end
26 * @return
27 */
28 public X otherEnd(X end);
29
30 public boolean meets(BiDirectional<X> e);
31
32 public boolean meets(X v);
33
34 /***
35 * Indicates the layout of from/to for the bi-directional item. If this is non-null, then it is describing
36 * the single direction it needs to flow in for the diagram.
37 */
38 public Direction getDrawDirection();
39
40 public Direction getDrawDirectionFrom(X from);
41
42 public void setDrawDirection(Direction d);
43
44 public void setDrawDirectionFrom(Direction d, X from);
45
46
47 }