|
Evaluating Software Design Patterns — the "Gang of Four" patterns implemented in Java 6 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dk.rode.thesis.meta.model.AbstractSequence<E> dk.rode.thesis.composite.AbstractCompositeSequence<Object> dk.rode.thesis.visitor.VisitableCompositeSequence
@Participant(value="ConcreteElement") public class VisitableCompositeSequence
An visitable composite sequence is value
and type
visitable, storing
sequences
regardless of the type of value they
deliver.
The children of a composite sequence are NOT visited explicitly
during visits to it! Their visitation must be handled by
value
and type
scanners!
The value returned by the current()
and next()
methods is the value of the first contained sequence. In
case a visitable composite sequence has no children,
NULL
is returned.
This implementation is not thread-safe.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface dk.rode.thesis.meta.model.Sequence |
---|
Sequence.State |
Field Summary |
---|
Fields inherited from class dk.rode.thesis.composite.AbstractCompositeSequence |
---|
sequences |
Fields inherited from class dk.rode.thesis.meta.model.AbstractSequence |
---|
state |
Constructor Summary | |
---|---|
VisitableCompositeSequence()
No-arg constructor. |
|
VisitableCompositeSequence(CompositeStrategy strategy)
Constructor. |
|
VisitableCompositeSequence(VisitableCompositeSequence sequence)
Copy constructor, which also copies associated sequences. |
Method Summary | ||
---|---|---|
|
accept(SequenceTypeVisitor<P> visitor,
P argument)
Visits this visitable sequence using the type visitor supplied
as visitor . |
|
|
accept(SequenceValueVisitor<P> visitor,
P argument)
Visits this visitable sequence using the value visitor supplied
as visitor . |
|
VisitableCompositeSequence |
copy()
Returns a copy of this sequence that will start at the same sequence index as this sequence. |
|
Object |
current()
Returns the current element from this sequence. |
|
Object |
next()
Returns the next element from this sequence. |
Methods inherited from class dk.rode.thesis.composite.AbstractCompositeSequence |
---|
addSequence, bounded, calculateNextState, consistent, getCompositeStrategy, getSequences, getSequences, getSequences, getSequences, iterator, removeSequence, reset, setCompositeStrategy, size, unique |
Methods inherited from class dk.rode.thesis.meta.model.AbstractSequence |
---|
getStringablePolicy, state, toString, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface dk.rode.thesis.meta.model.Sequence |
---|
bounded, consistent, reset, state, unique |
Methods inherited from interface dk.rode.thesis.strategy.Stringable |
---|
getStringablePolicy, toString |
Constructor Detail |
---|
public VisitableCompositeSequence()
The CompositeStrategy.DEFAULT
strategy is used
for traversal.
public VisitableCompositeSequence(CompositeStrategy strategy)
strategy
- The traversal strategy; can be null, in which
case CompositeStrategy.DEFAULT
is used.public VisitableCompositeSequence(VisitableCompositeSequence sequence)
sequence
- The composite sequence to copy; cannot be null.
NullPointerException
- If sequence
is null.Method Detail |
---|
public <P> void accept(SequenceTypeVisitor<P> visitor, P argument)
TypeVisitableSequence
type
visitor supplied
as visitor
.
accept
in interface TypeVisitableSequence<Object>
P
- The type of visitor-supplied argument. Use Void
for visitors that do not need an additional argument.visitor
- The visitor; never null.argument
- A context supplied argument, if any.SequenceTypeVisitor.visitComposite(CompositeSequence, Object)
public <P> void accept(SequenceValueVisitor<P> visitor, P argument)
ValueVisitableSequence
value
visitor supplied
as visitor
.
accept
in interface ValueVisitableSequence<Object>
P
- The type of visitor-supplied argument. Use Void
for visitors that do not need an additional argument.visitor
- The visitor; never null.argument
- A context supplied argument, if any.SequenceVisitor.visitUnknown(Sequence, Object)
public VisitableCompositeSequence copy()
Sequence
copy
in interface Sequence<Object>
copy
in interface Copyable<Sequence<Object>>
public Object current()
Sequence
This method can be invoked even if Sequence.next()
has not been invoked yet, thus delivering the initial
value of this sequence.
current
in interface Sequence<Object>
public Object next()
Sequence
next
in interface Sequence<Object>
Sequence.current()
,
Sequence.state()
|
Gunni Rode / rode.dk | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |