|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.marsching.flexiparse.objecttree.DefaultMutableObjectTreeElement
public class DefaultMutableObjectTreeElement
Default implementation of the MutableObjectTreeElement
interface. Uses LinkedHashSet
s 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 nodeMethod Detail |
---|
public void addChild(MutableObjectTreeElement child)
MutableObjectTreeElement
addChild
in interface MutableObjectTreeElement
child
- node to be attached as a child.public boolean removeChild(MutableObjectTreeElement child)
MutableObjectTreeElement
removeChild
in interface MutableObjectTreeElement
child
- node to remove
true
if child was attached to this
node, false
otherwisepublic void addObject(Object object)
ObjectTreeElement
addObject
in interface ObjectTreeElement
object
- object to attachpublic Collection<? extends MutableObjectTreeElement> getChildren()
MutableObjectTreeElement
getChildren
in interface MutableObjectTreeElement
getChildren
in interface ObjectTreeElement
public Collection<Object> getObjects()
ObjectTreeElement
getObjects
in interface ObjectTreeElement
public <T> Collection<T> getObjectsOfType(Class<? extends T> type)
ObjectTreeElement
getObjectsOfType
in interface ObjectTreeElement
T
- type of wanted objectstype
- object type that is returned
public <T> Collection<T> getObjectsOfTypeFromTopTree(Class<? extends T> type)
ObjectTreeElement
getObjectsOfTypeFromTopTree
in interface ObjectTreeElement
T
- type of wanted objectstype
- object type that is returned
public MutableObjectTreeElement getParent()
MutableObjectTreeElement
getParent
in interface MutableObjectTreeElement
getParent
in interface ObjectTreeElement
null
if this is
the root nodepublic boolean removeObject(Object object)
ObjectTreeElement
removeObject
in interface ObjectTreeElement
object
- object to remove
true
if the specified object
was removed from this node, false
otherwisepublic <T> Collection<T> getObjectsOfTypeFromSubTree(Class<? extends T> type)
ObjectTreeElement
SubObjectTree
).
getObjectsOfTypeFromSubTree
in interface ObjectTreeElement
T
- type of wanted objectstype
- object type that is returned
public ObjectTreeElement getRoot()
MutableObjectTreeElement
getRoot
in interface MutableObjectTreeElement
getRoot
in interface ObjectTreeElement
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |