org.mmbase.bridge.util
Class GrowingTreeList

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byjava.util.AbstractSequentialList
              extended byorg.mmbase.bridge.util.AbstractSequentialBridgeList
                  extended byorg.mmbase.bridge.util.TreeList
                      extended byorg.mmbase.bridge.util.GrowingTreeList
All Implemented Interfaces:
BridgeList, java.util.Collection, java.util.List, NodeList

public class GrowingTreeList
extends TreeList

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 these lists as if it was one list ordered as a Tree.

Since:
MMBase-1.7
Version:
$Id: GrowingTreeList.java,v 1.2.2.3 2004/07/29 17:19:42 michiel Exp $
Author:
Michiel Meeuwissen

Nested Class Summary
 
Nested classes inherited from class org.mmbase.bridge.util.TreeList
TreeList.TreeItr
 
Field Summary
protected  Constraint cleanConstraint
           
protected  int maxNumberOfSteps
           
protected  NodeQuery pathElementTemplate
           
 
Fields inherited from class org.mmbase.bridge.util.TreeList
cloud, foundEnd, numberOfSteps, queries, REAL_NODES, results, topQuery
 
Fields inherited from class java.util.AbstractList
modCount
 
Fields inherited from interface org.mmbase.bridge.NodeList
QUERY_PROPERTY
 
Constructor Summary
GrowingTreeList(NodeQuery q, int maxDepth)
           
GrowingTreeList(NodeQuery q, int maxDepth, NodeManager nodeManager, java.lang.String role, java.lang.String searchDir)
           
 
Method Summary
protected  void addPathElement()
           
protected  NodeList getList(int queryNumber)
          Executes one query if that did not happen yet, and stores the result in the 'results' List
 Query getTemplate()
          Returns the Query which is used as a template to 'grow' the query.
static void main(java.lang.String[] args)
           
 void setMaxDepth(int maxDepth)
          As long as the tree is not 'started' yet, max depth can still be changed.
 int size()
           
 
Methods inherited from class org.mmbase.bridge.util.TreeList
doTest, getNode, getQuery, getRealNode, grow, listIterator, nodeIterator, sizeCheck, subNodeList, toString, treeIterator
 
Methods inherited from class org.mmbase.bridge.util.AbstractSequentialBridgeList
getProperty, setProperty, sort, sort
 
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 org.mmbase.bridge.BridgeList
getProperty, setProperty, sort, sort
 
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
 

Field Detail

cleanConstraint

protected Constraint cleanConstraint

pathElementTemplate

protected NodeQuery pathElementTemplate

maxNumberOfSteps

protected int maxNumberOfSteps
Constructor Detail

GrowingTreeList

public GrowingTreeList(NodeQuery q,
                       int maxDepth,
                       NodeManager nodeManager,
                       java.lang.String role,
                       java.lang.String searchDir)
Parameters:
q - The 'base' query defining the minimal depth of the tree elements
maxDepth - You must supply a maximal depth of the nodes, because MMBase is basicly a network rather then a tree, so tree representations could be infinitely deep.
role -
searchDir -
Since:
MMBase-1.7.1

GrowingTreeList

public GrowingTreeList(NodeQuery q,
                       int maxDepth)
Method Detail

setMaxDepth

public void setMaxDepth(int maxDepth)
As long as the tree is not 'started' yet, max depth can still be changed.

Since:
MMBase-1.7.1

getTemplate

public Query getTemplate()
Returns the Query which is used as a template to 'grow' the query. You can change it, add sort-orders and add constraints before the tree is 'started'. All but the first step of this query are added. This query itself is never used.

Since:
MMBase-1.7.1

size

public int size()
Specified by:
size in interface java.util.List
Overrides:
size in class TreeList

getList

protected NodeList getList(int queryNumber)
Description copied from class: TreeList
Executes one query if that did not happen yet, and stores the result in the 'results' List

Overrides:
getList in class TreeList
Returns:
NodeList or null if queryNumber too big

addPathElement

protected void addPathElement()

main

public static void main(java.lang.String[] args)


MMBase build 1.7.1.20041002