Evaluating Software Design Patterns
— the "Gang of Four" patterns implemented in Java 6

Class IntegerValuedVisitableSequence

  extended by dk.rode.thesis.decorator.SequenceDecorator<E>
      extended by dk.rode.thesis.visitor.AbstractVisitableSequence<Integer>
          extended by dk.rode.thesis.visitor.IntegerValuedVisitableSequence
All Implemented Interfaces:
Sequence<Integer>, Copyable<Sequence<Integer>>, StrictCopyable<Sequence<Integer>>, Stringable<Sequence<Integer>>, TypeVisitableSequence<Integer>, ValueVisitableSequence<Integer>

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).

Gunni Rode / rode.dk
See Also:
DateValuedVisitableSequence, StringValuedVisitableSequence, ReflectiveVisitableSequence

Nested Class Summary
Nested classes/interfaces inherited from interface dk.rode.thesis.meta.model.Sequence
Constructor Summary
IntegerValuedVisitableSequence(Sequence<Integer> sequence)
Method Summary
<P> void
accept(SequenceValueVisitor<P> visitor, P argument)
          Visits this visitable sequence using the value visitor supplied as visitor.
 IntegerValuedVisitableSequence copy()
          Returns a deep copy of this object.
Methods inherited from class dk.rode.thesis.visitor.AbstractVisitableSequence
Methods inherited from class dk.rode.thesis.decorator.SequenceDecorator
bounded, consistent, current, equals, getSequence, getStringablePolicy, hashCode, next, reset, state, toString, toString, unique
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface dk.rode.thesis.meta.model.Sequence
bounded, consistent, current, next, reset, state, unique
Methods inherited from interface dk.rode.thesis.strategy.Stringable
getStringablePolicy, toString

Constructor Detail


public IntegerValuedVisitableSequence(Sequence<Integer> sequence)

sequence - The decorated sequence that will become visitable; cannot be null.
NullPointerException - If sequence is null.
Method Detail


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.
visitor - The visitor; never null.
argument - A context supplied argument, if any.
See Also:
SequenceValueVisitor.visitIntegerValued(Sequence, Object)


public IntegerValuedVisitableSequence copy()
Returns a deep copy of this object. The decorated sequence is not copied.

The copy; never null.

Gunni Rode / rode.dk

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.