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

dk.rode.thesis.state
Interface StateableSequence<E>

Type Parameters:
E - The type of values delivered by this stateable sequence.
All Superinterfaces:
Copyable<Sequence<E>>, Sequence<E>, StrictCopyable<Sequence<E>>, Stringable<Sequence<E>>
All Known Implementing Classes:
AbstractStateableSequence, ReversiblePrimeSequence, VisitableReversiblePrimeSequence

@Participant(value="Context")
public interface StateableSequence<E>
extends Sequence<E>

A stateable sequence is implemented internally using functional state objects to determine the current functional state.

Author:
Gunni Rode / rode.dk

Nested Class Summary
 
Nested classes/interfaces inherited from interface dk.rode.thesis.meta.model.Sequence
Sequence.State
 
Method Summary
 FunctionalState<E> getFunctionalState()
          Returns the functional state currently set for this stateable sequence if this sequence allows disclosure of such states.
 FunctionalState<E> setFunctionalState(FunctionalState<E> functionalState, Sequence.State internalState)
          Updates the functional state for this stateable sequence to functionalState, as well as the internal state to state, if supplied.
 
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
 

Method Detail

getFunctionalState

FunctionalState<E> getFunctionalState()
Returns the functional state currently set for this stateable sequence if this sequence allows disclosure of such states.

A functional state is not the same as an internal sequence state, but functional states will update the internal state.

Returns:
The current functional state; can be null if the this sequence does not allow functional states to be disclosed.
See Also:
setFunctionalState(FunctionalState, Sequence.State)

setFunctionalState

FunctionalState<E> setFunctionalState(FunctionalState<E> functionalState,
                                      Sequence.State internalState)
Updates the functional state for this stateable sequence to functionalState, as well as the internal state to state, if supplied.

A functional state is not the same as an internal sequence state, but functional states will update the internal state. After the functional sequence state has been set, its FunctionalState.action(Sequence.State, StateableSequence) method is invoked using the internal state supplied as argument.

Parameters:
functionalState - The functional state; cannot be null.
internalState - The internal state; can be null.
Returns:
The previous functional state; never null.
Throws:
NullPointerException - If functionalState is null.
IllegalStateException - If functionalState cannot be set, or if it does not accept a internalState request.
See Also:
getFunctionalState()

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.