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 aBinaryValuesByterepresentation from the current values.Inverts the values so off becomes on, and vice-versa.booleanstatic BinaryValuesIntDefault values to use, if not otherwise specified.intgetOff()The integer representation of the value for off.intgetOn()The integer representation of the value for on.inthashCode()
-
Constructor Details
-
BinaryValuesInt
public BinaryValuesInt(int off, int on) Creates a newBinaryValuesIntinstance.- Parameters:
off- The integer representation of the value for off.on- The integer representation of the value for on.
-
-
Method Details
-
asByte
Derives aBinaryValuesByterepresentation 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
BinaryValuesIntwith default values (see class description).
-
createInverted
Inverts the values so off becomes on, and vice-versa.This is an immutable operation.
- Returns:
- a
BinaryValuesIntwith 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.
-