Evaluating Software Design Patterns
— the "Gang of Four" patterns implemented in Java 6

dk.rode.thesis.flyweight
Interface Textual<T>

Type Parameters:
T - The type of this textual object.
All Superinterfaces:
CharSequence, Comparable<T>
All Known Subinterfaces:
Character
All Known Implementing Classes:
AbstractCharacter, Letter, Sentence, Symbol, Whitespace, Word

@Participant(value="Flyweight")
public interface Textual<T>
extends CharSequence, Comparable<T>

A textual object represents a flyweight object that is a char sequence and comparable to its own type.

The value of a textual object is its toString() representation.

Author:
Gunni Rode / rode.dk

Method Summary
 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.
 String lowerCaseFirst(Locale locale)
          Return the first character of this textual representation lower cased.
 String upperCaseFirst(Locale locale)
          Return the first character of this textual representation upper cased.
 
Methods inherited from interface java.lang.CharSequence
charAt, length, subSequence, toString
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

indexOfIgnoreCase

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.

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.

Parameters:
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.
Returns:
The first index of sequence from index, regardless of case, or -1 if not found.
Throws:
NullPointerException - If sequence is null.
IndexOutOfBoundsException - If index is negative.

lowerCaseFirst

String lowerCaseFirst(Locale locale)
Return the first character of this textual representation lower cased.

Note, 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.

Parameters:
locale - The locale to use; can be null, in which case the default locale is used.
Returns:
The lower cased character; never null.

upperCaseFirst

String upperCaseFirst(Locale locale)
Return the first character of this textual representation upper cased.

Note, 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.

Parameters:
locale - The locale to use; can be null, in which case the default locale is used.
Returns:
The upper cased character; never null.

Gunni Rode / rode.dk

Feel free to use and/or modify the Java 6 source code developed for this thesis AT YOUR OWN RISK, but note that the source code comes WITHOUT ANY — and I do mean WITHOUT ANY — form of warranty WHAT SO EVER!

The original thesis and source code are available at rode.dk/thesis.