dk.rode.thesis.state
Class EvenSequence
java.lang.Object
dk.rode.thesis.meta.model.AbstractSequence<Integer>
dk.rode.thesis.state.StepSequenceImpl
dk.rode.thesis.state.EvenSequence
- All Implemented Interfaces:
- Sequence<Integer>, Copyable<Sequence<Integer>>, StrictCopyable<Sequence<Integer>>, StepSequence, Stringable<Sequence<Integer>>
@Participant(value="ConcreteState")
class EvenSequence
- extends StepSequenceImpl
The even sequence represents the state generating
even step
sequence values.
- Author:
- Gunni Rode / rode.dk
- See Also:
OddSequence
Methods inherited from interface dk.rode.thesis.meta.model.Sequence |
state |
EvenSequence
EvenSequence(int step,
int value)
- Constructor.
- Parameters:
step
- The step; cannot be zero.value
- The initial sequence value.
- Throws:
IllegalArgumentException
- If step
is zero.
EvenSequence
EvenSequence(StepSequenceImpl sequence)
- Copy constructor.
- Parameters:
sequence
- The sequence to copy; never null.
copy
public EvenSequence copy()
- Description copied from interface:
Copyable
- Returns a deep copy of this object.
- Returns:
- The copy; never null.
current
public Integer current()
- Description copied from interface:
Sequence
- Returns the current element from this sequence.
This method can be invoked even if Sequence.next()
has not been invoked yet, thus delivering the initial
value of this sequence.
- Returns:
- The current element; never null.
flip
StepSequenceImpl flip()
- Description copied from class:
StepSequenceImpl
- Flips this sequence from even to odd or vice versa.
- Specified by:
flip
in class StepSequenceImpl
- Returns:
- A flipped instance; never null.
next
public Integer next()
- Description copied from interface:
Sequence
- Returns the next element from this sequence.
- Returns:
- The next element; never null.
- See Also:
Sequence.current()
,
Sequence.state()
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.