org.mmbase.bridge.util
Class GrowingTreeList
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.AbstractSequentialList<E>
org.mmbase.bridge.util.AbstractSequentialBridgeList<Node>
org.mmbase.bridge.util.TreeList
org.mmbase.bridge.util.GrowingTreeList
- All Implemented Interfaces:
- Iterable<Node>, Collection<Node>, List<Node>, BridgeList<Node>, NodeList
public class GrowingTreeList
- extends TreeList
This version of TreeList is automaticly growing with the same 'branch' every time when that is possible. For that
it needs a kind of template query for every branch, which is defined by the constructor.
- Since:
- MMBase-1.7
- Version:
- $Id: GrowingTreeList.java 41991 2010-04-20 16:48:55Z michiel $
- Author:
- Michiel Meeuwissen
|
Method Summary |
protected void |
addPathElement()
Grows the branches of the tree, with the leave. |
protected NodeList |
getLeafList(int queryNumber)
Executes one query as a 'leaf' query. |
NodeQuery |
getLeafTemplate()
The leave template is the 'last' template. |
protected NodeList |
getList(int queryNumber)
Executes one query if that did not happen yet, and stores the result in the 'results' List |
NodeQuery |
getTemplate()
Returns the Query which is used as a template for the leaves to 'grow' the query. |
static void |
main(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, getCloud, getLeafQuery, getMax, getNode, getQuery, getRealNode, grow, listIterator, nodeIterator, setLeafConstraint, setMax, sizeCheck, subList, subNodeList, toString, treeIterator, treeIterator |
| 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, toArray, toArray |
cleanConstraint
protected Constraint cleanConstraint
pathElementTemplate
protected NodeQuery pathElementTemplate
cleanLeafConstraint
protected Constraint cleanLeafConstraint
leafElementTemplate
protected NodeQuery leafElementTemplate
maxNumberOfSteps
protected int maxNumberOfSteps
GrowingTreeList
public GrowingTreeList(NodeQuery q,
int maxDepth,
NodeManager nodeManager,
String role,
String searchDir)
- Parameters:
q - The 'base' query defining the minimal depth of the tree elements. The trunk of the tree.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.nodeManager - Destination Nodemanager in the treerole - Role of the relations in the treesearchDir - Direction of the relations in the tree- Since:
- MMBase-1.7.1
GrowingTreeList
public GrowingTreeList(NodeQuery q,
int maxDepth)
- This may be used in combination with
Queries.addPath(tree.getTemplate(), (String) path.getValue(this), (String) searchDirs.getValue(this));
So you add a template constisting of a bunch of elements.
GrowingTreeList
public GrowingTreeList(TreeList tl,
int maxDepth)
setMaxDepth
public void setMaxDepth(int maxDepth)
- As long as the tree is not 'started' yet, max depth can still be changed.
- Parameters:
maxDepth - max number of Steps- Since:
- MMBase-1.7.1
getTemplate
public NodeQuery getTemplate()
- Returns the Query which is used as a template for the leaves 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 executed, though marked used, to avoid changes on
it after the list has started.
- Returns:
- Query which is used as a template
- Since:
- MMBase-1.7.1
getLeafTemplate
public NodeQuery getLeafTemplate()
- The leave template is the 'last' template. This is the same as getTemplate, only, the
constraints set on this, are only used if the template is used 'on the end'.
It boils down to the fact that constraints set on the query don't change the tree itself, but
only constraint the 'leaves', so it makes for a kind of tree-search.
- Since:
- MMBase-1.8
size
public int size()
- Specified by:
size in interface Collection<Node>- Specified by:
size in interface List<Node>- 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
getLeafList
protected NodeList getLeafList(int queryNumber)
- Description copied from class:
TreeList
- Executes one query as a 'leaf' query.
- Overrides:
getLeafList in class TreeList
addPathElement
protected void addPathElement()
- Grows the branches of the tree, with the leave.
main
public static void main(String[] args)
MMBase 2.0-SNAPSHOT - null