org.mmbase.bridge.util
Class TreeList
java.lang.Object
java.util.AbstractCollection
java.util.AbstractList
java.util.AbstractSequentialList
org.mmbase.bridge.util.AbstractSequentialBridgeList
org.mmbase.bridge.util.TreeList
- All Implemented Interfaces:
- BridgeList, java.util.Collection, java.util.List, NodeList
- Direct Known Subclasses:
- GrowingTreeList
- public class TreeList
- extends AbstractSequentialBridgeList
- implements NodeList
Queries a Tree from MMBase. A Tree is presented as a List of MultiLevel results (ClusterNodes),
combined with a smart iterator which iterates through the elements of these lists as if it was one
list ordered as a Tree.
- Since:
- MMBase-1.7
- Version:
- $Id: TreeList.java,v 1.7.2.3 2004/07/29 17:19:43 michiel Exp $
- Author:
- Michiel Meeuwissen
| Fields inherited from class java.util.AbstractList |
modCount |
|
Method Summary |
static void |
doTest(java.io.Writer writer,
NodeQuery q)
|
protected NodeList |
getList(int queryNumber)
Executes one query if that did not happen yet, and stores the result in the 'results' List |
Node |
getNode(int i)
Returns the Node at the indicated postion in the list |
protected static NodeQuery |
getQuery(java.lang.String[] args)
For testing only. |
protected Node |
getRealNode(int queryIndex,
int index)
Returns node 'index' of query result 'queryIndex' as a 'real' node (so not a cluster node) |
RelationStep |
grow(NodeManager nodeManager,
java.lang.String role,
java.lang.String searchDir)
Grows branches of the Tree, which means that one new query will be created which is one
relationStep longer than the longest one until now. |
java.util.ListIterator |
listIterator(int ind)
|
static void |
main(java.lang.String[] args)
|
NodeIterator |
nodeIterator()
Returns an type-specific iterator for this list. |
int |
size()
|
protected void |
sizeCheck()
|
NodeList |
subNodeList(int start,
int end)
Returns a sublist of this list. |
java.lang.String |
toString()
|
TreeIterator |
treeIterator()
|
| Methods inherited from class java.util.AbstractSequentialList |
add, addAll, get, iterator, remove, set |
| Methods inherited from class java.util.AbstractList |
add, clear, equals, hashCode, indexOf, lastIndexOf, listIterator, removeRange, subList |
| Methods inherited from class java.util.AbstractCollection |
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.List |
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, remove, remove, removeAll, retainAll, set, subList, toArray, toArray |
REAL_NODES
public static final java.lang.String REAL_NODES
- See Also:
- Constant Field Values
cloud
protected Cloud cloud
queries
protected final java.util.List queries
results
protected final java.util.List results
topQuery
protected int topQuery
numberOfSteps
protected int numberOfSteps
foundEnd
protected boolean foundEnd
TreeList
public TreeList(NodeQuery q)
- Parameters:
q - The 'base' query defining the minimal depth of the tree elements
size
public int size()
- Specified by:
size in interface java.util.List
sizeCheck
protected void sizeCheck()
- Since:
- MMBase-1.7.1
grow
public RelationStep grow(NodeManager nodeManager,
java.lang.String role,
java.lang.String searchDir)
- Grows branches of the Tree, which means that one new query will be created which is one
relationStep longer than the longest one until now.
This new relationStep is returned, which can be used to create new constraints.
- Returns:
- null if no relationstep is added because that would not increase the number of results.
getList
protected NodeList getList(int queryNumber)
- Executes one query if that did not happen yet, and stores the result in the 'results' List
- Returns:
- NodeList or null if queryNumber too big
- Throws:
java.lang.IndexOutOfBoundsException - if queryNumber < 0
listIterator
public java.util.ListIterator listIterator(int ind)
- Specified by:
listIterator in interface java.util.List
nodeIterator
public NodeIterator nodeIterator()
- Description copied from interface:
NodeList
- Returns an type-specific iterator for this list.
- Specified by:
nodeIterator in interface NodeList
treeIterator
public TreeIterator treeIterator()
getNode
public Node getNode(int i)
- Description copied from interface:
NodeList
- Returns the Node at the indicated postion in the list
- Specified by:
getNode in interface NodeList
- Parameters:
i - the position of the Node to retrieve
getRealNode
protected Node getRealNode(int queryIndex,
int index)
- Returns node 'index' of query result 'queryIndex' as a 'real' node (so not a cluster node)
subNodeList
public NodeList subNodeList(int start,
int end)
- Description copied from interface:
NodeList
- Returns a sublist of this list.
- Specified by:
subNodeList in interface NodeList
- Parameters:
start - the position in the current list where the sublist starts (inclusive)end - the position in the current list where the sublist ends (exclusive)
toString
public java.lang.String toString()
getQuery
protected static NodeQuery getQuery(java.lang.String[] args)
- For testing only. Based on RMMCI,
please use the System property to specify de cloud context
-Dmmbase.defaultcloudcontext=rmi://localhost:1111/remotecontext
- Parameters:
args - the start node (in one argument)
doTest
public static void doTest(java.io.Writer writer,
NodeQuery q)
main
public static void main(java.lang.String[] args)
MMBase build 1.7.1.20041002