org.griphyn.common.util
Class Boolean

java.lang.Object
  extended by org.griphyn.common.util.Boolean

public class Boolean
extends Object

This class converts a boolean property specification (string) in various representations into a booelan value. It is liberal in the representation it accepts, but strict in what it produces.

Version:
$Revision: 50 $
Author:
Gaurang Mehta, Karan Vahi, Jens-S. V??ckler

Field Summary
static String FALSE
          The character representation of a false value.
static String TRUE
          The character representation of a true value.
 
Constructor Summary
Boolean()
           
 
Method Summary
static boolean parse(String rep)
          Converts a boolean string representation into a boolean value.
static boolean parse(String rep, boolean deflt)
          Converts a boolean string representation into a boolean value.
static String print(boolean val)
          Converts a boolean value into a strict representation of it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRUE

public static final String TRUE
The character representation of a true value.

See Also:
Constant Field Values

FALSE

public static final String FALSE
The character representation of a false value.

See Also:
Constant Field Values
Constructor Detail

Boolean

public Boolean()
Method Detail

print

public static String print(boolean val)
Converts a boolean value into a strict representation of it.

Parameters:
val - is the boolean input value
Returns:
a string representing the boolean value.

parse

public static boolean parse(String rep)
Converts a boolean string representation into a boolean value. Representations may include non-negative integers, where only 0 means false. Other valid string representations of true include:
 true
 yes
 on
 
Any other string representation is taken to mean false

Parameters:
rep - is the input string representing a boolean value.
Returns:
a boolean value from the representation.

parse

public static boolean parse(String rep,
                            boolean deflt)
Converts a boolean string representation into a boolean value. Representations may include non-negative integers, where only 0 means false. Other valid string representations of true include:
 true
 yes
 on
 
Other valid string representations of false include, besides the numerical zero:
 false
 no
 off
 
Any other string representation is taken to mean the boolean value indicated by the paramater deflt.

Parameters:
rep - is the input string representing a boolean value.
deflt - is the deflt value to use in case rep does not represent a valid boolean value.
Returns:
a boolean value from the representation.


Copyright © 2007 The University of Southern California. All Rights Reserved.