|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.core.internal.dtree.AbstractDataTree
public abstract class AbstractDataTree
Data trees can be viewed as generic multi-leaf trees. The tree points to a single rootNode, and each node can contain an arbitrary number of children.
Internally, data trees can be either complete trees (DataTree class), or delta
trees (DeltaDataTree
class). A DataTree is a stand-alone tree
that contains all its own data. A DeltaDataTree
only stores the
differences between itself and its parent tree. This sparse representation allows
the API user to retain chains of delta trees that represent incremental changes to
a system. Using the delta trees, the user can undo changes to a tree by going up to
the parent tree.
Both representations of the tree support the same API, so the user of a tree
never needs to know if they're dealing with a complete tree or a chain of deltas.
Delta trees support an extended API of delta operations. See the DeltaDataTree
class for details.
DataTree
,
DeltaDataTree
Constructor Summary | |
---|---|
AbstractDataTree()
Creates a new empty tree |
Method Summary | |
---|---|
abstract AbstractDataTreeNode |
copyCompleteSubtree(org.eclipse.core.runtime.IPath key)
Returns a copy of the node subtree rooted at the given key. |
abstract void |
createChild(org.eclipse.core.runtime.IPath parentKey,
java.lang.String localName)
Creates a new child in the tree. |
abstract void |
createChild(org.eclipse.core.runtime.IPath parentKey,
java.lang.String localName,
java.lang.Object object)
Creates a new child in the tree. |
abstract void |
createSubtree(org.eclipse.core.runtime.IPath key,
AbstractDataTreeNode subtree)
Creates or replaces a subtree in the tree. |
abstract void |
deleteChild(org.eclipse.core.runtime.IPath parentKey,
java.lang.String localName)
Deletes a child from the tree. |
abstract void |
empty()
Initializes the receiver so that it is a complete, empty tree. |
org.eclipse.core.runtime.IPath |
getChild(org.eclipse.core.runtime.IPath parentKey,
int index)
Returns the key of a node in the tree. |
int |
getChildCount(org.eclipse.core.runtime.IPath parentKey)
Returns the number of children of a node |
org.eclipse.core.runtime.IPath[] |
getChildren(org.eclipse.core.runtime.IPath parentKey)
Returns the keys of all children of a node. |
abstract java.lang.Object |
getData(org.eclipse.core.runtime.IPath key)
Returns the data of a node. |
java.lang.String |
getNameOfChild(org.eclipse.core.runtime.IPath parentKey,
int index)
Returns the local name of a node in the tree |
abstract java.lang.String[] |
getNamesOfChildren(org.eclipse.core.runtime.IPath parentKey)
Returns the local names for the children of a node |
void |
immutable()
Makes the tree immutable |
abstract boolean |
includes(org.eclipse.core.runtime.IPath key)
Returns true if the receiver includes a node with the given key, false otherwise. |
boolean |
isImmutable()
Returns true if the tree is immutable, and false otherwise. |
abstract DataTreeLookup |
lookup(org.eclipse.core.runtime.IPath key)
Returns an object containing: - a flag indicating whether the specified node was found - the data for the node, if it was found |
org.eclipse.core.runtime.IPath |
rootKey()
Returns the key of the root node. |
abstract void |
setData(org.eclipse.core.runtime.IPath key,
java.lang.Object data)
Sets the data of a node. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractDataTree()
Method Detail |
---|
public abstract AbstractDataTreeNode copyCompleteSubtree(org.eclipse.core.runtime.IPath key)
public abstract void createChild(org.eclipse.core.runtime.IPath parentKey, java.lang.String localName)
parentKey
- key of parent for new child.localName
- name for new child.
ObjectNotFoundException
- parentKey does not exist in the receiver
java.lang.RuntimeException
- receiver is immutablepublic abstract void createChild(org.eclipse.core.runtime.IPath parentKey, java.lang.String localName, java.lang.Object object)
parentKey
- key of parent for new child.localName
- name for new child.object
- the data for the new child
ObjectNotFoundException
- parentKey does not exist in the receiver
java.lang.RuntimeException
- receiver is immutablepublic abstract void createSubtree(org.eclipse.core.runtime.IPath key, AbstractDataTreeNode subtree)
key
- key of parent of subtree to create/replacesubtree
- new subtree to add to tree
java.lang.RuntimeException
- receiver is immutablepublic abstract void deleteChild(org.eclipse.core.runtime.IPath parentKey, java.lang.String localName)
Note: this method requires both parentKey and localName, making it impossible to delete the root node.
parentKey
- parent of node to delete.localName
- name of node to delete.
ObjectNotFoundException
- a child of parentKey with name localName does not exist in the receiver
java.lang.RuntimeException
- receiver is immutablepublic abstract void empty()
public org.eclipse.core.runtime.IPath getChild(org.eclipse.core.runtime.IPath parentKey, int index)
parentKey
- parent of child to retrieve.index
- index of the child to retrieve in its parent.
ObjectNotFoundException
- parentKey does not exist in the receiver
java.lang.ArrayIndexOutOfBoundsException
- if no child with the given index (runtime exception)public int getChildCount(org.eclipse.core.runtime.IPath parentKey)
parentKey
- key of the node for which we want to retreive the number of children
ObjectNotFoundException
- parentKey does not exist in the receiverpublic org.eclipse.core.runtime.IPath[] getChildren(org.eclipse.core.runtime.IPath parentKey)
parentKey
- key of parent whose children we want to retrieve.
ObjectNotFoundException
- parentKey does not exist in the receiverpublic abstract java.lang.Object getData(org.eclipse.core.runtime.IPath key)
key
- key of node for which we want to retrieve data.
ObjectNotFoundException
- key does not exist in the receiverpublic java.lang.String getNameOfChild(org.eclipse.core.runtime.IPath parentKey, int index)
parentKey
- parent of node whose name we want to retrieveindex
- index of node in its parent
ObjectNotFoundException
- parentKey does not exist in the receiver
java.lang.ArrayIndexOutOfBoundsException
- if no child with the given indexpublic abstract java.lang.String[] getNamesOfChildren(org.eclipse.core.runtime.IPath parentKey)
parentKey
- key of node whose children we want to retrieve
ObjectNotFoundException
- parentKey does not exist in the receiverpublic void immutable()
public abstract boolean includes(org.eclipse.core.runtime.IPath key)
key
- key of node to findpublic boolean isImmutable()
public abstract DataTreeLookup lookup(org.eclipse.core.runtime.IPath key)
key
- key of node for which we want to retrieve data.public org.eclipse.core.runtime.IPath rootKey()
public abstract void setData(org.eclipse.core.runtime.IPath key, java.lang.Object data)
key
- key of node for which to set datadata
- new data value for node
ObjectNotFoundException
- the nodeKey does not exist in the receiver
java.lang.IllegalArgumentException
- receiver is immutable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |