|
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.Objectdk.rode.thesis.meta.model.AbstractSequence<E>
dk.rode.thesis.meta.model.ArraySequence<Character>
dk.rode.thesis.flyweight.Word
@Participant(value="ConcreteFlyweight") public class Word
A word represents an ordered sequence of characters
making up that word.
A word is bounded,
consistent, but not
unique if the same character is
contained more than once in the same word.
Sentence| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface dk.rode.thesis.meta.model.Sequence |
|---|
Sequence.State |
| Field Summary | |
|---|---|
private int |
hashCode
The hash code for this word. |
private boolean |
unique
True if this word is unique, false
if not. |
| 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 | |
|---|---|
Word(Character[] characters)
Constructor, which creates this word to be comprised of the characters in characters. |
|
Word(Word word)
Copy constructor. |
|
| Method Summary | |
|---|---|
char |
charAt(int index)
|
int |
compareTo(Word word)
|
Word |
copy()
Returns a copy of this sequence that will start at the same sequence index as this sequence. |
boolean |
equals(Object object)
Returns true if object is an array sequence having the
same type as this array sequence, using an equivalent
array, and is at the same sequence index, false if not. |
int |
hashCode()
Returns the hash code of this sequence. |
int |
indexOfIgnoreCase(CharSequence sequence,
int index,
Locale locale)
Finds the first index where sequence is present in this
textual representation from the index supplied, regardless of case,
or -1 if sequence cannot be found. |
boolean |
isWhiteSpace()
Returns true if this word represents a single white space character. |
Iterator<Character> |
iterator()
|
int |
length()
|
String |
lowerCaseFirst(Locale locale)
Return the first character of this textual representation lower cased. |
CharSequence |
subSequence(int start,
int end)
|
String |
toString()
Returns this word as a string. |
boolean |
unique()
Returns true if any given character
in this word is only contained once, false otherwise. |
String |
upperCaseFirst(Locale locale)
Return the first character of this textual representation upper cased. |
| Methods inherited from class dk.rode.thesis.meta.model.ArraySequence |
|---|
bounded, consistent, current, next, reset, size |
| Methods inherited from class dk.rode.thesis.meta.model.AbstractSequence |
|---|
getStringablePolicy, state, 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 |
|---|
bounded, consistent, current, next, reset, state |
| Methods inherited from interface dk.rode.thesis.strategy.Stringable |
|---|
getStringablePolicy, toString |
| Field Detail |
|---|
private final int hashCode
private final boolean unique
unique, false
if not.
If the same character is contained
more than once, this word is not unique.
| Constructor Detail |
|---|
Word(Character[] characters)
characters.
characters - The characters; cannot be null or empty.
NullPointerException - If characters is null.
IllegalArgumentException - If characters is empty.Word(Word word)
word - The word to copy; cannot be null.
NullPointerException - If word is null.| Method Detail |
|---|
public char charAt(int index)
charAt in interface CharSequencepublic int compareTo(Word word)
compareTo in interface Comparable<Word>public Word copy()
Sequence
copy in interface Sequence<Character>copy in interface Copyable<Sequence<Character>>public final boolean equals(Object object)
ArraySequenceobject is an array sequence having the
same type as this array sequence, using an equivalent
array, and is at the same sequence index, false if not.
equals in class ArraySequence<Character>object - The object to test; can be null.
public final int hashCode()
ArraySequence
hashCode in class ArraySequence<Character>
public int indexOfIgnoreCase(CharSequence sequence,
int index,
Locale locale)
Textualsequence is present in this
textual representation from the index supplied, regardless of case,
or -1 if sequence cannot be found.
index is allowed to be larger than the length of
this textual representation, in which case this method returns -1.
The supplied locale is used to perform the case conversion.
indexOfIgnoreCase in interface Textual<Word>sequence - The char sequence to find; cannot be null.index - The index to start at; cannot be negative.locale - The locale to use; can be null, in which case
the default locale is used.
sequence from index,
regardless of case, or -1 if not found.public boolean isWhiteSpace()
public Iterator<Character> iterator()
iterator in interface Iterable<Character>public int length()
length in interface CharSequencepublic String lowerCaseFirst(Locale locale)
TextualNote, that in some locales, shifting case of a given character may cause it to expand into more than one character! Hence, the return type is a string.
lowerCaseFirst in interface Textual<Word>locale - The locale to use; can be null, in which
case the default locale is used.
public CharSequence subSequence(int start,
int end)
subSequence in interface CharSequencepublic String toString()
toString in interface CharSequencetoString in class AbstractSequence<Character>public boolean unique()
character
in this word is only contained once, false otherwise.
unique in interface Sequence<Character>unique in class ArraySequence<Character>Sequence.consistent()public String upperCaseFirst(Locale locale)
TextualNote, that in some locales, shifting case of a given character may cause it to expand into more than one character! Hence, the return type is a string.
upperCaseFirst in interface Textual<Word>locale - The locale to use; can be null, in which
case the default locale is used.
|
Gunni Rode / rode.dk | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||