org.eclipse.core.internal.dtree
Class DataTree

java.lang.Object
  extended by org.eclipse.core.internal.dtree.AbstractDataTree
      extended by org.eclipse.core.internal.dtree.DataTree

public class DataTree
extends AbstractDataTree

A DataTree represents the complete information of a source tree. The tree contains all information within its branches, and has no relation to any other source trees (no parent and no children).


Constructor Summary
DataTree()
          Creates a new empty tree
 
Method Summary
 AbstractDataTreeNode copyCompleteSubtree(org.eclipse.core.runtime.IPath key)
          Returns a copy of the node subtree rooted at the given key.
 void createChild(org.eclipse.core.runtime.IPath parentKey, java.lang.String localName)
          Creates a new child in the tree.
 void createChild(org.eclipse.core.runtime.IPath parentKey, java.lang.String localName, java.lang.Object data)
          Creates a new child in the tree.
 void createSubtree(org.eclipse.core.runtime.IPath key, AbstractDataTreeNode subtree)
          Creates or replaces a subtree in the tree.
 void deleteChild(org.eclipse.core.runtime.IPath parentKey, java.lang.String localName)
          Deletes a child of the tree.
 void empty()
          Initializes the receiver.
 DataTreeNode findNodeAt(org.eclipse.core.runtime.IPath key)
          Returns the specified node if it is present, otherwise returns null.
 java.lang.Object getData(org.eclipse.core.runtime.IPath key)
          Returns the data at the specified node.
 java.lang.String[] getNamesOfChildren(org.eclipse.core.runtime.IPath parentKey)
          Returns the names of the children of a node.
 boolean includes(org.eclipse.core.runtime.IPath key)
          Returns true if the receiver includes a node with the given key, false otherwise.
 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
 void setData(org.eclipse.core.runtime.IPath key, java.lang.Object data)
          Sets the data at the specified node.
 
Methods inherited from class org.eclipse.core.internal.dtree.AbstractDataTree
getChild, getChildCount, getChildren, getNameOfChild, immutable, isImmutable, rootKey
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataTree

public DataTree()
Creates a new empty tree

Method Detail

copyCompleteSubtree

public AbstractDataTreeNode copyCompleteSubtree(org.eclipse.core.runtime.IPath key)
Returns a copy of the node subtree rooted at the given key.

Specified by:
copyCompleteSubtree in class AbstractDataTree
Parameters:
key - Key of subtree to copy

createChild

public void createChild(org.eclipse.core.runtime.IPath parentKey,
                        java.lang.String localName)
Creates a new child in the tree.

Specified by:
createChild in class AbstractDataTree
Parameters:
parentKey - key of parent for new child.
localName - name for new child.
See Also:
AbstractDataTree.createChild(IPath, String)

createChild

public void createChild(org.eclipse.core.runtime.IPath parentKey,
                        java.lang.String localName,
                        java.lang.Object data)
Creates a new child in the tree.

Specified by:
createChild in class AbstractDataTree
Parameters:
parentKey - key of parent for new child.
localName - name for new child.
data - the data for the new child
See Also:
AbstractDataTree.createChild(IPath, String, Object)

createSubtree

public void createSubtree(org.eclipse.core.runtime.IPath key,
                          AbstractDataTreeNode subtree)
Creates or replaces a subtree in the tree. The parent node must exist.

Specified by:
createSubtree in class AbstractDataTree
Parameters:
key - Key of parent node whose subtree we want to create/replace.
subtree - New node to insert into tree.

deleteChild

public void deleteChild(org.eclipse.core.runtime.IPath parentKey,
                        java.lang.String localName)
Deletes a child of the tree.

Specified by:
deleteChild in class AbstractDataTree
Parameters:
parentKey - parent of node to delete.
localName - name of node to delete.
See Also:
AbstractDataTree.deleteChild(IPath, String)

empty

public void empty()
Initializes the receiver.

Specified by:
empty in class AbstractDataTree
See Also:
AbstractDataTree.empty()

findNodeAt

public DataTreeNode findNodeAt(org.eclipse.core.runtime.IPath key)
Returns the specified node if it is present, otherwise returns null.

Parameters:
key - Key of node to return

getData

public java.lang.Object getData(org.eclipse.core.runtime.IPath key)
Returns the data at the specified node.

Specified by:
getData in class AbstractDataTree
Parameters:
key - Node whose data to return.

getNamesOfChildren

public java.lang.String[] getNamesOfChildren(org.eclipse.core.runtime.IPath parentKey)
Returns the names of the children of a node.

Specified by:
getNamesOfChildren in class AbstractDataTree
Parameters:
parentKey - key of node whose children we want to retrieve
See Also:
AbstractDataTree.getNamesOfChildren(IPath)

includes

public boolean includes(org.eclipse.core.runtime.IPath key)
Returns true if the receiver includes a node with the given key, false otherwise.

Specified by:
includes in class AbstractDataTree
Parameters:
key - key of node to find

lookup

public 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

Specified by:
lookup in class AbstractDataTree
Parameters:
key - key of node for which we want to retrieve data.

setData

public void setData(org.eclipse.core.runtime.IPath key,
                    java.lang.Object data)
Sets the data at the specified node.

Specified by:
setData in class AbstractDataTree
Parameters:
key - key of node for which to set data
data - new data value for node
See Also:
AbstractDataTree.setData(IPath, Object)