net.xqhs.graphs.graph
Class SimpleEdge

java.lang.Object
  extended by net.xqhs.graphs.representation.AbstractVisualizableGraphComponent
      extended by net.xqhs.graphs.graph.SimpleEdge
All Implemented Interfaces:
Edge, GraphComponent, VisualizableGraphComponent
Direct Known Subclasses:
ContextGraph.ContextEdge, EdgeP, SettableEdge

public class SimpleEdge
extends AbstractVisualizableGraphComponent
implements Edge

A simple implementation on the Edge interface, also inheriting functions from AbstractVisualizableGraphComponent.

Author:
Andrei Olaru

Field Summary
protected  Node from
          The source of the edge.
protected  java.lang.String label
          The label of the edge.
protected  Node to
          The destination of the edge.
 
Fields inherited from class net.xqhs.graphs.representation.AbstractVisualizableGraphComponent
representations
 
Constructor Summary
SimpleEdge(Node fromNode, Node toNode, java.lang.String edgeLabel)
          Constructs a new edge.
 
Method Summary
 Node getFrom()
           
 java.lang.String getLabel()
          If in need of a readable rendition of the edge's features, use the toString functions.
 Node getTo()
           
 java.lang.String toString()
          Constructs a full representation of the edge, including its two adjacent nodes.
 java.lang.String toStringShort()
          Constructs a short representation of the edge, including only information about label.
 java.lang.String toStringShort(boolean isBackward)
          Constructs a short representation of the edge, including only information about label and direction.
 
Methods inherited from class net.xqhs.graphs.representation.AbstractVisualizableGraphComponent
addRepresentation, getFirstRepresentationForRoot, getRepresentations, getRepresentationsForRoot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

label

protected java.lang.String label
The label of the edge.


from

protected Node from
The source of the edge.


to

protected Node to
The destination of the edge.

Constructor Detail

SimpleEdge

public SimpleEdge(Node fromNode,
                  Node toNode,
                  java.lang.String edgeLabel)
Constructs a new edge.

Parameters:
fromNode - : the source Node; the edge is added to the node's outEdges list.
toNode - : the destination Node; the edge is added to the node's inEdges list.
edgeLabel - : the label of the edge.
Method Detail

getLabel

public java.lang.String getLabel()
Description copied from interface: Edge
If in need of a readable rendition of the edge's features, use the toString functions.

Specified by:
getLabel in interface Edge
Returns:
the label of the edge

getFrom

public Node getFrom()
Specified by:
getFrom in interface Edge
Returns:
the source Node

getTo

public Node getTo()
Specified by:
getTo in interface Edge
Returns:
the destination Node

toString

public java.lang.String toString()
Description copied from interface: Edge
Constructs a full representation of the edge, including its two adjacent nodes.

Specified by:
toString in interface Edge
Overrides:
toString in class java.lang.Object
Returns:
a String representation of the edge

toStringShort

public java.lang.String toStringShort()
Description copied from interface: Edge
Constructs a short representation of the edge, including only information about label.

Specified by:
toStringShort in interface Edge
Returns:
a short String representation of the edge

toStringShort

public java.lang.String toStringShort(boolean isBackward)
Description copied from interface: Edge
Constructs a short representation of the edge, including only information about label and direction. The direction depends on the general direction of the representation.

Specified by:
toStringShort in interface Edge
Parameters:
isBackward - - mentions that the edge is in opposite direction with respect to the representation and should be represented accordingly
Returns:
a short String representation of the edge