org.camunda.bpm.engine.impl.tree
Class ReferenceWalker<T>

java.lang.Object
  extended by org.camunda.bpm.engine.impl.tree.ReferenceWalker<T>
Direct Known Subclasses:
ActivityInstanceWalker, 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
static class ReferenceWalker.NullCondition<S>
           
static interface ReferenceWalker.WalkCondition<S>
           
 
Field Summary
protected  List<T> currentElements
           
protected  List<TreeVisitor<T>> postVisitor
           
protected  List<TreeVisitor<T>> preVisitor
           
 
Constructor Summary
ReferenceWalker(T initialElement)
           
 
Method Summary
 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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentElements

protected List<T> currentElements

preVisitor

protected List<TreeVisitor<T>> preVisitor

postVisitor

protected List<TreeVisitor<T>> postVisitor
Constructor Detail

ReferenceWalker

public ReferenceWalker(T initialElement)
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()


Copyright © 2016 camunda services GmbH. All rights reserved.