org.crosswire.jsword.book
Class CaseType

java.lang.Object
  extended by org.crosswire.jsword.book.CaseType
All Implemented Interfaces:
Serializable

public abstract class CaseType
extends Object
implements Serializable

Types of Sentence Case.

Author:
Joe Walker [joe at eireneh dot com], DM Smith [dmsmith555 at yahoo dot com]
See Also:
for license details. The copyright to this program is held by it's authors., Serialized Form

Field Summary
static CaseType LOWER
           
private  String name
          The name of the type
private static int nextObj
           
private  int obj
           
static CaseType SENTENCE
           
static CaseType UPPER
           
private static CaseType[] VALUES
           
 
Constructor Summary
CaseType(String name)
          Simple ctor
 
Method Summary
 boolean equals(Object o)
          Prevent subclasses from overriding canonical identity based Object methods
static CaseType fromInteger(int i)
          Lookup method to convert from an integer
static CaseType fromString(String name)
          Lookup method to convert from a String
static CaseType getCase(String word)
          What case is the specified word?.
 int hashCode()
          Prevent subclasses from overriding canonical identity based Object methods
(package private)  Object readResolve()
           
abstract  String setCase(String word)
           
 int toInteger()
          Get an integer representation for this CaseType
protected static String toSentenceCase(String word)
          Change to sentence case - ie first character in caps, the rest in lower.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

LOWER

public static final CaseType LOWER

SENTENCE

public static final CaseType SENTENCE

UPPER

public static final CaseType UPPER

name

private transient String name
The name of the type


nextObj

private static int nextObj

obj

private final int obj

VALUES

private static final CaseType[] VALUES
Constructor Detail

CaseType

public CaseType(String name)
Simple ctor

Method Detail

setCase

public abstract String setCase(String word)

toSentenceCase

protected static String toSentenceCase(String word)
Change to sentence case - ie first character in caps, the rest in lower.

Parameters:
word - The word to be manipulated
Returns:
The altered word

getCase

public static CaseType getCase(String word)
What case is the specified word?. A blank word is LOWER, a word with a single upper case letter is SENTENCE and not UPPER - Simply because this is more likely, however TO BE SURE I WOULD NEED TO THE CONTEXT. I could not tell otherwise.

The issue here is that getCase("FreD") is undefined. Telling if this is SENTENCE (Tubal-Cain) or MIXED (really the case) is complex and would slow things down for a case that I don't believe happens with Bible text.

Parameters:
word - The word to be tested
Returns:
LOWER, SENTENCE, UPPER or MIXED
Throws:
IllegalArgumentException - is the word is null

toInteger

public int toInteger()
Get an integer representation for this CaseType


fromString

public static CaseType fromString(String name)
Lookup method to convert from a String


fromInteger

public static CaseType fromInteger(int i)
Lookup method to convert from an integer


equals

public final boolean equals(Object o)
Prevent subclasses from overriding canonical identity based Object methods

Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

hashCode

public final int hashCode()
Prevent subclasses from overriding canonical identity based Object methods

Overrides:
hashCode in class Object
See Also:
Object.hashCode()

toString

public String toString()
Overrides:
toString in class Object

readResolve

Object readResolve()

Copyright ยจ 2003-2007