An 8-bit byte. A Byte value represents a congruence class
of integers modulo 256, and may be interpreted
as:
Byte is not considered a full numeric type, supporting
only:
Bytes with modular addition form a mathematical
group. Thus, every byte b has an additive
inverse -b where:
(-b).signed == -b.signed (-b).unsigned == b.unsigned==0 then 0 else 256 - b.unsigned
Byte is a recursive enumerable type. For
example, the range:
254.byte .. 1.byte
contains the values 254.byte, 255.byte, 0.byte, 1.byte.
Byte does not have a total order because
any such order would:
successor and
predecessor under modular addition, andByte value as
signed or unsigned.Thus, to compare the magnitude of two bytes, it is
necessary to first convert them to either their signed or
unsigned integer values.
Bytes are useful mainly because they can be efficiently
stored in an Array.
no subtypes hierarchy
| Initializer |
Byte(Integer congruent)Parameters:
|
| Attributes | |
even | Source Codeshared Boolean evenWhether this byte is even. |
hash | Source Codeshared actual Integer hashThe hash value of the value, which allows the value to be an element of a hash-based set or key of a hash-based map. Implementations must respect the constraint that:
Therefore, a class which refines In general, Note that when executing on a Java Virtual Machine, the
64-bit Refines Object.hash |
negated | Source Codeshared actual Byte negatedThe additive inverse of this byte. For any integer (-x.byte).signed = -x.byte.signed Refines Invertible.negated |
not | Source Codeshared actual Byte notThe binary complement of this sequence of bits. Refines Binary.not |
predecessor | Source Codeshared actual Byte predecessorThe predecessor of this value. |
signed | Source Codeshared Integer signedThis byte interpreted as a signed integer in the range
|
string | Source Codeshared actual String stringThe Refines Object.string |
successor | Source Codeshared actual Byte successorThe successor of this value. |
unit | Source Codeshared Boolean unitWhether this byte is one. |
unsigned | Source Codeshared Integer unsigned= (congruent % #100).and(#FF)This byte interpreted as an unsigned integer in the
range |
zero | Source Codeshared Boolean zeroWhether this byte is zero. |
| Inherited Attributes |
Attributes inherited from: Object |
Attributes inherited from: Binary<Other> |
Attributes inherited from: Enumerable<Other> |
Attributes inherited from: Invertible<Other> |
Attributes inherited from: Ordinal<Other> |
| Methods | |
and | Source Codeshared actual Byte and(Byte other)Performs a logical AND operation. Refines Binary.and |
clear | Source Codeshared actual Byte clear(Integer index)Returns an instance with the given bit set to 0 if
Refines Binary.clear |
equals | Source Codeshared actual Boolean equals(Object that)Determine if two values are equal. For any two non-null objects x == y Implementations should respect the constraints that:
Furthermore it is recommended that implementations
ensure that if A class which explicitly refines Note that an implementation of Refines Object.equals |
flip | Source Codeshared actual Byte flip(Integer index)Returns an instance with the given bit flipped to its
opposite value if Refines Binary.flip |
get | Source Codeshared actual Boolean get(Integer index)Retrieves a given bit from this bit sequence if
Refines Binary.get |
leftLogicalShift | Source Codeshared actual Byte leftLogicalShift(Integer shift)If Refines Binary.leftLogicalShiftAliases: leftShift |
leftShift | See leftLogicalShift() |
neighbour | Source Codeshared actual Byte neighbour(Integer offset)The indirect successor or predecessor at the given
Refines Enumerable.neighbour |
offset | Source Codeshared actual Integer offset(Byte other)Compute the offset from the given value, where:
Refines Enumerable.offset |
offsetSign | Source Codeshared actual Integer offsetSign(Byte other)The sign of the offset from the given value. Refines Enumerable.offsetSign |
or | Source Codeshared actual Byte or(Byte other)Performs a logical inclusive OR operation. Refines Binary.or |
plus | Source Codeshared actual Byte plus(Byte other)The modulo 256 sum of this byte and the given byte. Refines Summable.plus |
rightArithmeticShift | Source Codeshared actual Byte rightArithmeticShift(Integer shift)If Refines Binary.rightArithmeticShift |
rightLogicalShift | Source Codeshared actual Byte rightLogicalShift(Integer shift)If Refines Binary.rightLogicalShiftAliases: rightShift |
rightShift | See rightLogicalShift() |
set | Source Codeshared actual Byte set(Integer index, Boolean bit)Returns an instance with the given bit set to the given
value if Refines Binary.set |
xor | Source Codeshared actual Byte xor(Byte other)Performs a logical exclusive OR operation. Refines Binary.xor |
| Inherited Methods |
Methods inherited from: Object |
Methods inherited from: Binary<Other> |
Methods inherited from: Enumerable<Other> |
Methods inherited from: Invertible<Other> |
Methods inherited from: Summable<Other> |