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

dk.rode.thesis.visitor
Class AbstractVisitableSequence<E>

java.lang.Object
  extended by dk.rode.thesis.decorator.SequenceDecorator<E>
      extended by dk.rode.thesis.visitor.AbstractVisitableSequence<E>
Type Parameters:
E - The type of values delivered by this visitable sequence.
All Implemented Interfaces:
Sequence<E>, Copyable<Sequence<E>>, StrictCopyable<Sequence<E>>, Stringable<Sequence<E>>, TypeVisitableSequence<E>, ValueVisitableSequence<E>
Direct Known Subclasses:
DateValuedVisitableSequence, IntegerValuedVisitableSequence, ReflectiveVisitableSequence, StringValuedVisitableSequence

@Participant(value="Element")
public abstract class AbstractVisitableSequence<E>
extends SequenceDecorator<E>
implements ValueVisitableSequence<E>, TypeVisitableSequence<E>

Any sequence decorated by an abstract visitable sequence implementation is value and type visitable.

Implementation notes:
The Decorator pattern is used to implement this visitable sequence.

The type visitable functionality is implemented by this class, but the value visitable functionality has to be implemented by specific sub-classes.

Author:
Gunni Rode / rode.dk

Nested Class Summary
 
Nested classes/interfaces inherited from interface dk.rode.thesis.meta.model.Sequence
Sequence.State
 
Constructor Summary
protected AbstractVisitableSequence(Sequence<E> sequence)
          Constructor.
 
Method Summary
<P> void
accept(SequenceTypeVisitor<P> visitor, P argument)
          Visits this visitable sequence using the type visitor supplied as visitor.
 
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.visitor.ValueVisitableSequence
accept
 
Methods inherited from interface dk.rode.thesis.meta.model.Sequence
bounded, consistent, copy, current, next, reset, state, unique
 
Methods inherited from interface dk.rode.thesis.strategy.Stringable
getStringablePolicy, toString
 

Constructor Detail

AbstractVisitableSequence

protected AbstractVisitableSequence(Sequence<E> sequence)
Constructor.

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

accept

public <P> void accept(SequenceTypeVisitor<P> visitor,
                       P argument)
Description copied from interface: TypeVisitableSequence
Visits this visitable sequence using the type visitor supplied as visitor.

Specified by:
accept in interface TypeVisitableSequence<E>
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:
SequenceTypeScanner.scan(TypeVisitableSequence, SequenceTypeVisitor, Object)

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.