org.crosswire.jsword.book
Enum CaseType

java.lang.Object
  extended by java.lang.Enum<CaseType>
      extended by org.crosswire.jsword.book.CaseType
All Implemented Interfaces:
Serializable, Comparable<CaseType>

public enum CaseType
extends Enum<CaseType>

Types of Sentence Case.

Author:
Joe Walker, DM Smith
See Also:
The GNU Lesser General Public License for details.

Enum Constant Summary
LOWER
           
SENTENCE
           
UPPER
           
 
Method Summary
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?.
abstract  String setCase(String word)
          Adjust the case of the string as defined by the type.
 int toInteger()
          Get an integer representation for this CaseType
static String toSentenceCase(String word)
          Change to sentence case - that is first character in caps, the rest in lower.
static CaseType valueOf(String name)
          Returns the enum constant of this type with the specified name.
static CaseType[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

LOWER

public static final CaseType LOWER

SENTENCE

public static final CaseType SENTENCE

UPPER

public static final CaseType UPPER
Method Detail

values

public static CaseType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (CaseType c : CaseType.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static CaseType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

setCase

public abstract String setCase(String word)
Adjust the case of the string as defined by the type.

Parameters:
word - the string to transform
Returns:
the transformed string

toSentenceCase

public static String toSentenceCase(String word)
Change to sentence case - that is 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

Returns:
the ordinal value of this CaseType

fromString

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

Parameters:
name - the name of the CaseType
Returns:
the CaseType that matches

fromInteger

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

Parameters:
i - the ordinal value of the CaseType
Returns:
the matching CaseType

Copyright ยจ 2003-2015