28 lines
813 B
Text
28 lines
813 B
Text
```doc
|
|
# Integer
|
|
|
|
This protocol defines all the protocols and functions required for a value to masquerade as an integer.
|
|
|
|
For the concrete implementation see `Outrun.Core.Integer`.
|
|
```
|
|
protocol Integer,
|
|
requires:
|
|
AbsoluteValue + Addition + BitwiseAnd + BitwiseOr + BitwiseXor + Division +
|
|
Equality + Exponentiation + GreaterOrEqual + Greater + LessOrEqual + Less +
|
|
Modulus + Multiplication + Negation + ShiftLeft + ShiftRight + Subtraction,
|
|
as: do
|
|
```doc
|
|
Returns whether the value of `self` is greater than zero.
|
|
```
|
|
def positive?(self: Self): Boolean
|
|
|
|
```doc
|
|
Returns whether the value of `self` is zero.
|
|
```
|
|
def zero?(self: Self): Boolean
|
|
|
|
```doc
|
|
Returns whether the value of `self` is less than zero.
|
|
```
|
|
def negative?(self: Self): Boolean
|
|
end
|