JavaGenes, NASA Ames. Written largely by Al Globus

gov.nasa.javaGenes.graph
Class Trail

java.lang.Object
  extended bygov.nasa.javaGenes.graph.Trail
All Implemented Interfaces:
java.lang.Cloneable

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

A trail of edges between ends[0] and ends[1]. The edges must be in order, each sharing a common vertex. The first edge must connect ends[0] and the last edge connect ends[1].

The edges and vertices are never copied or cloned, they are identical to those in the graph.


Field Summary
protected  ExtendedVector edges
           
protected  Vertex[] ends
           
 
Constructor Summary
Trail(Vertex v)
           
 
Method Summary
 void add(Edge e)
          add a new edge to the trail and update ends[1]
 java.lang.Object clone()
          keeps original edges and vertices
 Vertex getEndVertex()
           
 Edge getRandomEdge()
           
 Edge getRandomEdge(Predicate p)
           
 Vertex getStartVertex()
           
 java.lang.String getStringKey()
           
 Vertex getVertexInEdgeClosestToEnd(Edge e, Vertex end)
           
 Trail mediumCopyTrail()
          keeps original edges and vertices
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

edges

protected ExtendedVector edges

ends

protected Vertex[] ends
Constructor Detail

Trail

public Trail(Vertex v)
Method Detail

mediumCopyTrail

public Trail mediumCopyTrail()
keeps original edges and vertices


clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
keeps original edges and vertices

Throws:
java.lang.CloneNotSupportedException

add

public void add(Edge e)
add a new edge to the trail and update ends[1]


getVertexInEdgeClosestToEnd

public Vertex getVertexInEdgeClosestToEnd(Edge e,
                                          Vertex end)
Returns:
the vertex of e closest to end

getStringKey

public java.lang.String getStringKey()
Returns:
a string suitable for use as a hashtable key for this trail

getRandomEdge

public Edge getRandomEdge()

getRandomEdge

public Edge getRandomEdge(Predicate p)
Returns:
a random edge that satisfies p

getStartVertex

public Vertex getStartVertex()

getEndVertex

public Vertex getEndVertex()

JavaGenes, NASA Ames. Written largely by Al Globus