dk.rode.thesis.visitor
Class VisitableReversiblePrimeSequence
java.lang.Object
dk.rode.thesis.meta.model.AbstractSequence<E>
dk.rode.thesis.state.AbstractStateableSequence<Integer>
dk.rode.thesis.state.ReversiblePrimeSequence
dk.rode.thesis.visitor.VisitableReversiblePrimeSequence
- All Implemented Interfaces:
- ReversibleSequence<Integer>, Sequence<Integer>, Copyable<Sequence<Integer>>, StrictCopyable<Sequence<Integer>>, StateableSequence<Integer>, Stringable<Sequence<Integer>>, TypeVisitableSequence<Integer>, ValueVisitableSequence<Integer>
@Participant(value="ConcreteElement")
public class VisitableReversiblePrimeSequence
- extends ReversiblePrimeSequence
- implements ValueVisitableSequence<Integer>, TypeVisitableSequence<Integer>
A visitable reversible prime sequence is a
ReversiblePrimeSequence
that is value
visitable using the SequenceValueVisitor.visitIntegerValued(Sequence, Object)
visitation method and is type
visitable as well.
This sequence adds no additional state to a reversible prime
sequence, only visitation behaviour.
- Author:
- Gunni Rode / rode.dk
VisitableReversiblePrimeSequence
public VisitableReversiblePrimeSequence(int maximum)
- Constructor.
- Parameters:
maximum
- The maximum number to consider. Must be larger than 1.
- Throws:
RuntimeException
- If maximum
is smaller than 2.
VisitableReversiblePrimeSequence
public VisitableReversiblePrimeSequence(ReversiblePrimeSequence sequence)
- Copy constructor.
- Parameters:
sequence
- The reversible and/or visitable prime
sequence to copy; cannot be null.
- Throws:
NullPointerException
- If sequence
is null.
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<Integer>
- 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:
SequenceTypeVisitor.visitReversible(ReversibleSequence, Object)
,
SequenceTypeVisitor.visitStateable(StateableSequence, Object)
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
.
- Specified by:
accept
in interface ValueVisitableSequence<Integer>
- 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 VisitableReversiblePrimeSequence copy()
- Description copied from interface:
ReversibleSequence
- Returns a copy of this reversible sequence that will start
at the same sequence index as this sequence in the same
direction.
- Specified by:
copy
in interface ReversibleSequence<Integer>
- Specified by:
copy
in interface Sequence<Integer>
- Specified by:
copy
in interface Copyable<Sequence<Integer>>
- Overrides:
copy
in class ReversiblePrimeSequence
- Returns:
- A copy of this sequence; 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.