org.eigenbase.util
Class ReflectVisitorTest.NumberNegater
java.lang.Object
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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
result
protected Number result
dispatcher
private final ReflectiveVisitDispatcher<ReflectVisitorTest.NumberNegater,Number> dispatcher
ReflectVisitorTest.NumberNegater
public ReflectVisitorTest.NumberNegater()
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