Package elki.data

Class Bit

  • All Implemented Interfaces:
    java.io.Serializable

    public class Bit
    extends java.lang.Number
    A boolean number type.
    Since:
    0.1
    Author:
    Arthur Zimek
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean bit
      Internal representation of the bit value.
      static java.util.regex.Pattern BIT_PATTERN
      Pattern defining valid bit values.
      static Bit FALSE
      False bit.
      private static long serialVersionUID
      Generated serial version UID.
      static Bit TRUE
      True bit.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean bitValue()
      Returns the bit value as a boolean.
      double doubleValue()  
      float floatValue()  
      int intValue()  
      long longValue()  
      java.lang.String toString()  
      static Bit valueOf​(boolean b)
      Convert truth value to a bit.
      static Bit valueOf​(java.lang.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 java.util.regex.Pattern BIT_PATTERN
        Pattern defining valid bit values. A valid bit value is either 0 or 1.
      • TRUE

        public static final Bit TRUE
        True bit.
      • FALSE

        public static final Bit FALSE
        False bit.
      • bit

        private boolean bit
        Internal representation of the bit value.
    • Constructor Detail

      • Bit

        @Deprecated
        public Bit​(boolean bit)
        Deprecated.
        Use valueOf(java.lang.String) to save memory.
        Create a new bit according to the specified boolean value.
        Parameters:
        bit - the boolean value of this bit
      • Bit

        @Deprecated
        public Bit​(int bit)
            throws java.lang.IllegalArgumentException
        Deprecated.
        Use valueOf(java.lang.String) to save memory.
        Create 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:
        java.lang.IllegalArgumentException - if the specified value is neither 0 nor 1.
    • Method Detail

      • valueOf

        public static Bit valueOf​(java.lang.String bit)
                           throws java.lang.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:
        java.lang.NumberFormatException - if the given String expression does not fit the defined pattern.
      • valueOf

        public static Bit valueOf​(boolean b)
        Convert truth value to a bit.
        Parameters:
        b - Truth value
        Returns:
        Bit
      • intValue

        public int intValue()
        Specified by:
        intValue in class java.lang.Number
      • longValue

        public long longValue()
        Specified by:
        longValue in class java.lang.Number
      • floatValue

        public float floatValue()
        Specified by:
        floatValue in class java.lang.Number
      • doubleValue

        public double doubleValue()
        Specified by:
        doubleValue in class java.lang.Number
      • bitValue

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object