|
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<String> dk.rode.thesis.singleton.SmileySequence
@Participant(value="Singleton") @Singleton(value="getSequence") public final class SmileySequence
A smiley sequence is a sequence delivering different smileys, e.g. :), *<;), :(, etc.
A smiley sequence is bounded
,
consistent
, and
unique
with respect to its
lifetime; the sequence of the generated smileys is determined
randomly at construction time.
Implementation notes:
The SmileySequence
uses double-checked locking to perform
lazy initialisation of the singleton instance when first requested.
DanishAlphabetSequence
,
NorwegianAlphabetSequence
,
SimpsonsFamilySequence
,
SimpsonsAndBouvierFamilySequence
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface dk.rode.thesis.meta.model.Sequence |
---|
Sequence.State |
Field Summary | |
---|---|
private static SmileySequence |
instance
Single instance of the sequence, lazily initialised using double-checked locking when first requested. |
static int |
SIZE
The number of different smileys returned by the sequence. |
private static String[] |
smileys
All generated smileys. |
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 | |
---|---|
private |
SmileySequence()
Private off-limit constructor. |
Method Summary | |
---|---|
SmileySequence |
copy()
Returns this instance. |
static SmileySequence |
getSequence()
Returns the SmileySequence singleton
instance to use. |
private static String[] |
shuffleSmileys()
Generates a random sequence of smileys to return by the smiley sequence. |
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 |
---|
clone, 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 volatile SmileySequence instance
Will be null until initialised.
public static final int SIZE
Implementation notes:
Accessing this static field before getSequence()
will not cause the singleton instance to be created!
DanishAlphabetSequence.SIZE
,
NorwegianAlphabetSequence.SIZE
,
SimpsonsFamilySequence.SIZE
,
SimpsonsAndBouvierFamilySequence.SIZE
private static final String[] smileys
Constructor Detail |
---|
private SmileySequence()
Method Detail |
---|
public SmileySequence copy()
public static final SmileySequence getSequence()
SmileySequence
singleton
instance to use. If this is the first time the sequence is requested, it will be lazily initialised.
Singleton
private static final String[] shuffleSmileys()
|
Gunni Rode / rode.dk | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |