ist.palcom.hmap
Class HmapPath

java.lang.Object
  extended by ist.palcom.hmap.HmapPath

public class HmapPath
extends Object

A TreePath is a path in an h-map tree, represented by an array of PathEntry objects A TreePath can be instantiated with a string encoded as a path of the form: ### Look to HmapKey for the encoding of each entry


Constructor Summary
HmapPath(HmapKey hmapKey)
          Create a new path
HmapPath(HmapKey[] keyArray)
           
HmapPath(HmapPath treePath, HmapKey hmapKey)
           
 
Method Summary
 boolean equals(HmapPath ePath)
          Checks for equality with another path
static HmapPath fromString(String encodedString)
           
 HmapKey getKeyAt(int i)
          Returns the key corresponding to a specific entry in the path.
 int getLength()
           
static HmapPath mergePaths(HmapPath one, HmapPath two)
           
 HmapPath subPath(int from, int to)
          Returns a subpath of this path.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, println
 

Constructor Detail

HmapPath

public HmapPath(HmapKey[] keyArray)

HmapPath

public HmapPath(HmapKey hmapKey)
Create a new path

Parameters:
hmapKey - The root entry in a new path

HmapPath

public HmapPath(HmapPath treePath,
                HmapKey hmapKey)
Parameters:
treePath - The path on which to build this path
hmapKey - The new entry
Method Detail

toString

public String toString()
Overrides:
toString in class Object
Returns:
A stringified version of this path.

getKeyAt

public HmapKey getKeyAt(int i)
Returns the key corresponding to a specific entry in the path.

Parameters:
i - the entry number
Returns:
a correct key if one exists. Null if out of bounds

getLength

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

equals

public boolean equals(HmapPath ePath)
Checks for equality with another path

Parameters:
ePath - The path to check
Returns:
true of the paths are equal. false if not

subPath

public HmapPath subPath(int from,
                        int to)
Returns a subpath of this path. Indices are defined as array counts: from 0 to length-1

Parameters:
from - The entry to take from; included
to - The entry to take to; included
Returns:

mergePaths

public static HmapPath mergePaths(HmapPath one,
                                  HmapPath two)
Parameters:
one - The new first part of the path
two - The new second part of the path
Returns:
A merger of two paths into one, with the first parameter as the first part of the path and the second the second

fromString

public static HmapPath fromString(String encodedString)