javax.rad.model
Class TreePath

java.lang.Object
  extended by javax.rad.model.TreePath

public class TreePath
extends java.lang.Object

A TreePath stores the path of node in a tree. It is stored as int array representing the selected row in the corresponding level. eg: [] empty array means tree path for the root page. [1] the detail page for the row 1 of root page. [1, 2] the detail page for the row 2 of the detail page for the row 1 of the root page.


Field Summary
static TreePath EMPTY
          Constant for an empty TreePath.
 
Constructor Summary
TreePath(int... pPath)
          Constructs a new TreePath.
 
Method Summary
 boolean containsAsParent(TreePath pTreePath)
          Returns true, if the given tree path is a parent path of this tree path.
 boolean equals(java.lang.Object pObject)
          
 int get(int pIndex)
          Gets the value of given index.
 TreePath getChildPath(int... pArray)
          Adds the given array to this TreePath.
 int getLast()
          Gets the value of the last index.
 TreePath getParentPath()
          Gets the parent tree path.
 TreePath getSubPath(int pLevel)
          Returns the sub path from the position of the given level.
 int hashCode()
          
 int length()
          Gets the length of the array.
 TreePath set(int pIndex, int pValue)
          Sets the value of a given index.
 int[] toArray()
          Gets a mutable array of this immutable array.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY

public static final TreePath EMPTY
Constant for an empty TreePath.

Constructor Detail

TreePath

public TreePath(int... pPath)
Constructs a new TreePath.

Parameters:
pPath - tree path.
Method Detail

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object pObject)

Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

length

public int length()
Gets the length of the array.

Returns:
the length of the array.

get

public int get(int pIndex)
Gets the value of given index.

Parameters:
pIndex - the index.
Returns:
the value of given index.

getLast

public int getLast()
Gets the value of the last index.

Returns:
the value of the last index.

getSubPath

public TreePath getSubPath(int pLevel)
Returns the sub path from the position of the given level.

Parameters:
pLevel - the start level.
Returns:
the sub path

set

public TreePath set(int pIndex,
                    int pValue)
Sets the value of a given index.

Parameters:
pIndex - the index.
pValue - the value.
Returns:
the new TreePath.

getChildPath

public TreePath getChildPath(int... pArray)
Adds the given array to this TreePath.

Parameters:
pArray - the array.
Returns:
the new TreePath.

getParentPath

public TreePath getParentPath()
Gets the parent tree path.

Returns:
the new TreePath.

containsAsParent

public boolean containsAsParent(TreePath pTreePath)
Returns true, if the given tree path is a parent path of this tree path. This means, that the tree path is either equal, or the given tree is a parent tree path of this tree path.

Parameters:
pTreePath - the parent tree path.
Returns:
true, if the given tree path is a parent path of this tree path.

toArray

public int[] toArray()
Gets a mutable array of this immutable array.

Returns:
a mutable array,


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.