Package org.camunda.bpm.engine.impl.tree
Class ReferenceWalker<T>
- java.lang.Object
-
- org.camunda.bpm.engine.impl.tree.ReferenceWalker<T>
-
- Direct Known Subclasses:
ActivityInstanceWalker
,CompensationEventSubscriptionWalker
,ExecutionTopDownWalker
,MigratingProcessElementInstanceTopDownWalker
,SingleReferenceWalker
public abstract class ReferenceWalker<T> extends Object
A walker for walking through an object reference structure (e.g. an execution tree). Any visited element can have any number of following elements. The elements are visited with a breadth-first approach: The walker maintains a list of next elements to which it adds a new elements at the end whenever it has visited an element. The walker stops when it encounters an element that fulfills the given
ReferenceWalker.WalkCondition
.Subclasses define the type of objects and provide the walking behavior.
- Author:
- Thorben Lindhauer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ReferenceWalker.NullCondition<S>
static interface
ReferenceWalker.WalkCondition<S>
-
Field Summary
Fields Modifier and Type Field Description protected List<T>
currentElements
protected List<TreeVisitor<T>>
postVisitor
protected List<TreeVisitor<T>>
preVisitor
-
Constructor Summary
Constructors Constructor Description ReferenceWalker(List<T> initialElements)
ReferenceWalker(T initialElement)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ReferenceWalker<T>
addPostVisitor(TreeVisitor<T> collector)
ReferenceWalker<T>
addPreVisitor(TreeVisitor<T> collector)
T
getCurrentElement()
protected abstract Collection<T>
nextElements()
T
walkUntil()
T
walkUntil(ReferenceWalker.WalkCondition<T> condition)
T
walkWhile()
T
walkWhile(ReferenceWalker.WalkCondition<T> condition)
-
-
-
Field Detail
-
preVisitor
protected List<TreeVisitor<T>> preVisitor
-
postVisitor
protected List<TreeVisitor<T>> postVisitor
-
-
Method Detail
-
nextElements
protected abstract Collection<T> nextElements()
-
addPreVisitor
public ReferenceWalker<T> addPreVisitor(TreeVisitor<T> collector)
-
addPostVisitor
public ReferenceWalker<T> addPostVisitor(TreeVisitor<T> collector)
-
walkWhile
public T walkWhile()
-
walkUntil
public T walkUntil()
-
walkWhile
public T walkWhile(ReferenceWalker.WalkCondition<T> condition)
-
walkUntil
public T walkUntil(ReferenceWalker.WalkCondition<T> condition)
-
getCurrentElement
public T getCurrentElement()
-
-