things.common.tools
Class Plato

java.lang.Object
  extended by things.common.tools.Plato

public class Plato
extends java.lang.Object

Plato and truth.

Version:
1.0

Version History

EPG - Initial - 28 NOV 06
 
Author:
Erich P. Gatejen

Field Summary
static java.lang.String FALSE_STRING
           
static java.lang.String TRUE_STRING
           
 
Constructor Summary
Plato()
           
 
Method Summary
static boolean decideTruth(java.lang.String target)
          Decide truth.
static boolean decideTruth(java.lang.String target, boolean defaultValue)
          Decide truth only if target is not null and is one or more characters (any value).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRUE_STRING

public static final java.lang.String TRUE_STRING
See Also:
Constant Field Values

FALSE_STRING

public static final java.lang.String FALSE_STRING
See Also:
Constant Field Values
Constructor Detail

Plato

public Plato()
Method Detail

decideTruth

public static boolean decideTruth(java.lang.String target,
                                  boolean defaultValue)
Decide truth only if target is not null and is one or more characters (any value). If it is null, the defaultValue will be returned as the truth. This is not case sensitive. Leading and trailing whitespace is ignored. The following is true: 'TRUE', 'T', 'YES', 'y', integer numbers 1 or more. The following is false: 'FALSE', 'F', 'NO', 'n', number 0 or negative, floating point numbers.
It will never throw an exception, since any problem means it is false.

Parameters:
target - The statement to examine. This will be treated like a 7-bit ascii string!
defaultValue - the default value.
Returns:
How true (in English) the statement is.

decideTruth

public static boolean decideTruth(java.lang.String target)
Decide truth. This is not case sensitive. Leading and trailing whitespace is ignored. The following is true: 'TRUE', 'T', 'YES', 'y', integer numbers 1 or more. The following is false: 'FALSE', 'F', 'NO', 'n', number 0 or negative, floating point numbers, and null.
It will never throw an exception, since any problem means it is false.

Parameters:
target - The statement to examine. This will be treated like a 7-bit ascii string!
Returns:
How true (in English) the statement is.


Things.