All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ceylon.language.Ordinal.ceylon Maven / Gradle / Ivy

There is a newer version: 1.3.3
Show newest version
"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|Comparable]]. 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 of Other
        given Other satisfies Ordinal {
    
    "The successor of this value."
    shared formal Other successor;
    
    "The predecessor of this value."
    shared formal Other predecessor;
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy