net.sf.jga.fn
Interface Visitor
- All Known Subinterfaces:
- Accumulate.Visitor, All.Visitor, AndBinary.Visitor, AndGenerator.Visitor, AndUnary.Visitor, Any.Visitor, ApplyBinary.Visitor, ApplyGenerator.Visitor, ApplyUnary.Visitor, ArrayBinary.Visitor, ArrayUnary.Visitor, Average.Visitor, Between.Visitor, BinaryNegate.Visitor, Bind.Visitor, Bind1st.Visitor, Bind2nd.Visitor, BindNth.Visitor, BitwiseAnd.Visitor, BitwiseNot.Visitor, BitwiseOr.Visitor, BitwiseXor.Visitor, Cast.Visitor, ChainBinary.Visitor, ChainFunctor.Visitor, ChainUnary.Visitor, ComparatorFn.Visitor, CompareProperty.Visitor, ComposeBinary.Visitor, ComposeBinaryNth.Visitor, ComposeUnary.Visitor, ComposeUnaryNth.Visitor, Compound.Visitor, CompoundBinary.Visitor, CompoundGenerator.Visitor, CompoundUnary.Visitor, ConditionalBinary.Visitor, ConditionalGenerator.Visitor, ConditionalUnary.Visitor, Constant.Visitor, ConstantBinary.Visitor, ConstantUnary.Visitor, Construct.Visitor, ConstructDefault.Visitor, ConstructUnary.Visitor, Count.Visitor, DefaultFormat.Visitor, Distribute.Visitor, Divides.Visitor, ElementOf.Visitor, EqualEqual.Visitor, EqualTo.Visitor, ForEach.Visitor, FormatValue.Visitor, Generate.Visitor, Generate1st.Visitor, Generate2nd.Visitor, GenerateBinary.Visitor, GenerateNth.Visitor, GenerateUnary.Visitor, GetField.Visitor, GetProperty.Visitor, Greater.Visitor, GreaterEqual.Visitor, Identity.AccessorVisitor, Identity.Visitor, InstanceOf.Visitor, Invoke.Visitor, InvokeMethod.Visitor, InvokeNoArgMethod.Visitor, Less.Visitor, LessEqual.Visitor, LogicalAnd.Visitor, LogicalNot.Visitor, LogicalOr.Visitor, Match.Visitor, Max.Visitor, MaxValue.Visitor, Min.Visitor, Minus.Visitor, MinValue.Visitor, Modulus.Visitor, Multiplies.Visitor, Negate.Visitor, NotEqualEqual.Visitor, NotEqualTo.Visitor, OrBinary.Visitor, OrGenerator.Visitor, OrUnary.Visitor, ParseFormat.Visitor, Plus.Visitor, Project1st.Visitor, Project2nd.Visitor, Random.Visitor, SetField.Visitor, SetProperty.Visitor, ShiftLeft.Visitor, ShiftRight.Visitor, UnaryNegate.Visitor, UnsignedShiftRight.Visitor, ValueOf.Visitor
- All Known Implementing Classes:
- AbstractVisitor, AdaptorVisitor
public interface Visitor
Defines an interface for classes that may interpret functors or predicates.
jga uses the AcyclicVisitor
pattern to provide a structure for implementing Visitor. Within jga, each
class that implements Visitable does so with the following boilerplate:
public class Foo implements Visitable
public void accept(net.sf.jga.fn.Visitor v) {
if (v instanceof Foo.Visitor)
((Foo.Visitor)v).visit(this);
else
v.visit(this);
}
public interface Visitor extends net.sf.jga.fn.Visitor {
public void visit(Foo host);
}
Implementations of Visitor will declare suport for a given class by
implementing that class' Visitor interface.
public class FooBarCounter implements Foo.Visitor, Bar.Visitor {
private int count = 0;
public int getCount() { return count; }
public void visit(Visitable host) {}
public void visit(Foo host) { ++count; }
public void visit(Bar host) { ++count; }
}
Copyright © 2002-2005 David A. Hall
- Author:
- David A. Hall
Method Summary |
void |
visit(Visitable visitable)
Call-back method, called by the Visitable object in response to a
call to its accept(Visitor) method. |
visit
void visit(Visitable visitable)
- Call-back method, called by the Visitable object in response to a
call to its
accept(Visitor)
method.
Copyright © 2002-2006 David A. Hall. All Rights Reserved.