public class Edge extends java.lang.Object implements JsonSerializable
| Constructor and Description | 
|---|
Edge(Node from,
    Node to)
Creates a new edge between the two nodes. 
 | 
Edge(Node from,
    Node to,
    double weight)
Creates a new edge between the two nodes with the given weight. 
 | 
Edge(Node from,
    Node to,
    double weight,
    java.lang.Object value)
Creates a new edge between the two nodes with the given weight and the given value object for the edge. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
add()
Adds this edge from both source and target. 
 | 
DrawableEdge | 
getDrawableEdge()
Gets the drawable edge for this node. 
 | 
Node | 
getFrom()
Returns the source node of this edge. 
 | 
Node | 
getOther(Node first)
Returns the other node in this edge. 
 | 
Node | 
getTo()
Returns the target node of this edge. 
 | 
java.lang.Object | 
getValue()
Returns the value stored at this edge. 
 | 
double | 
getWeight()
Returns the weight of this edge. 
 | 
java.util.List<Position> | 
intermediatePositions()
Returns the list of intermediate positions. 
 | 
void | 
invert()
Inverts this edge. 
 | 
void | 
remove()
Removes this edge from both source and target. 
 | 
void | 
setDrawableEdge(DrawableEdge drawableEdge)
Sets the drawable edge for this node. 
 | 
java.lang.String | 
toString()  | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitfromJson, toJsonpublic Edge(Node from, Node to)
from - The source node.to - The target node.public Edge(Node from, Node to, double weight)
from - The source node.to - The target node.weight - The weight. Must be strictly positive.java.lang.IllegalStateException - If the weight is not greater than 0.public Edge(Node from, Node to, double weight, java.lang.Object value)
from - The source node.to - The target node.weight - The weight. Must be strictly positive.value - The value to store in the node.java.lang.IllegalStateException - If the weight is not greater than 0.public double getWeight()
public Node getFrom()
public Node getTo()
public Node getOther(Node first)
first - The node which is either source or target of this edge.public java.lang.Object getValue()
public void setDrawableEdge(DrawableEdge drawableEdge)
drawableEdge - The drawable edge for this node.public DrawableEdge getDrawableEdge()
public java.util.List<Position> intermediatePositions()
DrawableEdge.intermediatePositions(Position, Position)
 with the position of the source and target of this edge.public void invert()
public void remove()
public void add()
public java.lang.String toString()
toString in class java.lang.Object