Abstraction of *ordinal types*, that is, of types where
each instance has a `successor`

and `predecessor`

, such
as:

- types which represent or are isomorphic to the
mathematical integers, for example,
`Integer`

and other`Integral`

numeric types, and even`Character`

, along with - enumerated types which are isomorphic to the mathematical integers under modular arithmetic, for example, the days of the week, and
- enumerated types which are isomorphic to a bounded range of integers, for example, a list of priorities.

The *increment* operator `++`

and *decrement* operator `--`

are defined for all types which satisfy `Ordinal`

.

function increment() { count++; }

Many ordinal types have a total order. If an ordinal type has a total order, then it should satisfy:

`x.successor >= x`

, and`x.predecessor <= x`

.

An ordinal enumerated type `X`

with a total order has
well-defined `maximum`

and `minimum`

values where
`minimum<x<maximum`

for any other instance `x`

of `X`

.
Then the `successor`

and `predecessor`

operations should
satisfy:

`minimum.predecessor==minimum`

, and`maximum.successor==maximum`

.

By: Gavin

See also

`Character`

, `Integer`

, `Integral`

, `Comparable`

, `Enumerable`

*no type hierarchy*

*no supertypes hierarchy*

Attributes | |

`predecessor` | Source Code`shared formal Other predecessor` The predecessor of this value. |

`successor` | Source Code`shared formal Other successor` The successor of this value. |

Inherited Attributes |

Attributes inherited from: `Object` |