SandMark version 3.0


sandmark.util.graph
Class Path

java.lang.Object
  |
  +--sandmark.util.graph.Path
Direct Known Subclasses:
Path

public class Path
extends java.lang.Object


Field Summary
(package private)  java.util.HashSet nodes
           
(package private)  java.util.Vector path
           
 
Constructor Summary
Path()
          Construct an empty path.
Path(Path P)
          Construct a copy of the path P.
 
Method Summary
 void add(Node node)
          Add a node last to this path.
 void addFirst(Node node)
          Add a node first to this path.
 Path concatenate(Path P)
          Return a new path consisting of the nodes on the current path followed by the nodes on P.
 java.util.Enumeration elements()
          Return an enumerator for the nodes on this path.
 boolean equals(java.lang.Object path2)
          Return true if path2 is equal to this path.
 Node firstNode()
          Return the first node on this path.
 Node get(int k)
          Return the k:th node on this path.
 Node[] getPath()
          Return an array of the nodes on this path.
 int hashCode()
          Return a hash value for this path.
 java.util.Iterator iterator()
          Return an iterator for the nodes on this path.
 Node lastNode()
          Return the first last on this path.
static void main(java.lang.String[] args)
           
 boolean onPath(Node node)
          Return true if node is on this path.
 Path segment(Node first, Node last)
          Return the segment of this path between node first and last.
 int size()
          Return the number of nodes on this path.
(package private) static void test1()
           
 java.lang.String toString()
          Generate a string representation of this paths.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

path

java.util.Vector path

nodes

java.util.HashSet nodes
Constructor Detail

Path

public Path()
Construct an empty path.


Path

public Path(Path P)
Construct a copy of the path P.

Method Detail

add

public void add(Node node)
Add a node last to this path.

Parameters:
node - the node to be added.

addFirst

public void addFirst(Node node)
Add a node first to this path.

Parameters:
node - the node to be added.

onPath

public boolean onPath(Node node)
Return true if node is on this path.


getPath

public Node[] getPath()
Return an array of the nodes on this path.


get

public Node get(int k)
Return the k:th node on this path.


firstNode

public Node firstNode()
Return the first node on this path.


lastNode

public Node lastNode()
Return the first last on this path.


segment

public Path segment(Node first,
                    Node last)
Return the segment of this path between node first and last.

Parameters:
first - the first node on the path
last - the last node on the path

concatenate

public Path concatenate(Path P)
Return a new path consisting of the nodes on the current path followed by the nodes on P.

Parameters:
P - the path to be added.

size

public int size()
Return the number of nodes on this path.


elements

public java.util.Enumeration elements()
Return an enumerator for the nodes on this path.


iterator

public java.util.Iterator iterator()
Return an iterator for the nodes on this path.


equals

public boolean equals(java.lang.Object path2)
Return true if path2 is equal to this path.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Return a hash value for this path.

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Generate a string representation of this paths.

Overrides:
toString in class java.lang.Object

test1

static void test1()

main

public static void main(java.lang.String[] args)

SandMark version 3.0

Wed Jan 29 10:30:05 MST 2003