dk.rode.thesis.visitor
Class IntegerValuedVisitableSequence
java.lang.Object
dk.rode.thesis.decorator.SequenceDecorator<E>
dk.rode.thesis.visitor.AbstractVisitableSequence<Integer>
dk.rode.thesis.visitor.IntegerValuedVisitableSequence
- All Implemented Interfaces:
- Sequence<Integer>, Copyable<Sequence<Integer>>, StrictCopyable<Sequence<Integer>>, Stringable<Sequence<Integer>>, TypeVisitableSequence<Integer>, ValueVisitableSequence<Integer>
@Participant(value="ConcreteElement")
public class IntegerValuedVisitableSequence
- extends AbstractVisitableSequence<Integer>
An integer valued visitable sequence allows any
sequence
delivering Integer
values
to become value
visitable using the
SequenceValueVisitor.visitIntegerValued(Sequence, Object)
visitation method and is type
visitable for any known sub-interface of Sequence
that is implemented by the sequence.
Implementation notes:
Like StringValuedVisitableSequence
, this sequence type could
have declared a type parameter like <E extends Number>
to
allow this class to be utilised with any sub-class of Number
,
e.g. not only Integer
, but also Long
, Double
,
BigDecimal
, etc. But since type parameters are erased at
runtime, this class would have to call a single visitation method
like visitNumberValued(Sequence<? extends Number>, ..)
,
and the possibility to distinguish on a specific numeric value type
delivered by a sequence is lost (unless of cause one would be so careless
as to use the instanceof
operator on actual sequence values,
which is a really bad idea).
- Author:
- Gunni Rode / rode.dk
- See Also:
DateValuedVisitableSequence
,
StringValuedVisitableSequence
,
ReflectiveVisitableSequence
Methods inherited from class dk.rode.thesis.decorator.SequenceDecorator |
bounded, consistent, current, equals, getSequence, getStringablePolicy, hashCode, next, reset, state, toString, toString, unique |
IntegerValuedVisitableSequence
public IntegerValuedVisitableSequence(Sequence<Integer> sequence)
- Constructor.
- Parameters:
sequence
- The decorated sequence that will become visitable;
cannot be null.
- Throws:
NullPointerException
- If sequence
is null.
accept
public <P> void accept(SequenceValueVisitor<P> visitor,
P argument)
- Description copied from interface:
ValueVisitableSequence
- Visits this visitable sequence using the
value
visitor supplied
as visitor
.
- Type Parameters:
P
- The type of visitor-supplied argument. Use Void
for visitors that do not need an additional argument.- Parameters:
visitor
- The visitor; never null.argument
- A context supplied argument, if any.- See Also:
SequenceValueVisitor.visitIntegerValued(Sequence, Object)
copy
public IntegerValuedVisitableSequence copy()
- Returns a deep copy of this object.
The decorated sequence is not copied.
- Returns:
- The copy; never null.
Feel free to use and/or modify the Java 6 source code developed for this thesis AT YOUR OWN RISK, but note that the source code comes WITHOUT ANY — and I do mean WITHOUT ANY — form of warranty WHAT SO EVER!
The original thesis and source code are available at rode.dk/thesis.