Cyclic integer type.
More...
|
def | __init__ (self, value, radix) |
| Cyclic integer type constructor. More...
|
|
def | __eq__ (self, other) |
| Compare equality of cyclic integer with another value. More...
|
|
def | __lt__ (self, other) |
| Compare if a cyclic integer is smaller than another value. More...
|
|
def | __gt__ (self, other) |
| Compare if a cyclic integer is bigger than another value. More...
|
|
def | __add__ (self, other) |
| Add cyclic integer with another value. More...
|
|
def | __radd__ (self, other) |
| Add cyclic integer with another value. More...
|
|
def | __sub__ (self, other) |
| Subtract a value from self. More...
|
|
def | __neg__ (self) |
| Get supplementary cyclic integer. More...
|
|
def | __int__ (self) |
| Convert a cyclic integer to built-in integer. More...
|
|
def | __index__ (self) |
| Convert cyclic integer to collection index. More...
|
|
def | __repr__ (self) |
| Representation of cyclic integer. More...
|
|
def | as_zero (self) |
| Enter a context with this cyclic integer as zero point. More...
|
|
◆ __init__()
def wtp.util.CyclicInt.__init__ |
( |
|
self, |
|
|
|
value, |
|
|
|
radix |
|
) |
| |
Cyclic integer type constructor.
- Parameters
-
value | Value of the cyclic integer. |
radix | Radix of the cyclic integer. |
◆ __add__()
def wtp.util.CyclicInt.__add__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Add cyclic integer with another value.
- Parameters
-
- Returns
- A cyclic sum of the two values.
◆ __eq__()
def wtp.util.CyclicInt.__eq__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Compare equality of cyclic integer with another value.
- Parameters
-
- Returns
- Whether two cyclic integer is equal or not.
◆ __gt__()
def wtp.util.CyclicInt.__gt__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Compare if a cyclic integer is bigger than another value.
You should enter a zero context before comparing two cyclic integers.
- Parameters
-
- Returns
- Whether this cyclic integer is bigger than the other value.
◆ __index__()
def wtp.util.CyclicInt.__index__ |
( |
|
self | ) |
|
Convert cyclic integer to collection index.
(Proxied to self.__int__)
- Returns
- Corresponding Python integer.
◆ __int__()
def wtp.util.CyclicInt.__int__ |
( |
|
self | ) |
|
Convert a cyclic integer to built-in integer.
- Returns
- Corresponding Python integer.
◆ __lt__()
def wtp.util.CyclicInt.__lt__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Compare if a cyclic integer is smaller than another value.
You should enter a zero context before comparing two cyclic integers.
- Parameters
-
- Returns
- Whether this cyclic integer is smaller than the other value.
◆ __neg__()
def wtp.util.CyclicInt.__neg__ |
( |
|
self | ) |
|
Get supplementary cyclic integer.
- Returns
- Supplementary cyclic integer.
◆ __radd__()
def wtp.util.CyclicInt.__radd__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Add cyclic integer with another value.
(Proxied to self.__add__)
- Parameters
-
- Returns
- A cyclic sum of the two values.
◆ __repr__()
def wtp.util.CyclicInt.__repr__ |
( |
|
self | ) |
|
Representation of cyclic integer.
- Returns
- A readable representation of the cyclic integer.
◆ __sub__()
def wtp.util.CyclicInt.__sub__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Subtract a value from self.
- Parameters
-
- Returns
- A cyclic difference of the two values.
◆ _zero_ctx()
def wtp.util.CyclicInt._zero_ctx |
( |
|
cls | ) |
|
|
private |
Get current zero point context.
- Returns
- Current zero point context.
- Exceptions
-
Exception | if not in a zero point context. |
◆ as_zero()
def wtp.util.CyclicInt.as_zero |
( |
|
self | ) |
|
Enter a context with this cyclic integer as zero point.
(The old zero context will be saved in a zero context stack)
◆ _radix
wtp.util.CyclicInt._radix |
|
private |
◆ _value
wtp.util.CyclicInt._value |
|
private |
◆ _zero_ctx_stack
list wtp.util.CyclicInt._zero_ctx_stack = [] |
|
staticprivate |
Zero point contexts stack.
The documentation for this class was generated from the following file: