![]() |
Section 8.3.2.11:
|
![]() |
types SAME = CASE_MAPLET ; CASE_MAPLET = token ;
This class implements the concept of a one-to-one and onto mapping from a member of a sequence of codes to a corresponding member of another sequence of codes which are non-overlapping.
The following feature is required to be implemented for this class in accordance with the specification given in $IS_EQ :-
The following features are required to be implemented for this class in accordance with the specifications given by inheritance in $STR of which $IMMUTABLE is a sub-type :-
The following features are required to be implemented for this class in accordance with the specifications given in $BINARY of which $IMMUTABLE is a sub-type:-
This class has the following three reader routines -
This feature creates a maplet from the individual components providing the maplet is one-to-one and onto the domain of valid codes.
create(code_base : CHAR_CODE, off : INT, cnt : CARD) res : SAME
pre CHAR_CODE.card(code_base) >= off and let valid_dom = dom CULTURE.rep_map(LIBCHARS.culture(CHAR_CODE.lib(code_base))) in let rng_base = CHAR_CODE.create(CHAR_CODE.card(code_base) + off, CHAR_CODE.lib(code_base) in let dom_seq = (code_base, ..., CHAR_CODE.offset(code_base, cnt)), rng_seq = (rng_base, ..., CHAR_CODE.offset(rng_base, cnt)) in forall elem : CHAR_CODE | elem in set (dom dom_seq union dom rng_seq) & elem in set valid_dom and forall elem : CHAR_CODE | elem in set dom dom_seq & elem not in set dom rng_seq
post true
This feature creates a new maplet from the argument values provided that all of the mappings and reverese mappings yield codes in the domain of the culture specified in the base code.
This feature returns true if self and other have no common elements.
is_disjoint | ( |
other : SAME | |
) : BOOL |
is_disjoint(self : SAME, other : SAME) res : BOOL
Since neither argument is optional this pre-condition is vacuously true.
post res = let other_base = code_base(other) in let dom_seq = (code_base, ..., CHAR_CODE.offset(code_base, cnt)), other_seq = (other_base, ..., CHAR_CODE.offset(other_base, cnt(other))) in forall elem : CHAR_CODE | elem in set dom dom_seq & elem not in set dom other_seq
This predicate returns true if and only if self and other have no elements in common!
This feature returns true if the given code is in the range of the mapping.
in_range(self : SAME, chcode : CHAR_CODE) res : BOOL
Since neither argument is optional this pre-condition is vacuously true.
post res = let rng_base = CHAR_CODE.create(CHAR_CODE.card(code_base) + off, CHAR_CODE.lib(code_base) in let rng_seq = (rng_base, ..., CHAR_CODE.offset(rng_base, cnt)) in chcode not in set dom rng_seq
This predicate returns true if and only if the given code is in the range of this maplet.
This feature returns true if the given code is in the domain of the mapping.
in_domain(self : SAME, chcode : CHAR_CODE) res : BOOL
Since neither argument is optional this pre-condition is vacuously true.
post res = let dom_seq = (code_base, ..., CHAR_CODE.offset(code_base, cnt)) in chcode not in set dom dom_seq
This predicate returns true if and only if the given code is in the domain of this maplet.
This feature returns the character code in the domain mapped from the given code in the range of this maplet
reverse_map | ( |
upcode : CHAR_CODE | |
) : BOOL |
reverse_map(self : SAME, upcode : CHAR_CODE) res : BOOL
pre in_range(self,upcode)
post res = CHAR_CODE.offset(upcode,- off)
This feature returns the code on the domain of this maplet corresponding to the given code in the range.
This feature returns the character code in the range mapped from the given code in the domain of this maplet
map(self : SAME, lowcode : CHAR_CODE) res : BOOL
pre in_domain(self,lowcode)
post res = CHAR_CODE.offset(lowcode,off)
This feature returns the code in the range of this maplet corresponding to the given code in the domain.
![]() |
Language Index | ![]() |
Library Index | ![]() |
Codes Index |
Comments
or enquiries should be made toKeith Hopper. Page last modified: Monday, 23 April 2001. |
![]() |