|
Evaluating Software Design Patterns — the "Gang of Four" patterns implemented in Java 6 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Object java.lang.Enum<CompositeStrategy> dk.rode.thesis.composite.CompositeStrategy
public enum CompositeStrategy
Strategies for traversing composite
sequence
graphs.
Implementation notes:
Composite strategies are implemented according to the
Strategy pattern.
Enum Constant Summary | |
---|---|
BREATH_FIRST
Performs a breath first traversal. |
|
COMBINED
When a CompositeSequence is reached, its
default
strategy is used to traverse onwards. |
|
DEFAULT
Performs a depth first traversal returning all reachable sequences. |
|
DEPTH_FIRST
Performs a depth first traversal. |
Method Summary | ||
---|---|---|
|
traverse(Sequence<? extends E> root,
Boolean type)
Returns an ordered list containing all sequences
reachable from root , including root . |
|
protected abstract
|
traverse(Sequence<? extends E> sequence,
Boolean type,
C sequences,
CompositeStrategy strategy)
Adds all sequences reachable from sequence
to sequences as dictated by this strategy, including
sequence if not already added. |
|
static CompositeStrategy |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
|
static CompositeStrategy[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
Methods inherited from class java.lang.Enum |
---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final CompositeStrategy BREATH_FIRST
public static final CompositeStrategy COMBINED
CompositeSequence
is reached, its
default
strategy is used to traverse onwards.
public static final CompositeStrategy DEFAULT
DEPTH_FIRST
public static final CompositeStrategy DEPTH_FIRST
Method Detail |
---|
public final <E> List<Sequence<? extends E>> traverse(Sequence<? extends E> root, Boolean type)
sequences
reachable from root
, including root
.
type
determines the types of sequences to include in
the returned list:
TRUE
: only composite sequences ("nodes").
FALSE
: only non-composite sequences ("leafs").
E
- The type of values delivered by sequence
.root
- The composite sequence to start from; cannot be null.type
- The type of traversal; can be null, i.e. return
all reachable sequences.
NullPointerException
- If root
is null.protected abstract <E,C extends List<Sequence<? extends E>>> C traverse(Sequence<? extends E> sequence, Boolean type, C sequences, CompositeStrategy strategy)
sequences
reachable from sequence
to sequences
as dictated by this strategy, including
sequence
if not already added.
type
determines the types of sequences to include in
the returned list:
TRUE
: only composite sequences ("nodes").
FALSE
: only non-composite sequences ("leafs").
E
- The type of sequence values.C
- The actual type of list to add the sequences to.sequence
- The current sequence; cannot be null.type
- The type of traversal; can be null, i.e. return
all reachable sequences.sequences
- The list to add the reached sequences; never null.strategy
- The strategy to apply for all attached sequences,
if any; never null.
sequences
list; cannot be null.
NullPointerException
- If sequence
is null.public static CompositeStrategy valueOf(String name)
name
- the name of the enum constant to be returned.
IllegalArgumentException
- if this enum type has no constant
with the specified name
NullPointerException
- if the argument is nullpublic static CompositeStrategy[] values()
for (CompositeStrategy c : CompositeStrategy.values()) System.out.println(c);
|
Gunni Rode / rode.dk | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |