mascoptLib.graphs
Class Arc

java.lang.Object
  extended bymascoptLib.util.ObservableObject
      extended bymascoptLib.abstractGraph.MascoptObject
          extended bymascoptLib.abstractGraph.AbstractEdge
              extended bymascoptLib.graphs.Arc
All Implemented Interfaces:
Cloneable, MascoptObjectInterface, Observer

public class Arc
extends AbstractEdge

An Edge object is built using two Node objects. Given one node, the Edge object provides facilities to walk trough this edge when covering a Graph. Edge is derivated from MascoptObject. The Arc class is derivated from Edge and implements directed edges (ordered pairs of vertices).


Constructor Summary
Arc(AbstractVertex tail, AbstractVertex head)
          Constructs a new Arc object between n1 and n2.
 
Method Summary
 AbstractVertex getConnected(AbstractVertex n)
          Returns the node connected by current arc from node n.
 AbstractVertex getHead()
          Returns the destination of the arc.
 AbstractVertex getOppositeEnd(AbstractVertex vertex)
          Returns the opposite node of an arc There is no check about the arc orientation.
 AbstractVertex getTail()
          Returns the tail of the arc.
 boolean leadsTo(AbstractVertex n)
          Specifies if the current arc leads to node n.
 boolean leaves(AbstractVertex n)
          Specifies if the current arc comes from node n.
 void reverse()
          Reverse the arc orientation.
 String toString()
          Converts the Arc in string to be printed.
 
Methods inherited from class mascoptLib.abstractGraph.AbstractEdge
getAbstractVertices, getOppositeAbstractVertex, isLoop, size
 
Methods inherited from class mascoptLib.abstractGraph.MascoptObject
copyValues, countAllObjects, deleteValue, deleteValue, existValue, existValue, free, getDoubleValue, getDoubleValue, getDouValue, getDouValue, getId, getIntegerValue, getIntegerValue, getIntValue, getIntValue, getName, getValue, getValue, getValueContexts, getValueDataType, getValueDataType, getValueEntries, notifyOnValueChange, removeAllValues, setDoubleValue, setDoubleValue, setDouValue, setDouValue, setIntegerValue, setIntegerValue, setIntValue, setIntValue, setName, setValue, setValue, setValue, setValue, setValue, setValue, update
 
Methods inherited from class mascoptLib.util.ObservableObject
addAddObserver, addRemoveObserver, addValueObserver, countAddObservers, countRemoveObservers, countValueObservers, deleteAddObserver, deleteAddObserver, deleteRemoveObserver, deleteRemoveObserver, deleteValueObserver, deleteValueObserver
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Arc

public Arc(AbstractVertex tail,
           AbstractVertex head)
Constructs a new Arc object between n1 and n2. This object is observer of the two nodes.

Method Detail

toString

public String toString()
Converts the Arc in string to be printed.


getTail

public AbstractVertex getTail()
Returns the tail of the arc. As an arc is an oriented object, we can get the tail node.

Returns:
the tail node.

getHead

public AbstractVertex getHead()
Returns the destination of the arc. As an arc is an oriented object, we can get the destination node or head node.

Returns:
the head node.

getOppositeEnd

public AbstractVertex getOppositeEnd(AbstractVertex vertex)
Returns the opposite node of an arc There is no check about the arc orientation.

Returns:
the opposite node considering this arc.

leadsTo

public boolean leadsTo(AbstractVertex n)
Specifies if the current arc leads to node n.

Specified by:
leadsTo in class AbstractEdge
Parameters:
n - the node to test
Returns:
true if this arc leads to this node, false otherwise

leaves

public boolean leaves(AbstractVertex n)
Specifies if the current arc comes from node n.

Specified by:
leaves in class AbstractEdge
Parameters:
n - the node to test
Returns:
true if this arc comes from this node, false otherwise

getConnected

public AbstractVertex getConnected(AbstractVertex n)
Returns the node connected by current arc from node n.

Specified by:
getConnected in class AbstractEdge
Parameters:
n - the node to test
Returns:
the node connected to n via the current arc

reverse

public void reverse()
Reverse the arc orientation.