|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnu.staldal.xtree.Node
nu.staldal.xtree.NodeWithChildren
public abstract class NodeWithChildren
Base class for a node with children. The children are ordered.
Field Summary |
---|
Fields inherited from class nu.staldal.xtree.Node |
---|
parent, XML_NS |
Constructor Summary | |
---|---|
NodeWithChildren(int capacity)
Construct a node which children. |
Method Summary | |
---|---|
void |
addChild(Node newChild)
Add a new child to this node, last in sequence. |
Node |
getChild(int index)
Get a specific child of this node. |
void |
insertChild(Node newChild,
int index)
Insert a new child at a specific point in sequence. |
int |
numberOfChildren()
Get the current number of children this node have. |
Node |
removeChild(int index)
Remove a child from this node. |
Node |
replaceChild(Node newChild,
int index)
Replace a child with another. |
Methods inherited from class nu.staldal.xtree.Node |
---|
getBaseURI, getColumnNumber, getInheritedAttribute, getLineNumber, getParent, getPreserveSpace, getPublicId, getSystemId, isWhitespaceNode, lookupNamespacePrefix, lookupNamespaceURI, setColumn, setLine, setPublicId, setSystemId, toSAX |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NodeWithChildren(int capacity)
capacity
- the number of children this node should have,
use -1 if unknownMethod Detail |
---|
public int numberOfChildren()
public Node getChild(int index) throws java.lang.IndexOutOfBoundsException
index
- index of the node to get, the first child is 0.
java.lang.IndexOutOfBoundsException
- if no such child exist.public void addChild(Node newChild)
public Node replaceChild(Node newChild, int index) throws java.lang.IndexOutOfBoundsException
newChild
- the new childindex
- index of the child to replace
java.lang.IndexOutOfBoundsException
- if no such child existpublic Node removeChild(int index) throws java.lang.IndexOutOfBoundsException
index
- index of the child to replace
java.lang.IndexOutOfBoundsException
- if no such child existpublic void insertChild(Node newChild, int index) throws java.lang.IndexOutOfBoundsException
newChild
- the new childindex
- index of the new child
java.lang.IndexOutOfBoundsException
- if the index is invalid.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |