Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.data
Class Bit

java.lang.Object
  extended by java.lang.Number
      extended by de.lmu.ifi.dbs.elki.data.Bit
All Implemented Interfaces:
Serializable

public class Bit
extends Number

Provides a bit number. The bit is internally represented as boolean.

Author:
Arthur Zimek
See Also:
Serialized Form

Field Summary
private  boolean bit
          Internal representation of the bit value.
static Pattern BIT_PATTERN
          Pattern defining valid bit values.
private static long serialVersionUID
          Generated serial version UID.
 
Constructor Summary
Bit(boolean bit)
          Provides a new bit according to the specified boolean value.
Bit(int bit)
          Provides a new bit according to the specified integer value.
 
Method Summary
 boolean bitValue()
          Returns the bit value as a boolean.
 double doubleValue()
          Provides a double value for the integer representation of this Bit as given by intValue().
 float floatValue()
          Provides a float value for the integer representation of this Bit as given by intValue().
 int intValue()
          Provides an integer representation of the bit.
 long longValue()
          Provides a long value for the integer representation of this Bit as given by intValue().
 String toString()
          Provides the String representation of the integer representation of this Bit as given by intValue().
static Bit valueOf(String bit)
          Method to construct a Bit for a given String expression.
 
Methods inherited from class java.lang.Number
byteValue, shortValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Generated serial version UID.

See Also:
Constant Field Values

BIT_PATTERN

public static final Pattern BIT_PATTERN
Pattern defining valid bit values. A valid bit value is either 0 or 1.


bit

private boolean bit
Internal representation of the bit value.

Constructor Detail

Bit

public Bit(boolean bit)
Provides a new bit according to the specified boolean value.

Parameters:
bit - the boolean value of this bit

Bit

public Bit(int bit)
    throws IllegalArgumentException
Provides a new bit according to the specified integer value. The bit value is 1 for true and 0 for false.

Parameters:
bit - 1 for true and 0 for false
Throws:
IllegalArgumentException - if the specified value is neither 0 nor 1.
Method Detail

valueOf

public static Bit valueOf(String bit)
                   throws NumberFormatException
Method to construct a Bit for a given String expression.

Parameters:
bit - a String expression defining a Bit
Returns:
a Bit as defined by the given String expression
Throws:
NumberFormatException - if the given String expression does not fit to the Pattern BIT_PATTERN

intValue

public int intValue()
Provides an integer representation of the bit.

Specified by:
intValue in class Number
Returns:
1 if the bit is set, 0 otherwise

longValue

public long longValue()
Provides a long value for the integer representation of this Bit as given by intValue().

Specified by:
longValue in class Number

floatValue

public float floatValue()
Provides a float value for the integer representation of this Bit as given by intValue().

Specified by:
floatValue in class Number

doubleValue

public double doubleValue()
Provides a double value for the integer representation of this Bit as given by intValue().

Specified by:
doubleValue in class Number

bitValue

public boolean bitValue()
Returns the bit value as a boolean.

Returns:
the bit value

toString

public String toString()
Provides the String representation of the integer representation of this Bit as given by intValue().

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

Release 0.2 (2009-07-06_1820)