Class BooleanData

  • All Implemented Interfaces:
    java.lang.Comparable<java.lang.Object>

    public class BooleanData
    extends FunctionData
    Function boolean data wrapper. It can contain a boolean value, timestamp and additional metadata. It doesn't support measurement unit.
    See Also:
    BooleanControl, BooleanSensor, FunctionData
    • Constructor Summary

      Constructors 
      Constructor Description
      BooleanData​(long timestamp, java.util.Map<java.lang.String,​?> metadata, boolean value)
      Constructs new BooleanData instance with the specified arguments.
      BooleanData​(java.util.Map<java.lang.String,​?> fields)
      Constructs new BooleanData instance with the specified field values.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(java.lang.Object o)
      Compares this BooleanData instance with the given argument.
      boolean equals​(java.lang.Object o)
      Two BooleanData instances are equal if they contain equal metadata, timestamp and boolean value.
      boolean getValue()
      Returns BooleanData value.
      int hashCode()
      Returns the hash code for this BooleanData object.
      java.lang.String toString()
      Returns the string representation of this boolean data.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • FIELD_VALUE

        public static final java.lang.String FIELD_VALUE
        Represents the value field name. The field value is available with getValue(). The field type is boolean . The constant can be used as a key to BooleanData(Map).
        See Also:
        Constant Field Values
    • Constructor Detail

      • BooleanData

        public BooleanData​(java.util.Map<java.lang.String,​?> fields)
        Constructs new BooleanData instance with the specified field values. The map keys must match to the field names. The map values will be assigned to the appropriate class fields. For example, the maps can be: {"value"=Boolean(true)...}. That map will initialize the FIELD_VALUE field with true.

        FIELD_VALUE - mandatory field. The value type must be Boolean.

        Parameters:
        fields - Contains the new BooleanData instance field values.
        Throws:
        java.lang.ClassCastException - If the field value types are not expected.
        java.lang.IllegalArgumentException - If the value is missing.
        java.lang.NullPointerException - If the fields map is null.
      • BooleanData

        public BooleanData​(long timestamp,
                           java.util.Map<java.lang.String,​?> metadata,
                           boolean value)
        Constructs new BooleanData instance with the specified arguments.
        Parameters:
        timestamp - The boolean data timestamp optional field.
        metadata - The boolean data metadata optional field.
        value - The boolean value mandatory field.
    • Method Detail

      • getValue

        public boolean getValue()
        Returns BooleanData value.
        Returns:
        BooleanData value.
      • equals

        public boolean equals​(java.lang.Object o)
        Two BooleanData instances are equal if they contain equal metadata, timestamp and boolean value.
        Overrides:
        equals in class FunctionData
        Parameters:
        o - The object to compare this data.
        Returns:
        true if this object is equivalent to the specified one.
        See Also:
        FunctionData.equals(java.lang.Object)
      • hashCode

        public int hashCode()
        Returns the hash code for this BooleanData object. The hash code is a sum of FunctionData.hashCode() and Boolean.hashCode(), where Boolean.hashCode() represents the boolean value hash code.
        Overrides:
        hashCode in class FunctionData
        Returns:
        The hash code of this BooleanData object.
        See Also:
        FunctionData.hashCode()
      • compareTo

        public int compareTo​(java.lang.Object o)
        Compares this BooleanData instance with the given argument. If the argument is not BooleanData, it throws ClassCastException. Otherwise, this method returns:
        • -1 if this instance field is less than a field of the specified argument.
        • 0 if all fields are equivalent.
        • 1 if this instance field is greater than a field of the specified argument.
        The fields are compared in this order: timestamp, metadata, value.
        Specified by:
        compareTo in interface java.lang.Comparable<java.lang.Object>
        Overrides:
        compareTo in class FunctionData
        Parameters:
        o - BooleanData to be compared.
        Returns:
        -1, 0 or 1 depending on the comparison rules.
        Throws:
        java.lang.ClassCastException - If the method argument is not of type BooleanData.
        See Also:
        Comparable.compareTo(java.lang.Object)
      • toString

        public java.lang.String toString()
        Returns the string representation of this boolean data.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The string representation of this boolean data.