diva.graph.basic
Class BasicGraphModel.BasicEdge

java.lang.Object
  extended by diva.util.BasicPropertyContainer
      extended by diva.graph.basic.BasicGraphModel.Intermediate
          extended by diva.graph.basic.BasicGraphModel.BasicEdge
All Implemented Interfaces:
Edge, PropertyContainer, SemanticObjectContainer
Enclosing class:
BasicGraphModel

private static class BasicGraphModel.BasicEdge
extends BasicGraphModel.Intermediate
implements Edge

A basic implementation of the Edge interface.


Field Summary
private  boolean _directed
          Whether or not this edge is directed.
private  Node _head
          The head of the edge.
private  Node _tail
          The tail of the edge.
 
Constructor Summary
BasicGraphModel.BasicEdge(java.lang.Object userObject)
          Create a new edge with the specified user object but no tail or head.
BasicGraphModel.BasicEdge(java.lang.Object userObject, Node tail, Node head)
          Create a new edge with the specified user object and tail/head
 
Method Summary
 boolean acceptHead(Node head)
          Return whether or not the given node is a valid head of this edge.
 boolean acceptTail(Node tail)
          Return whether or not the given node is a valid tail of this edge.
 Node getHead()
          Return the node at the head of this edge.
 Node getTail()
          Return the node at the tail of this edge.
 boolean isDirected()
          Return whether or not this edge is directed.
 void setHead(Node n)
          Set the node that this edge points to.
 void setTail(Node n)
          Set the node that this edge stems from.
 java.lang.String toString()
          Print a readable description of this edge
 
Methods inherited from class diva.graph.basic.BasicGraphModel.Intermediate
getSemanticObject, setSemanticObject
 
Methods inherited from class diva.util.BasicPropertyContainer
getProperty, properties, propertyNames, removeAllProperties, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface diva.util.SemanticObjectContainer
getSemanticObject, setSemanticObject
 
Methods inherited from interface diva.util.PropertyContainer
getProperty, propertyNames, setProperty
 

Field Detail

_directed

private boolean _directed
Whether or not this edge is directed.


_head

private Node _head
The head of the edge.


_tail

private Node _tail
The tail of the edge.

Constructor Detail

BasicGraphModel.BasicEdge

public BasicGraphModel.BasicEdge(java.lang.Object userObject)
Create a new edge with the specified user object but no tail or head.


BasicGraphModel.BasicEdge

public BasicGraphModel.BasicEdge(java.lang.Object userObject,
                                 Node tail,
                                 Node head)
Create a new edge with the specified user object and tail/head

Method Detail

acceptHead

public boolean acceptHead(Node head)
Description copied from interface: Edge
Return whether or not the given node is a valid head of this edge.

Specified by:
acceptHead in interface Edge

acceptTail

public boolean acceptTail(Node tail)
Description copied from interface: Edge
Return whether or not the given node is a valid tail of this edge.

Specified by:
acceptTail in interface Edge

getHead

public Node getHead()
Description copied from interface: Edge
Return the node at the head of this edge.

Specified by:
getHead in interface Edge

getTail

public Node getTail()
Description copied from interface: Edge
Return the node at the tail of this edge.

Specified by:
getTail in interface Edge

isDirected

public boolean isDirected()
Description copied from interface: Edge
Return whether or not this edge is directed.

Specified by:
isDirected in interface Edge

setHead

public void setHead(Node n)
Description copied from interface: Edge
Set the node that this edge points to. Implementors of this method are also responsible for insuring that it is set properly as an "incoming" edge of the node, and that it is removed as an incoming edge from its previous head node.

Specified by:
setHead in interface Edge

setTail

public void setTail(Node n)
Description copied from interface: Edge
Set the node that this edge stems from. Implementors of this method are also responsible for insuring that it is set properly as an "outgoing" edge of the node, and that it is removed as an outgoing edge from its previous tail node.

Specified by:
setTail in interface Edge

toString

public java.lang.String toString()
Print a readable description of this edge

Overrides:
toString in class java.lang.Object