Class BinaryValuesInt
Object
BinaryValuesInt
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasByte()
Derives aBinaryValuesByte
representation from the current values.Inverts the values so off becomes on, and vice-versa.boolean
static BinaryValuesInt
Default values to use, if not otherwise specified.int
getOff()
The integer representation of the value for off.int
getOn()
The integer representation of the value for on.int
hashCode()
-
Constructor Details
-
BinaryValuesInt
public BinaryValuesInt(int off, int on) Creates a newBinaryValuesInt
instance.- Parameters:
off
- The integer representation of the value for off.on
- The integer representation of the value for on.
-
-
Method Details
-
asByte
Derives aBinaryValuesByte
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
Default values to use, if not otherwise specified.- Returns:
- a static instance
BinaryValuesInt
with default values (see class description).
-
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
-
hashCode
public int hashCode() -
getOff
public int getOff()The integer representation of the value for off. -
getOn
public int getOn()The integer representation of the value for on.
-