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:

• bitwise operations, and
• addition and subtraction modulo 256.

`Byte`s 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:

Thus, to compare the magnitude of two bytes, it is necessary to first convert them to either their `signed` or `unsigned` integer values.

`Byte`s are useful mainly because they can be efficiently stored in an `Array`.

Since 1.1.0
• `Byte`
• `Binary`
• `Enumerable`
• `Ordinal`
• `Invertible`
• `Summable`
• `Object`
• `Anything`

no subtypes hierarchy

 Initializer `Byte(Integer congruent)`Parameters: `congruent`An integer member of the congruence class of the resulting `Byte`. For any integer `x>=0`: ```x.byte.unsigned == x % 256 x.byte.signed == x % 256 ``` And for an integer `x<0`: ```x.byte.unsigned == 256 + x % 256 x.byte.signed == x % 256 ``` And for any integers `x` and `y` which are congruent modulo 256: ```x.byte == y.byte ```
 Attributes `even` Source Code`shared Boolean even`Whether this byte is even. `hash` Source Code`shared actual Integer hash`The 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: if `x==y` then `x.hash==y.hash`. Therefore, a class which refines `Object.equals()` must also refine `hash`. In general, `hash` values vary between platforms and between executions of the same program. Note that when executing on a Java Virtual Machine, the 64-bit `Integer` value returned by an implementation of `hash` is truncated to a 32-bit integer value by taking the exclusive disjunction of the 32 lowest-order bits with the 32 highest-order bits, before returning the value to the caller. Refines `Object.hash` `negated` Source Code`shared actual Byte negated`The additive inverse of this byte. For any integer `x`: ```(-x.byte).signed = -x.byte.signed ``` Refines `Invertible.negated` `not` Source Code`shared actual Byte not`The binary complement of this sequence of bits. Refines `Binary.not` `predecessor` Source Code`shared actual Byte predecessor`The predecessor of this value. Refines `Enumerable.predecessor` ultimately refines `Ordinal.predecessor` `signed` Source Code`shared Integer signed`This byte interpreted as a signed integer in the range `-128..127` (that is, `-#80..#7F`). `string` Source Code`shared actual String string`The `unsigned` interpretation of this byte as a string. Refines `Object.string` `successor` Source Code`shared actual Byte successor`The successor of this value. Refines `Enumerable.successor` ultimately refines `Ordinal.successor` `unit` Source Code`shared Boolean unit`Whether this byte is one. `unsigned` Source Code`shared Integer unsigned= (congruent % #100).and(#FF)`This byte interpreted as an unsigned integer in the range `0..255` (that is, `0..#FF`). `zero` Source Code`shared Boolean zero`Whether this byte is zero.
 Inherited Attributes Attributes inherited from: `Object` Attributes inherited from: `Binary``not` Attributes inherited from: `Enumerable` Attributes inherited from: `Invertible``negated` Attributes inherited from: `Ordinal`
 Methods `and` Source Code`shared actual Byte and(Byte other)`Performs a logical AND operation. Refines `Binary.and` `clear` Source Code`shared actual Byte clear(Integer index)`Returns an instance with the given bit set to 0 if `0 <= index < size`, otherwise returns a value with the same bits as this value. Refines `Binary.clear` `equals` Source Code`shared actual Boolean equals(Object that)`Determine if two values are equal. For any two non-null objects `x` and `y`, `x.equals(y)` may be written as: ```x == y ``` Implementations should respect the constraints that: if `x===y` then `x==y` (reflexivity), if `x==y` then `y==x` (symmetry), if `x==y` and `y==z` then `x==z` (transitivity). Furthermore it is recommended that implementations ensure that if `x==y` then `x` and `y` have the same concrete class. A class which explicitly refines `equals()` is said to support value equality, and the equality operator `==` is considered much more meaningful for such classes than for a class which simply inherits the default implementation of identity equality from `Identifiable`. Note that an implementation of `equals()` that always returns `false` does satisfy the constraints given above. Therefore, in very rare cases where there is no reasonable definition of value equality for a class, for example, Return(*Arguments)Go to Callable abbreviation X(Y,Z) means Callable, it is acceptable for `equals()` to be defined to return `false` for every argument. Refines `Object.equals` `flip` Source Code`shared actual Byte flip(Integer index)`Returns an instance with the given bit flipped to its opposite value if `0 <= index < size`, otherwise returns a value with the same bits as this value. Refines `Binary.flip` `get` Source Code`shared actual Boolean get(Integer index)`Retrieves a given bit from this bit sequence if `0 <= index < size`, otherwise returns false. Refines `Binary.get` `leftLogicalShift` Source Code`shared actual Byte leftLogicalShift(Integer shift)`If `shift` is in the range `0..\$111`, shift the bits to the left by `shift` positions, using zero extension to fill in the least significant bits. Otherwise shift the addressable bits to the left by `shift.and(\$111)` positions, using zero extension. Aliases: `leftShift` `leftShift` See `leftLogicalShift()` `neighbour` Source Code`shared actual Byte neighbour(Integer offset)`The indirect successor or predecessor at the given `offset`, where: `x.neighbour(0) == x`, `x.neighbour(i+1) == x.neighbour(i).successor`, and `x.neighbour(i-1) == x.neighbour(i).predecessor`. `offset` Source Code`shared actual Integer offset(Byte other)`Compute the offset from the given value, where: `x.offset(x) == 0`, and `x.successor.offset(x) == 1` if `x!=x.successor`. Refines `Enumerable.offset` `offsetSign` Source Code`shared actual Integer offsetSign(Byte other)`The sign of the offset from the given value. `or` Source Code`shared actual Byte or(Byte other)`Performs a logical inclusive OR operation. Refines `Binary.or` `plus` Source Code`shared actual Byte plus(Byte other)`The modulo 256 sum of this byte and the given byte. Refines `Summable.plus` `rightArithmeticShift` Source Code`shared actual Byte rightArithmeticShift(Integer shift)`If `shift` is in the range `0..\$111`, shift the bits to the right by `shift` positions, using sign extension to fill in the most significant bits. Otherwise shift the addressable bits to the right by `shift.and(\$111)` positions, using sign extension. `rightLogicalShift` Source Code`shared actual Byte rightLogicalShift(Integer shift)`If `shift` is in the range `0..\$111`, shift the bits to the right by `shift` positions, using zero extension to fill in the most significant bits. Otherwise shift the addressable bits to the right by `shift.and(\$111)` positions, using zero extension. Aliases: `rightShift` `rightShift` See `rightLogicalShift()` `set` Source Code`shared actual Byte set(Integer index, Boolean bit)`Returns an instance with the given bit set to the given value if `0 <= index < size`, otherwise returns a value with the same bits as this value. Refines `Binary.set` `xor` Source Code`shared actual Byte xor(Byte other)`Performs a logical exclusive OR operation. Refines `Binary.xor`
 Inherited Methods Methods inherited from: `Object``equals()` Methods inherited from: `Binary` Methods inherited from: `Enumerable` Methods inherited from: `Invertible``minus()` Methods inherited from: `Summable``plus()`