dk.rode.thesis.state
Class OddSequence
java.lang.Object
dk.rode.thesis.meta.model.AbstractSequence<Integer>
dk.rode.thesis.state.StepSequenceImpl
dk.rode.thesis.state.OddSequence
- All Implemented Interfaces:
- Sequence<Integer>, Copyable<Sequence<Integer>>, StrictCopyable<Sequence<Integer>>, StepSequence, Stringable<Sequence<Integer>>
@Participant(value="ConcreteState")
class OddSequence
- extends StepSequenceImpl
The odd sequence represents the state generating
odd step
sequence values.
- Author:
- Gunni Rode / rode.dk
- See Also:
EvenSequence
Methods inherited from interface dk.rode.thesis.meta.model.Sequence |
state |
OddSequence
OddSequence(int step,
int value)
- Constructor.
- Parameters:
step
- The step; cannot be zero.value
- The initial sequence value.
- Throws:
IllegalArgumentException
- If step
is zero.
OddSequence
OddSequence(StepSequenceImpl sequence)
- Copy constructor.
- Parameters:
sequence
- The sequence to copy; never null.
copy
public OddSequence 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.