org.sakaiproject.jsf.model
Class TreeLevel

java.lang.Object
  extended byorg.sakaiproject.jsf.model.TreeLevel

public class TreeLevel
extends Object


Constructor Summary
TreeLevel()
          No-arg constructor.
TreeLevel(int index)
          "Parent" constructor.
TreeLevel(TreeLevel parent)
          "Child" constructor.
 
Method Summary
protected  int addChild(TreeLevel child)
          Utility reciprocal method to add a child when it chooses this as its parent.
 List getChildren()
          Get list of all child TreeLevels
 TreeLevel getParent()
          Get parent, or self if no parent.
 boolean isChild()
          True if this has a parent.
static void main(String[] args)
          test code, demonstrates usage.
 String toString()
          String representing 0-indexed parent-child relationships.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TreeLevel

public TreeLevel(int index)
"Parent" constructor. This is a top level and is its own parent and is a child of none.


TreeLevel

public TreeLevel()
No-arg constructor. "Parent" constructor equivalent, with index set to 0.


TreeLevel

public TreeLevel(TreeLevel parent)
"Child" constructor. Create a child of "parent".

Parameters:
parent - TreeLevel
Method Detail

getParent

public TreeLevel getParent()
Get parent, or self if no parent.

Returns:
TreeLevel

getChildren

public List getChildren()
Get list of all child TreeLevels

Returns:
List

isChild

public boolean isChild()
True if this has a parent.

Returns:
boolean

toString

public String toString()
String representing 0-indexed parent-child relationships. Example: 18_9_4 is the fourth child of the nineth child of 18

Returns:
String

addChild

protected int addChild(TreeLevel child)
Utility reciprocal method to add a child when it chooses this as its parent.

Parameters:
child - TreeLevel
Returns:
int

main

public static void main(String[] args)
test code, demonstrates usage.

Parameters:
args - String[]