Class BinaryValuesInt

Object
BinaryValuesInt

public final class BinaryValuesInt extends Object
Two values representing int binary states in an unsigned-byte buffer.

By default, these states are 0 for off and 255 for on.

This class is immutable.

See BinaryValuesByte for an equivalent class that stores these states as byte

Author:
Owen Feehan
  • Constructor Details

    • BinaryValuesInt

      public BinaryValuesInt(int off, int on)
      Creates a new BinaryValuesInt instance.
      Parameters:
      off - The integer representation of the value for off.
      on - The integer representation of the value for on.
  • Method Details

    • asByte

      public BinaryValuesByte asByte()
      Derives a BinaryValuesByte representation from the current values.

      This is a similar structure but holds byte values rather than unsigned int values.

      Returns:
      a newly derived BinaryValuesByte.
    • getDefault

      public static BinaryValuesInt getDefault()
      Default values to use, if not otherwise specified.
      Returns:
      a static instance BinaryValuesInt with default values (see class description).
    • createInverted

      public BinaryValuesInt createInverted()
      Inverts the values so off becomes on, and vice-versa.

      This is an immutable operation.

      Returns:
      a BinaryValuesInt with the off and on values switched.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getOff

      public int getOff()
      The integer representation of the value for off.
    • getOn

      public int getOn()
      The integer representation of the value for on.