org.eigenbase.util
Class ReflectVisitorTest.NumberNegater

java.lang.Object
  extended by org.eigenbase.util.ReflectVisitorTest.NumberNegater
All Implemented Interfaces:
ReflectiveVisitor
Direct Known Subclasses:
ReflectVisitorTest.CarelessNumberNegater, ReflectVisitorTest.CluelessNumberNegater, ReflectVisitorTest.IndecisiveNumberNegater, ReflectVisitorTest.SomewhatIndecisiveNumberNegater
Enclosing class:
ReflectVisitorTest

public abstract class ReflectVisitorTest.NumberNegater
extends Object
implements ReflectiveVisitor

NumberNegater defines the abstract base for a computation object capable of negating an arbitrary number. Subclasses implement the computation by publishing methods with the signature "void visit(X x)" where X is a subclass of Number.


Field Summary
private  ReflectiveVisitDispatcher<ReflectVisitorTest.NumberNegater,Number> dispatcher
           
protected  Number result
           
 
Constructor Summary
ReflectVisitorTest.NumberNegater()
           
 
Method Summary
 Number negate(Number n)
          Negates the given number.
 Number negateWithoutDispatcher(Number n)
          Negates the given number without using a dispatcher object to cache applicable methods.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

result

protected Number result

dispatcher

private final ReflectiveVisitDispatcher<ReflectVisitorTest.NumberNegater,Number> dispatcher
Constructor Detail

ReflectVisitorTest.NumberNegater

public ReflectVisitorTest.NumberNegater()
Method Detail

negate

public Number negate(Number n)
Negates the given number.

Parameters:
n - the number to be negated
Returns:
the negated result; not guaranteed to be the same concrete type as n; null is returned if n's type wasn't handled

negateWithoutDispatcher

public Number negateWithoutDispatcher(Number n)
Negates the given number without using a dispatcher object to cache applicable methods. The results should be the same as negate(Number).

Parameters:
n - the number to be negated
Returns:
the negated result; not guaranteed to be the same concrete type as n; null is returned if n's type wasn't handled