|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.marsching.flexiparse.objecttree.DefaultMutableObjectTreeElement
public class DefaultMutableObjectTreeElement
Default implementation of the MutableObjectTreeElement
interface. Uses LinkedHashSets to store children nodes
and attached objects.
| Constructor Summary | |
|---|---|
DefaultMutableObjectTreeElement(MutableObjectTreeElement parent)
Creates a new instance setting the parent property using the supplied argument. |
|
| Method Summary | ||
|---|---|---|
void |
addChild(MutableObjectTreeElement child)
Registers another node as a child node of this node. |
|
void |
addObject(Object object)
Attaches the given object to this node. |
|
Collection<? extends MutableObjectTreeElement> |
getChildren()
Returns all children of this node. |
|
Collection<Object> |
getObjects()
Returns objects attached directly to this node. |
|
|
getObjectsOfType(Class<? extends T> type)
Returns objects of specified type attached directly to this node. |
|
|
getObjectsOfTypeFromSubTree(Class<? extends T> type)
Returns objects attached to this node and all child nodes (recursively). |
|
|
getObjectsOfTypeFromTopTree(Class<? extends T> type)
Returns objects attached to this node and all parent nodes up to the root node of the tree. |
|
MutableObjectTreeElement |
getParent()
Returns the parent of this node. |
|
ObjectTreeElement |
getRoot()
Returns the root node of the tree this node belongs to. |
|
boolean |
removeChild(MutableObjectTreeElement child)
Removes the specified child from this node. |
|
boolean |
removeObject(Object object)
Removes a object from this node. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultMutableObjectTreeElement(MutableObjectTreeElement parent)
parent - object representing the parent node of this node
or null to create a root node| Method Detail |
|---|
public void addChild(MutableObjectTreeElement child)
MutableObjectTreeElement
addChild in interface MutableObjectTreeElementchild - node to be attached as a child.public boolean removeChild(MutableObjectTreeElement child)
MutableObjectTreeElement
removeChild in interface MutableObjectTreeElementchild - node to remove
true if child was attached to this
node, false otherwisepublic void addObject(Object object)
ObjectTreeElement
addObject in interface ObjectTreeElementobject - object to attachpublic Collection<? extends MutableObjectTreeElement> getChildren()
MutableObjectTreeElement
getChildren in interface MutableObjectTreeElementgetChildren in interface ObjectTreeElementpublic Collection<Object> getObjects()
ObjectTreeElement
getObjects in interface ObjectTreeElementpublic <T> Collection<T> getObjectsOfType(Class<? extends T> type)
ObjectTreeElement
getObjectsOfType in interface ObjectTreeElementT - type of wanted objectstype - object type that is returned
public <T> Collection<T> getObjectsOfTypeFromTopTree(Class<? extends T> type)
ObjectTreeElement
getObjectsOfTypeFromTopTree in interface ObjectTreeElementT - type of wanted objectstype - object type that is returned
public MutableObjectTreeElement getParent()
MutableObjectTreeElement
getParent in interface MutableObjectTreeElementgetParent in interface ObjectTreeElementnull if this is
the root nodepublic boolean removeObject(Object object)
ObjectTreeElement
removeObject in interface ObjectTreeElementobject - object to remove
true if the specified object
was removed from this node, false otherwisepublic <T> Collection<T> getObjectsOfTypeFromSubTree(Class<? extends T> type)
ObjectTreeElementSubObjectTree).
getObjectsOfTypeFromSubTree in interface ObjectTreeElementT - type of wanted objectstype - object type that is returned
public ObjectTreeElement getRoot()
MutableObjectTreeElement
getRoot in interface MutableObjectTreeElementgetRoot in interface ObjectTreeElement
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||