mascoptLib.abstractGraph
Class AbstractPath

java.lang.Object
  extended bymascoptLib.util.ObservableObject
      extended bymascoptLib.abstractGraph.MascoptObject
          extended bymascoptLib.abstractGraph.AbstractGraph
              extended bymascoptLib.abstractGraph.AbstractPath
All Implemented Interfaces:
Cloneable, MascoptObjectInterface, Observer
Direct Known Subclasses:
DiPath, Path

public abstract class AbstractPath
extends AbstractGraph
implements Observer

An AbstractPath object give the ability to build a path over an AbstractGraph. The path can be merged with another path with common start and end vertex, resulting in a multi-path. The path can be covered through the graph. The path is also considered as a graph, derived from AbstractGraph.


Constructor Summary
AbstractPath(AbstractEdgeSet abstractEdgeSet)
          Default Constuctor on a path.
AbstractPath(AbstractPath path)
          Copy edge set and vertex set of a path, creating a new path (vertices and edges are not copied).
 
Method Summary
 boolean checkIntegrity()
          Integrity of the path.
 boolean concatAbstractEdge(AbstractEdge abstractEdge)
          Add an edge to a path.
 boolean concatAbstractPath(AbstractPath abstractPath)
          Concat two paths in one path.
static long countAllAbstractPaths()
          Returns number of instances
 void free()
          Free memory when this object is linked.
 AbstractVertex getAbstractEnd()
          Returns the ending vertex of the path.
 AbstractVertex getAbstractStart()
          Returns the starting vertex of the path.
 boolean isClosed()
          Detects if a path is closed (is a cycle).
 boolean isEnd(AbstractVertex aVertex)
          Says if this vertex is the ending vertex.
 boolean isMulti()
          Says if a path is a multi path.
 boolean isStart(AbstractVertex aVertex)
          Says if this vertex is the starting vertex.
 boolean mergeAbstractPath(AbstractPath abstractPath)
          Merge two paths with the same start and end vertex.
 AbstractEdge nextAbstractEdge(AbstractVertex vertex)
          Given a vertex in the path, returns the next edge when covering the path.
 MascoptFixedSet nextAbstractEdgeSet(AbstractVertex vertex)
          Given a vertex in the path, returns the next edges when covering the path.
 AbstractVertex nextAbstractVertex(AbstractVertex vertex)
          Given a vertex in the path, returns the next vertex when covering the path.
 AbstractEdge predAbstractEdge(AbstractVertex vertex)
          Given a vertex in the path, returns the previous edge when covering the path.
 MascoptFixedSet predAbstractEdgeSet(AbstractVertex vertex)
          Given a vertex in the path, returns the previous edges when covering the path.
 boolean removeLastEdge()
          Remove the last edge of a mono path.
 String toString()
          Converts the path in string to be printed.
 void update(Observable o, Object arg)
          Describe update method here.
 
Methods inherited from class mascoptLib.abstractGraph.AbstractGraph
breadthFirstIterator, copyAbstractGraph, countAllAbstractGraphs, depthFirstIterator, getAbstractEdgeSet, getAbstractVertexSet, getFactory, getSuperGraph, isSubGraph, replace, replace, setAbstractEdgeSet, setAbstractVertexSet, setSuperGraph
 
Methods inherited from class mascoptLib.abstractGraph.MascoptObject
copyValues, countAllObjects, deleteValue, deleteValue, existValue, existValue, 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
 
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

AbstractPath

public AbstractPath(AbstractEdgeSet abstractEdgeSet)
Default Constuctor on a path. The path must be constructed on a set of edges. Typically, we use the edgeSet of the graph on which is based the path.

Parameters:
abstractEdgeSet - the set of edge on which is based the path.

AbstractPath

public AbstractPath(AbstractPath path)
Copy edge set and vertex set of a path, creating a new path (vertices and edges are not copied). Note that only the structure of the path is duplicated. All the values stored with setValue is lost.

Method Detail

toString

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

Overrides:
toString in class AbstractGraph

removeLastEdge

public boolean removeLastEdge()
                       throws MascoptImpossibleOperationPathException
Remove the last edge of a mono path.

Throws:
MascoptImpossibleOperationPathException

concatAbstractEdge

public boolean concatAbstractEdge(AbstractEdge abstractEdge)
Add an edge to a path. At the end or start part of the path can be added a new edge. This edge must be in the EdgeSet given when constructing the path.

Parameters:
abstractEdge - the edge to add to the path.
Returns:
true if the add is successfull.

concatAbstractPath

public boolean concatAbstractPath(AbstractPath abstractPath)
Concat two paths in one path.

Parameters:
abstractPath - the path to concat.
Returns:
true if successfull.

mergeAbstractPath

public boolean mergeAbstractPath(AbstractPath abstractPath)
Merge two paths with the same start and end vertex. This function permits to create multi paths. In this way, the multi path is constructed step by step merging each part of the multi path.

Parameters:
abstractPath - the path to merge.
Returns:
true if successfull.

getAbstractStart

public AbstractVertex getAbstractStart()
Returns the starting vertex of the path.

Returns:
the start vertex of the path.

getAbstractEnd

public AbstractVertex getAbstractEnd()
Returns the ending vertex of the path.

Returns:
the end vertex of the path.

isStart

public boolean isStart(AbstractVertex aVertex)
Says if this vertex is the starting vertex.

Parameters:
aVertex - the vertex to test.
Returns:
true if aVertex is the starting vertex.

isEnd

public boolean isEnd(AbstractVertex aVertex)
Says if this vertex is the ending vertex.

Parameters:
aVertex - the vertex to test.
Returns:
true if aVertex is the ending vertex.

isClosed

public boolean isClosed()
Detects if a path is closed (is a cycle).

Returns:
true if the starting vertex equals the ending vertex.

isMulti

public boolean isMulti()
Says if a path is a multi path. When two paths has been merged, the path becomes a multi paths.

Returns:
true if the path is a multi path.

nextAbstractEdgeSet

public MascoptFixedSet nextAbstractEdgeSet(AbstractVertex vertex)
Given a vertex in the path, returns the next edges when covering the path. This function is usefull when going all over the path. Giving each vertex we can obtain the next set of edges in the path.

Parameters:
vertex - the vertex of the path to consider.
Returns:
an edgeSet containing all next edges.

predAbstractEdgeSet

public MascoptFixedSet predAbstractEdgeSet(AbstractVertex vertex)
Given a vertex in the path, returns the previous edges when covering the path. This function is usefull when going all over the path. Giving each vertex we can obtain the previous set of edges in the path.

Parameters:
vertex - the vertex of the path to consider.
Returns:
an edgeSet containing all previous edges.

countAllAbstractPaths

public static long countAllAbstractPaths()
Returns number of instances

Returns:
a long

nextAbstractEdge

public AbstractEdge nextAbstractEdge(AbstractVertex vertex)
Given a vertex in the path, returns the next edge when covering the path. This function is usefull when going all over the path. Giving each vertex we can obtain the next edge in the path. It supposes that the path is not a multi path.

Parameters:
vertex - the vertex of the path to consider.
Returns:
the edge next of the vertex.

predAbstractEdge

public AbstractEdge predAbstractEdge(AbstractVertex vertex)
Given a vertex in the path, returns the previous edge when covering the path. This function is usefull when going all over the path. Giving each vertex we can obtain the previous edge in the path. It supposes that the path is not a multi path.

Parameters:
vertex - the vertex of the path to consider.
Returns:
the edge previous of the vertex.

nextAbstractVertex

public AbstractVertex nextAbstractVertex(AbstractVertex vertex)
Given a vertex in the path, returns the next vertex when covering the path. This function is usefull when going all over the path. Giving each vertex we can obtain the previous vertex in the path. It supposes that the path is not a multi path.

Parameters:
vertex - the vertex of the path to consider.
Returns:
the vertex next of the vertex.

checkIntegrity

public boolean checkIntegrity()
Integrity of the path. Default behavior: returns true.

Overrides:
checkIntegrity in class AbstractGraph
Returns:
true if the integrity of the path is true

update

public void update(Observable o,
                   Object arg)
Description copied from class: MascoptObject
Describe update method here.

Specified by:
update in interface Observer
Overrides:
update in class MascoptObject
Parameters:
o - an Observable value
arg - an Object value

free

public void free()
Description copied from class: AbstractGraph
Free memory when this object is linked. This method is necessary when an edge set is a sub set of an other edge set. As this sub set is listening to his father (for changes), it is not removed of memory when no one is pointing to it (because the father is still pointing to it). So, when the user does not use this object anymore, he must free it from his father. This method calls the free method on the edge set and vertex set of the graph.

Overrides:
free in class AbstractGraph