Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## Util.Structures
Class TreeNode<E>

    java.lang.Object
      java.util.AbstractCollection<E>
          java.util.AbstractList<E>
              java.util.ArrayList<TreeNode<E>>
                  Util.Structures.TreeNode<E>

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<TreeNode<E>>, java.util.Collection<TreeNode<E>>, java.util.List<TreeNode<E>>, java.util.RandomAccess

Direct Known Subclasses:
  DerivationNode

    public class TreeNode<E>

extends java.util.ArrayList<TreeNode<E>>

Node for use in the nimble tree structure. Has a parent and data. Is an array list

Author:
  EHemberg, Eoin Murphy
See Also:
  Serialized Form

Field Summary

Fields inherited from class java.util.AbstractList
`modCount`

Constructor Summary
`TreeNode()` Creates a new instance of TreeNode
`TreeNode(TreeNode<E> copy)` Copy constructor
`TreeNode(TreeNode<E> parent, E data)` Create node with parent and data
`TreeNode(TreeNode<E> copy, TreeNode<E> parent)`

Method Summary
`boolean` | `add(TreeNode<E> child)` Adds a child node to this node.
`java.lang.String` | `collapse()` Collapse the node to a string
`E` | `getData()` Get data in node
`int` | `getDepth()` Get depth of this node in the tree
`TreeNode<E>` | `getEnd()` Get the last node
`int` | `getID()`
`int` | `getInfo()`
`int` | `getMaxDepth()`
`TreeNode<E>` | `getParent()` Get parent node
`static void` | `main(java.lang.String[] args)`
`void` | `setData(E data)` Set data in node
`void` | `setDepth(int i)` Set depth of this node and it's children
`void` | `setID(int id)`
`void` | `setInfo(int info)`
`void` | `setParent(TreeNode<E> tn)` Set parent node
`java.lang.String` | `toString()` Build the string using a textural tree-view

Methods inherited from class java.util.ArrayList
`add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize`

Methods inherited from class java.util.AbstractList
`equals, hashCode, iterator, listIterator, listIterator, subList`

Methods inherited from class java.util.AbstractCollection
`containsAll, removeAll, retainAll`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.util.List
`containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList`

Constructor Detail

### TreeNode

    public TreeNode()

  Creates a new instance of TreeNode

### TreeNode

    public TreeNode(TreeNode<E> parent,
                    E data)

  Create node with parent and data

  Parameters:
    `parent` - node parent
    `data` - node data

### TreeNode

    public TreeNode(TreeNode<E> copy)

  Copy constructor

  Parameters:
    `copy` - node to copy

### TreeNode

    public TreeNode(TreeNode<E> copy,
                    TreeNode<E> parent)

Method Detail

### add

    public boolean add(TreeNode<E> child)

  Adds a child node to this node. Sets the childs parent and depth

  Specified by:
    `add` in interface `java.util.Collection<TreeNode<E>>`
  Specified by:
    `add` in interface `java.util.List<TreeNode<E>>`
  Overrides:
    `add` in class `java.util.ArrayList<TreeNode<E>>`
  Parameters:
    `child` - the child node to add

### getParent

    public TreeNode<E> getParent()

  Get parent node

  Returns:
    parent node

### setParent

    public void setParent(TreeNode<E> tn)

  Set parent node

  Parameters:
    `tn` - parent node

### getData

    public E getData()

  Get data in node

  Returns:
    data

### setData

    public void setData(E data)

  Set data in node

  Parameters:
    `data` - node data

### getInfo

    public int getInfo()

### setInfo

    public void setInfo(int info)

### getID

    public int getID()

### setID

    public void setID(int id)

### setDepth

    public void setDepth(int i)

  Set depth of this node and it's children

  Parameters:
    `i` - depth

### getMaxDepth

    public int getMaxDepth()

### getDepth

    public int getDepth()

  Get depth of this node in the tree

  Returns:
    node's depth

### getEnd

    public TreeNode<E> getEnd()

  Get the last node

  Returns:
    the last node

### collapse

    public java.lang.String collapse()

  Collapse the node to a string

  Returns:
    string representation

### toString

    public java.lang.String toString()

  Build the string using a textural tree-view

  Overrides:
    `toString` in class `java.util.AbstractCollection<TreeNode<E>>`
  Returns:
    String

### main

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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD