Package org.apache.flink.util
Interface Visitable<T extends Visitable<T>>
-
- All Known Implementing Classes:
AbstractUdfOperator
,BulkIterationBase
,BulkIterationBase.PartialSolutionPlaceHolder
,CoGroupOperatorBase
,CoGroupRawOperatorBase
,CrossOperatorBase
,DeltaIterationBase
,DeltaIterationBase.SolutionSetPlaceHolder
,DeltaIterationBase.WorksetPlaceHolder
,DualInputOperator
,FilterOperatorBase
,FlatMapOperatorBase
,GenericDataSinkBase
,GenericDataSourceBase
,GroupCombineOperatorBase
,GroupReduceOperatorBase
,InnerJoinOperatorBase
,JoinOperatorBase
,MapOperatorBase
,MapPartitionOperatorBase
,Operator
,OuterJoinOperatorBase
,PartitionOperatorBase
,Plan
,ReduceOperatorBase
,SingleInputOperator
,SortPartitionOperatorBase
,Union
@Internal public interface Visitable<T extends Visitable<T>>
This interface marks types as visitable during a traversal. The central method accept(...) contains the logic about how to invoke the suppliedVisitor
on the visitable object, and how to traverse further.This concept makes it easy to implement for example a depth-first traversal of a tree or DAG with different types of logic during the traversal. The accept(...) method calls the visitor and then send the visitor to its children (or predecessors). Using different types of visitors, different operations can be performed during the traversal, while writing the actual traversal code only once.
- See Also:
Visitor
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
accept(Visitor<T> visitor)
Contains the logic to invoke the visitor and continue the traversal.
-
-
-
Method Detail
-
accept
void accept(Visitor<T> visitor)
Contains the logic to invoke the visitor and continue the traversal. Typically invokes the pre-visit method of the visitor, then sends the visitor to the children (or predecessors) and then invokes the post-visit method.A typical code example is the following:
public void accept(Visitor<Operator> visitor) { boolean descend = visitor.preVisit(this); if (descend) { if (this.input != null) { this.input.accept(visitor); } visitor.postVisit(this); } }
- Parameters:
visitor
- The visitor to be called with this object as the parameter.- See Also:
Visitor.preVisit(Visitable)
,Visitor.postVisit(Visitable)
-
-