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

## j3deditor.bin.hierarchy
Class HierarchyNode

    java.lang.Object
      j3deditor.bin.hierarchy.HierarchyNode

Direct Known Subclasses:
  HierarchyManager, J3DeAppearance, J3DeCamera, J3DeImageComponent, J3DeMaterial, J3DeObject, J3DeScene, J3DeTexture

    public abstract class HierarchyNode

extends java.lang.Object

Base class for all hierarchy classes.

Author:
  Risto Seene

Constructor Summary
`HierarchyNode(java.lang.String name, HNodeType type, long index)` Creates an instance of `HierarchyNode` with the specified name, type and index.

Method Summary
`protected HierarchyNode` | `clone(HierarchyNode node)` Clones this node.
`boolean` | `equals(HierarchyNode node)` Tests if this node equals to the given node.
`HierarchyNode` | `getChild(int index)` Returns the child at the specified index.
`long` | `getIndex()` Returns the index of this node.
`int` | `getIndexOfChild(HierarchyNode child)` Returns the index of specified child.
`int` | `getNumberOfChildren()` Returns the number of children.
`HierarchyNode` | `getParent()` Returns the parent of this node.
`HierarchyNode` | `getParent(java.lang.Class type)` Returns the first anchestor of the given type.
`HNodeType` | `getType()` Returns the type of this node.
`protected boolean` | `hasNamedChild(HierarchyNode object)` Tests if this node has child which name equals to the name of the given node.
`protected void` | `removeChild(HierarchyNode child)` Removes the specified child node.
`void` | `setName(java.lang.String name)` Renames this node.
`void` | `setParent(HierarchyNode parent)` Sets the parent of this node.
`java.lang.String` | `toString()` Returns the name of this node.
`void` | `updateName()` Changes the name of this node if the parent of this node has a child with the same name.

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

Constructor Detail

### HierarchyNode

    public HierarchyNode(java.lang.String name,
                         HNodeType type,
                         long index)

  Creates an instance of `HierarchyNode` with the specified name, type and index.

  Parameters:
    `name` - the name of the new node
    `type` - the type of the new node
    `index` - the index of the new node

Method Detail

### removeChild

    protected void removeChild(HierarchyNode child)

  Removes the specified child node. Should be overrided by subclasses

  Parameters:
    `child` - child node to be removed

### clone

    protected HierarchyNode clone(HierarchyNode node)

  Clones this node. Should only be called by subclasses

  Parameters:
    `node` - node sent by subclass
  Returns:
    the same node that was inserted

### getChild

    public HierarchyNode getChild(int index)

  Returns the child at the specified index. Should be overrided by subclasses

  Parameters:
    `index` - index of child
  Returns:
    Returns the child with the specified index

### getNumberOfChildren

    public int getNumberOfChildren()

  Returns the number of children. Should be overrided by subclasses

  Returns:
    Returns the number of children as integer

### toString

    public java.lang.String toString()

  Returns the name of this node.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    Returns the name of this node

### setName

    public void setName(java.lang.String name)

  Renames this node.

  Parameters:
    `name` - new name

### getIndexOfChild

    public int getIndexOfChild(HierarchyNode child)

  Returns the index of specified child. Should be overrided by subclasses

  Parameters:
    `child` - child node which index will be returned
  Returns:
    Returns the index of specified child

### getType

    public HNodeType getType()

  Returns the type of this node.

  Returns:
    Returns the type of this node

### getIndex

    public long getIndex()

  Returns the index of this node.

  Returns:
    Returns the index of this node

### equals

    public boolean equals(HierarchyNode node)

  Tests if this node equals to the given node.

  Parameters:
    `node` - node that will be compared to this node
  Returns:
    Returns `true` if the given node equals to this node, otherwise `false`

### setParent

    public void setParent(HierarchyNode parent)

  Sets the parent of this node.

  Parameters:
    `parent` - new parent

### getParent

    public HierarchyNode getParent()

  Returns the parent of this node.

  Returns:
    Returns the parent of this node

### getParent

    public HierarchyNode getParent(java.lang.Class type)

  Returns the first anchestor of the given type.

  Parameters:
    `type` - type of the requested anchestor
  Returns:
    returns the requested anchestor

### hasNamedChild

    protected boolean hasNamedChild(HierarchyNode object)

  Tests if this node has child which name equals to the name of the given node. Should be overrided by subclasses

  Parameters:
    `object` - node which name will be tested
  Returns:
    Returns `true` if the name of the given node equals to the name of this node, otherwise `false`

### updateName

    public void updateName()

  Changes the name of this node if the parent of this node has a child with the same name.

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