Table of Contents
Previous Chapter
- indexing
- description: "Characters, with comparison operations and an ASCII code"
- expanded class interface
- feature -- Access
- -- Associated integer value
- -- Hash code value
- -- (From HASHABLE.)
- good_hash_value: Result >= 0
- feature -- Comparison
- infix "<" (other: like Current): BOOLEAN
- -- Is other greater than current character?
- -- (From COMPARABLE.)
- other_exists: other /= Void
- asymmetric: Result implies not (other < Current)
- infix "<=" (other:like Current): BOOLEAN
- -- Is current character less than or equal to other?
- -- (From COMPARABLE.)
- other_exists: other /= Void
- definition: Result = (Current < other) or is_equal (other);
- infix ">=" (other: like Current): BOOLEAN
- -- Is current object greater than or equal to other?
- -- (From COMPARABLE.)
- other_exists: other /= Void
- definition: Result = (other <= Current)
- infix ">" (other: like Current): BOOLEAN
- -- Is current object greater than other?
- -- (From COMPARABLE.)
- other_exists: other /= Void
- definition: Result = (other < Current)
- max (other: like Current): like Current
- -- The greater of current object and other
-- (From COMPARABLE.)
- other_exists: other /= Void
- current_if_not_smaller: (Current >= other) implies (Result = Current)
- other_if_smaller: (Current < other) implies (Result = other)
- min (other: like Current): like Current
- -- The smaller of current object and other
-- (From COMPARABLE.)
- other_exists: other /= Void
- current_if_not_greater: (Current <= other) implies (Result = Current)
- other_if_greater: (Current > other) implies (Result = other)
- three_way_comparison (other: like Current): INTEGER
- -- If current object equal to other, 0; if smaller,
- -- --1; if greater, 1.
- -- (From COMPARABLE.)
- other_exists: other /= Void
- equal_zero: (Result = 0) = is_equal (other);
- smaller: (Result = --1) = Current < other;
- greater_positive: (Result = 1) = Current > other
- feature -- Output
- -- Printable representation of character
- -- (From GENERAL.)
- invariant
- irreflexive_comparison: not (Current < Current)
- end
Table of Contents
Next Chapter
|