codec.dyntree
Class DynTree
java.lang.Object
|
+--codec.dyntree.DynTree
- public final class DynTree
- extends java.lang.Object
Class acting as a structural backbone for DynDependencyManager.
It may contain one or several tree hierarchies.
Method Summary |
private void |
addLeaf(java.lang.Object leaf,
java.util.Vector leaves)
Add leaf to the current vector of leaves. |
void |
addRelation(java.lang.Object parent,
java.lang.Object child,
int relationType)
|
ParentChildPair[] |
getLeaves()
Collect all tree items that do not have children. |
private java.util.Map.Entry |
getParent(java.lang.Object child)
Get the parent of a child. |
boolean |
isEmpty()
Check whether the tree contains any elements. |
void |
removeLeaves(ParentChildPair[] leaves)
Remove all leaves collected by getLeaves(). |
Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
toString,
wait,
wait,
wait |
relations
private java.util.Map relations
RELATION_TYPE_CONTENT
public static final int RELATION_TYPE_CONTENT
RELATION_TYPE_CONTAINER
public static final int RELATION_TYPE_CONTAINER
DynTree
public DynTree()
addRelation
public void addRelation(java.lang.Object parent,
java.lang.Object child,
int relationType)
isEmpty
public boolean isEmpty()
- Check whether the tree contains any elements.
getParent
private java.util.Map.Entry getParent(java.lang.Object child)
- Get the parent of a child. Actual content of parent can be
accessed by calling getKey() method of the returned object.
- Returns:
null
in case no parent exists (child
is a root node of a tree).
addLeaf
private void addLeaf(java.lang.Object leaf,
java.util.Vector leaves)
- Add leaf to the current vector of leaves.
getLeaves
public ParentChildPair[] getLeaves()
- Collect all tree items that do not have children. Actual content of a
leaf is set in "child" field of "ParentChildPair". Root leaves will
set "parent" field in "ParentChildPair" to null, otherwise it refers
to existing parent. "Type" field indicates type of relation.
- Returns:
null
in case no leaves have been found. In case
of erroneous situation when tree contains cycles, this does not mean
that the tree is empty. This can be checked by calling isEmpty().
removeLeaves
public void removeLeaves(ParentChildPair[] leaves)
- Remove all leaves collected by getLeaves(). In case references in
"leaves" have been modified, behaviour of method is undefined.
However, user may freely modify the contents of the objects to which
"leaves[i].parent" and "leaves[i].child" point to.