dk.rode.thesis.proxy
Class NonResettableSequence<E>
java.lang.Object
dk.rode.thesis.decorator.SequenceDecorator<E>
dk.rode.thesis.proxy.NonResettableSequence<E>
- Type Parameters:
E
- The type of values delivered by this sequence.
- All Implemented Interfaces:
- Sequence<E>, Copyable<Sequence<E>>, StrictCopyable<Sequence<E>>, Stringable<Sequence<E>>
- Direct Known Subclasses:
- ImmutableSequence
@ParticipantUsage(value="Subject",
type=Sequence.class)
@Participant(value="Proxy")
public class NonResettableSequence<E>
- extends SequenceDecorator<E>
- implements Sequence<E>
A non-resettable sequence ensures that invocations of
reset()
are ignored for the proxied sequence
if and only if the proxied sequence is accessed through
the proxy only.
A non-resettable sequence exhibits the same bounded
,
consistent
, and unique
properties as the proxied sequence.
Implementation notes:
A non-resettable sequence corresponds to a protection proxy as described
by Gamma et al. [Gamma95, p.208].
- Author:
- Gunni Rode / rode.dk
- See Also:
SequenceProxyFactory.getNonResettableSequence(Sequence)
Method Summary |
NonResettableSequence<E> |
copy()
Returns a copy of this sequence that will start at the
same sequence index as this sequence. |
void |
reset()
Does not reset the proxied sequence. |
Methods inherited from class dk.rode.thesis.decorator.SequenceDecorator |
bounded, consistent, current, equals, getSequence, getStringablePolicy, hashCode, next, state, toString, toString, unique |
NonResettableSequence
public NonResettableSequence(@Participant(value="RealSubject")
Sequence<E> sequence)
- Constructor.
- Parameters:
sequence
- The sequence to proxy; cannot be null.
- Throws:
NullPointerException
- If sequence
is null.
copy
public NonResettableSequence<E> copy()
- Description copied from interface:
Sequence
- Returns a copy of this sequence that will start at the
same sequence index as this sequence.
- Specified by:
copy
in interface Sequence<E>
- Specified by:
copy
in interface Copyable<Sequence<E>>
- Returns:
- A copy of this sequence; never null.
reset
public final void reset()
- Does not reset the proxied sequence.
- Specified by:
reset
in interface Sequence<E>
- Overrides:
reset
in class SequenceDecorator<E>
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.