net.xqhs.graphs.representation.text
Class SettableEdge

java.lang.Object
  extended by net.xqhs.graphs.representation.AbstractVisualizableGraphComponent
      extended by net.xqhs.graphs.graph.SimpleEdge
          extended by net.xqhs.graphs.representation.text.SettableEdge
All Implemented Interfaces:
Edge, GraphComponent, VisualizableGraphComponent

 class SettableEdge
extends SimpleEdge

A utility class that allows the from and to nodes to be set separately. It is meant to be converted to a SimpleEdge after setting both ends.

IMPORTANT: this edge should not be added to a graph before setting both adjacent nodes (or better, it should always be converted through the toSimpleEdge() method).

Author:
Andrei Olaru

Field Summary
 
Fields inherited from class net.xqhs.graphs.graph.SimpleEdge
from, label, to
 
Fields inherited from class net.xqhs.graphs.representation.AbstractVisualizableGraphComponent
representations
 
Constructor Summary
protected SettableEdge(java.lang.String label)
          Constructs an Edge instance with the adjacent nodes not set.
 
Method Summary
protected  SettableEdge setFrom(Node sourceNode)
           
protected  SettableEdge setTo(Node destinationNode)
           
protected  SimpleEdge toSimpleEdge()
          Transfers the parameters of the current instance to a new SimpleEdge instance.
 
Methods inherited from class net.xqhs.graphs.graph.SimpleEdge
getFrom, getLabel, getTo, toString, toStringShort, toStringShort
 
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
 

Constructor Detail

SettableEdge

protected SettableEdge(java.lang.String label)
Constructs an Edge instance with the adjacent nodes not set.

Parameters:
label - : the label of the edge.
Method Detail

setFrom

protected SettableEdge setFrom(Node sourceNode)
Parameters:
sourceNode - : the source node.
Returns:
the instance itself.

setTo

protected SettableEdge setTo(Node destinationNode)
Parameters:
destinationNode - : the destination node.
Returns:
the instance itself.

toSimpleEdge

protected SimpleEdge toSimpleEdge()
Transfers the parameters of the current instance to a new SimpleEdge instance.

Returns:
the newly created SimpleEdge instance, with the same label and from and to nodes.