lv.lumii.layoutengine.flowLayout.horizontalOrdering.pqtree

## Class PQTreeNode<T>

- java.lang.Object
- - lv.lumii.layoutengine.flowLayout.horizontalOrdering.pqtree.PQTreeNode<T>

- Type Parameters:
    `T` - object type
  Direct Known Subclasses:
    CNode, PNode, QNode

      public abstract class PQTreeNode<T>
      extends java.lang.Object

  This class implements all common methods that are common to P, Q and C-type nodes.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PQTreeNode(PQTreeNode<T> parent, PQTree<T> tree)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addChild(PQTreeNode<T> child)` This method adds child to this node.
    `void` | `addChild(PQTreeNode<T> child, boolean front)` This method adds child to this node to one of ends of child list.
    `void` | `clearChildList()` This method clears child list.
    `java.util.Iterator<PQTreeNode<T>>` | `getChildIterator()` This method return child list iterator.
    `java.util.LinkedList<PQTreeNode<T>>` | `getChildList()` This method returns child list of this node.
    `int` | `getLevel()` This method gets level value of this mode.
    `abstract PQTreeNode<T>` | `getMaxMinSeq()` This method computes minimal and maximal sequence values from its children and rotates to get child in such order that ones with minimal sequence is in the beginning of child list.
    `int` | `getMaxSeq()` This method returns maximal sequence value of this node.
    `int` | `getMinSeq()` This method returns minimal sequence value of this node.
    `PQTreeNode<T>` | `getParent()` This method returns parent of this method.
    `int` | `getPertQChildrenCount()` This method returns number of pertinent q-node children.
    `java.lang.String` | `getTestValue()` This method returns value that can be used for testing to identify this node.
    `PQTree<T>` | `getTree()` This method returns reference of owner tree.
    `abstract int` | `getType()` This method returns type of this node.
    `abstract char` | `getTypeChar()` This method returns different char for each type of node.
    `boolean` | `isFull()` This node returns whether this node is marked as full.
    `boolean` | `isPertinent()` This node returns whether this node is marked as pertinent.
    `boolean` | `isVisited()` This method checks if this node is visited.
    `abstract PQTreeNode<T>` | `process(boolean isRoot)` This method processes this node and makes all necessary transformations.
    `void` | `removeChild(PQTreeNode<T> child)` This method removes child from this nodes child list.
    `void` | `setEmpty()` This method sets this node as empty.
    `void` | `setLevel(int index)` This method sets level value of this node.
    `void` | `setMaxSeq(int newValue)` This method sets maximal sequence value.
    `void` | `setMinSeq(int newValue)` This method sets minimal sequence value.
    `void` | `setParent(PQTreeNode<T> newParent)` This method changes parent of this node.
    `void` | `setParent(PQTreeNode<T> newParent, boolean front)` This method changes parent of this node and adds it in child list in one of ends.
    `void` | `setParent(PQTreeNode<T> newParent, int index)` This method sets new parent of this node and removes this from old parent's child lists.
    `void` | `setParent(PQTreeNode<T> newParent, PQTreeNode<T> substitute)` This method changes parent of this node and adds it in child list in place of another node.
    `void` | `setTree(PQTree<T> tree)` This method sets owner PQTree of this node.
    `void` | `setVisited(boolean value)` This method sets new value of visited flag.
    `java.lang.String` | `toString()` This method returns string that represents this node.
    `void` | `update()` This method computes status of this node - full / pertinent / empty.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### PQTreeNode

          public PQTreeNode(PQTreeNode<T> parent,
                            PQTree<T> tree)

  - ### Method Detail

    - #### getParent

          public PQTreeNode<T> getParent()

      This method returns parent of this method.
      Returns:
        parent tree node. If this is root node then parent is `null`.

    - #### addChild

          public void addChild(PQTreeNode<T> child)

      This method adds child to this node.
      Parameters:
        `child` - new child node.

    - #### addChild

          public void addChild(PQTreeNode<T> child,
                               boolean front)

      This method adds child to this node to one of ends of child list.
      Parameters:
        `child` - new child node.
        `front` - if true then will add in front of list else at the end.

    - #### setParent

          public void setParent(PQTreeNode<T> newParent,
                                int index)

      This method sets new parent of this node and removes this from old parent's child lists.
      Parameters:
        `newParent` - new parent node.
        `index` - place in child list of new parent where to put this node.

    - #### setParent

          public void setParent(PQTreeNode<T> newParent,
                                PQTreeNode<T> substitute)

      This method changes parent of this node and adds it in child list in place of another node.
      Parameters:
        `newParent` - new parent node.
        `substitute` - place in which to put this node in new parent child list.

    - #### setParent

          public void setParent(PQTreeNode<T> newParent,
                                boolean front)

      This method changes parent of this node and adds it in child list in one of ends.
      Parameters:
        `newParent` - new parent node.
        `front` - if true then add this node in front of child list otherwise at the end.

    - #### setParent

          public void setParent(PQTreeNode<T> newParent)

      This method changes parent of this node.
      Parameters:
        `newParent` - new parent node.

    - #### removeChild

          public void removeChild(PQTreeNode<T> child)

      This method removes child from this nodes child list.
      Parameters:
        `child` - to remove from child list.

    - #### setEmpty

          public void setEmpty()

      This method sets this node as empty.

    - #### update

          public void update()

      This method computes status of this node - full / pertinent / empty.

    - #### isFull

          public boolean isFull()

      This node returns whether this node is marked as full.
      Returns:
        boolean value that is true if this node is marked as full false otherwise.

    - #### isPertinent

          public boolean isPertinent()

      This node returns whether this node is marked as pertinent.
      Returns:
        boolean value that is true if this node is marked as pertinent false otherwise.

    - #### getPertQChildrenCount

          public int getPertQChildrenCount()

      This method returns number of pertinent q-node children.
      Returns:
        number of pertinent q-node children.

    - #### getChildIterator

          public java.util.Iterator<PQTreeNode<T>> getChildIterator()

      This method return child list iterator.
      Returns:
        iterator over all children.

    - #### getChildList

          public java.util.LinkedList<PQTreeNode<T>> getChildList()

      This method returns child list of this node.
      Returns:
        list of children.

    - #### clearChildList

          public void clearChildList()

      This method clears child list.

    - #### process

          public abstract PQTreeNode<T> process(boolean isRoot)

      This method processes this node and makes all necessary transformations.
      Parameters:
        `isRoot` - boolean value whether this is pertinent tree root node.
      Returns:
        boolean value that represents successful transformation.

    - #### getType

          public abstract int getType()

      This method returns type of this node.
      Returns:
        integer type value. Types are coded as:
    - `PQTree.CNODE`,
    - `PQTree.QNODE`,
    - `PQTree.PNODE`.
      See Also:
        `PQTree`

    - #### getTypeChar

          public abstract char getTypeChar()

      This method returns different char for each type of node.
      Returns:
        char.

    - #### getTestValue

          public java.lang.String getTestValue()

      This method returns value that can be used for testing to identify this node.
      Returns:
        string value that represents this node.

    - #### toString

          public java.lang.String toString()

      This method returns string that represents this node.
      Overrides:
        `toString` in class `java.lang.Object`

    - #### setVisited

          public void setVisited(boolean value)

      This method sets new value of visited flag.
      Parameters:
        `value` - new value of visited flag.

    - #### isVisited

          public boolean isVisited()

      This method checks if this node is visited.
      Returns:
        `True` iff this node is visited, `False` otherwise.

    - #### setMinSeq

          public void setMinSeq(int newValue)

      This method sets minimal sequence value.
      Parameters:
        `newValue` - new value of minimal sequence.

    - #### setMaxSeq

          public void setMaxSeq(int newValue)

      This method sets maximal sequence value.
      Parameters:
        `newValue` - new value of maximal sequence.

    - #### getMinSeq

          public int getMinSeq()

      This method returns minimal sequence value of this node.
      Returns:
        minimal sequence value.

    - #### getMaxSeq

          public int getMaxSeq()

      This method returns maximal sequence value of this node.
      Returns:
        maximal sequence value.

    - #### setLevel

          public void setLevel(int index)

      This method sets level value of this node. Level is counted as PQ-tree level. PQ-tree root is in 0-th level.
      Parameters:
        `index` - new level value.

    - #### getLevel

          public int getLevel()

      This method gets level value of this mode. Level is counted as PQ-tree level. PQ-tree root is in O-th level.
      Returns:
        level value.

    - #### getTree

          public PQTree<T> getTree()

      This method returns reference of owner tree.
      Returns:
        owner PQTree.

    - #### setTree

          public void setTree(PQTree<T> tree)

      This method sets owner PQTree of this node.
      Parameters:
        `tree` - new owner tree.

    - #### getMaxMinSeq

          public abstract PQTreeNode<T> getMaxMinSeq()

      This method computes minimal and maximal sequence values from its children and rotates to get child in such order that ones with minimal sequence is in the beginning of child list.