org.rollerjm.graph
Class Path

java.lang.Object
  |
  +--org.rollerjm.graph.Path
All Implemented Interfaces:
java.lang.Cloneable

public class Path
extends java.lang.Object
implements java.lang.Cloneable

Title: graphs

Description: generalization of the route concept. It is a list of Objects ( i.e. O1--O2--O3--04). Cloneable.

Copyright: Copyright (c) 2002

Company:

Version:
1.0
Author:
Jean-Michel Garnier

Field Summary
private  java.util.ArrayList verticesList
          List which contains the vertices
 
Constructor Summary
Path()
           
Path(java.util.List list)
           
 
Method Summary
 Path addPath(Path path)
           
 Path addVertex(java.lang.Object vertex)
           
 java.lang.Object clone()
          clone the path, all the objects in the path should be cloneables
 java.lang.Object get(int index)
           
 java.lang.Object getLast()
           
 int getLength()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

verticesList

private java.util.ArrayList verticesList
List which contains the vertices

Constructor Detail

Path

public Path()

Path

public Path(java.util.List list)
Parameters:
list -
Method Detail

getLength

public int getLength()
Returns:

addVertex

public Path addVertex(java.lang.Object vertex)
Parameters:
vertex - should be cloneable
Returns:
this path

addPath

public Path addPath(Path path)
Parameters:
path -
Returns:
this path

get

public java.lang.Object get(int index)
Parameters:
index -
Returns:
the object at position index in the path

getLast

public java.lang.Object getLast()
Returns:
last object of the path

clone

public java.lang.Object clone()
clone the path, all the objects in the path should be cloneables

Overrides:
clone in class java.lang.Object
Returns:
the cloned path

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a list of all the vertices of the path separed by - i.e. Path[A, B, C] --> "A-B-C"