ist.palcom.hgraph
Class Path

java.lang.Object
  extended by ist.palcom.hgraph.Path

public class Path
extends java.lang.Object

The Path class is for representing paths in an Hgraph. These are represented as delimited text identifiers. Paths are also used for manifesting functional and structural dependencies in the hgraph


Field Summary
static java.lang.String PATH_DELIMITER
          The delimiter string for paths
 
Constructor Summary
Path(java.lang.String name)
          Creates a path of length 1
Path(java.lang.String[] path)
          Creates a path from an already existing string array
Path(java.lang.String name, java.lang.String[] superPath)
          Creates a child path by copying the supplied super path and appending a name identifier
 
Method Summary
 boolean equals(Path eqPath)
          Compares the parameter path with this path
 boolean equals(java.lang.String path)
           
static Path fromString(java.lang.String stringPath)
          Creates a Path object from a string
static Path fromString(java.lang.String name, java.lang.String parentStringPath)
          Creates a child path from a string and an identifier string
 int getLength()
           
 java.lang.String[] getPathArray()
           
 java.lang.String toString()
          Returns a stringified version of the path
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PATH_DELIMITER

public static final java.lang.String PATH_DELIMITER
The delimiter string for paths

See Also:
Constant Field Values
Constructor Detail

Path

public Path(java.lang.String name)
Creates a path of length 1

Parameters:
name - The sole identifier in the path

Path

public Path(java.lang.String name,
            java.lang.String[] superPath)
Creates a child path by copying the supplied super path and appending a name identifier

Parameters:
name - The name of the node to which this path belongs
superPath - The path of the parent

Path

public Path(java.lang.String[] path)
Creates a path from an already existing string array

Parameters:
path -
Method Detail

getPathArray

public java.lang.String[] getPathArray()
Returns:
The internal representation String array

toString

public java.lang.String toString()
Returns a stringified version of the path

Overrides:
toString in class java.lang.Object

getLength

public int getLength()
Returns:
the length of the path

equals

public boolean equals(Path eqPath)
Compares the parameter path with this path

Parameters:
eqPath -
Returns:
True if they are equally long and all entries are equal. False if not

equals

public boolean equals(java.lang.String path)
Parameters:
path - a string which supposedly is a path
Returns:
true if the parameter string matches the stringified version of this path

fromString

public static Path fromString(java.lang.String stringPath)
Creates a Path object from a string

Returns:
a Path based on the string parameter

fromString

public static Path fromString(java.lang.String name,
                              java.lang.String parentStringPath)
Creates a child path from a string and an identifier string

Parameters:
name -
parentStringPath -
Returns:
a Path based on the parameters