|
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.meta.model.ArraySequence<CharSequence> dk.rode.thesis.prototype.SymbolSequence
@Participant(value="ConcretePrototype") public class SymbolSequence
A cloneable symbol sequence can be cloned by using the
copy()
method, or by using Java's built-in clone
mechanism by calling clone()
.
The following symbols are allowed:
! " # ¤ % & / ( ) = ? < > @ £ $ € { [ ] } + | ~ : *A symbol sequence thus acts as a prototype for similar sequences containing the same symbols, in order.
A symbol sequence is bounded
,
consistent
, and
unique
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface dk.rode.thesis.meta.model.Sequence |
---|
Sequence.State |
Field Summary | |
---|---|
private static CharSequence[] |
SYMBOLS
The various symbols allowed in a symbol sequence. |
Fields inherited from class dk.rode.thesis.meta.model.ArraySequence |
---|
elements, index |
Fields inherited from class dk.rode.thesis.meta.model.AbstractSequence |
---|
state |
Constructor Summary | |
---|---|
SymbolSequence()
No-arg constructor. |
|
SymbolSequence(char... symbols)
Constructor. |
|
SymbolSequence(SymbolSequence sequence)
Copy constructor. |
Method Summary | |
---|---|
SymbolSequence |
clone()
Clones this symbol sequence and returns the clone (copy). |
SymbolSequence |
copy()
Returns a copy of this sequence that will start at the same sequence index as this sequence. |
static CharSequence[] |
getAllowedSymbols()
Returns the various symbols allowed in any symbol sequence. |
private static CharSequence[] |
validate(char[] symbols)
Validates the symbols supplied in symbols . |
Methods inherited from class dk.rode.thesis.meta.model.ArraySequence |
---|
bounded, consistent, current, equals, hashCode, next, reset, size, unique |
Methods inherited from class dk.rode.thesis.meta.model.AbstractSequence |
---|
getStringablePolicy, state, toString, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface dk.rode.thesis.meta.model.Sequence |
---|
state |
Methods inherited from interface dk.rode.thesis.strategy.Stringable |
---|
getStringablePolicy, toString |
Field Detail |
---|
private static final CharSequence[] SYMBOLS
The allowed symbols are:
! " # ¤ % & / ( ) = ? < > @ £ $ € { [ ] } + | ~ : *Trying to construct a symbol sequence with other symbols is an error.
Constructor Detail |
---|
public SymbolSequence()
All allowed allowed symbols are used.
public SymbolSequence(char... symbols)
The symbols supplied as symbols
are used in this
symbol sequence.
symbols
- The symbols from the allowed
symbols to use in this sequence; cannot be null or be empty.
NullPointerException
- If symbols
is null.
IllegalArgumentException
- If symbols
is empty, or
if it contains symbols not found in the allowed
symbols.public SymbolSequence(SymbolSequence sequence)
This sequence starts at the current index of sequence
.
sequence
- The sequence to copy; cannot be null.
NullPointerException
- If sequence
is null.Method Detail |
---|
public SymbolSequence clone()
clone
in class Object
public SymbolSequence copy()
Sequence
public static final CharSequence[] getAllowedSymbols()
The allowed symbols are:
! " # ¤ % & / ( ) = ? < > @ £ $ € { [ ] } + | ~ : *Trying to construct a symbol sequence with other symbols is an error.
Modifying the returned array will only have local effect.
private static final CharSequence[] validate(char[] symbols)
symbols
.
If each char in symbols
is contained in
SYMBOLS
, this method returns silently with
a CharSequence
array corresponding to the
symbols. Otherwise an exception is thrown.
symbols
- The symbols to validate; cannot be null.
CharSequence
array; never null.
NullPointerException
- If symbols
is null.
IllegalArgumentException
- If symbols
contains
an illegal symbol.
|
Gunni Rode / rode.dk | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |