|
qflib 0.98.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.qfs.lib.tree.IndexBasedTreeAdapter
This abstract base class for an index based TreeAdapter implements the link and enumeration based methods in terms of the index based ones, so it leaves only the bare minimum to be implemented.
Inner Class Summary | |
protected class |
IndexBasedTreeAdapter.ChildEnumeration
Helper class that enumerates the children of a node. |
Constructor Summary | |
IndexBasedTreeAdapter()
|
Method Summary | |
java.util.Enumeration |
getChildren(java.lang.Object parent)
Get an Enumeration for the children of a node. |
java.lang.Object |
getFirstChildNode(java.lang.Object parent)
Get the first child of a node. |
java.lang.Object |
getLastChildNode(java.lang.Object parent)
Get the last child of a node. |
java.lang.Object |
getNextSibling(java.lang.Object node)
Get the next sibling of a node. |
java.lang.Object |
getPreviousSibling(java.lang.Object node)
Get the previous sibling of a node. |
boolean |
isEnumerationBased()
Query whether the TreeAdapter implementation supports enumeration based child access efficiently. |
boolean |
isIndexBased()
Query whether the TreeAdapter implementation supports index based child access efficiently. |
boolean |
isLinkBased()
Query whether the TreeAdapter implementation supports link based child access efficiently. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface de.qfs.lib.tree.TreeAdapter |
getChildCount, getChildNode, getIndexOfChildNode, getParentNode, isLeaf |
Constructor Detail |
public IndexBasedTreeAdapter()
Method Detail |
public boolean isIndexBased()
If the list of children of a node is implemented as a linked list for
example, index based access is very inefficient, while an array based
implementation should retrun true. The index based methods getChildCount
, getChildNode
and
getIndexOfChildNode
have to be implemented
in any case.
isIndexBased
in interface TreeAdapter
public boolean isLinkBased()
If the list of children of a node is implemented as a linked list for
example, link based access is very efficient, while an array based
implementation should retrun false. The link based methods getFirstChildNode
, getLastChildNode
, getNextSibling
and getPreviousSibling
have to be implemented in any
case.
isLinkBased
in interface TreeAdapter
public java.lang.Object getFirstChildNode(java.lang.Object parent)
getFirstChildNode
in interface TreeAdapter
parent
- The node whose child to get.public java.lang.Object getLastChildNode(java.lang.Object parent)
getLastChildNode
in interface TreeAdapter
parent
- The node whose child to get.public java.lang.Object getPreviousSibling(java.lang.Object node)
getPreviousSibling
in interface TreeAdapter
node
- The node whose sibling to get.public java.lang.Object getNextSibling(java.lang.Object node)
getNextSibling
in interface TreeAdapter
node
- The node whose sibling to get.public boolean isEnumerationBased()
This method should return true only if Enumeration based child access if more efficient than index or linked based access.
isEnumerationBased
in interface TreeAdapter
public java.util.Enumeration getChildren(java.lang.Object parent)
isEnumerationBased
returns true.getChildren
in interface TreeAdapter
parent
- The node whose children to get.
|
qflib 0.98.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |