![]() |
Section 8.11.3.1:
|
![]() |
types SAME = ANSWERS ;
This class implements the concept of a logical response by a user (which is expected to be in the form of a text string) to a question requiring a yes/no answer.
The corresponding names in the culture-dependent resources file should be the language-dependent names for the English notions 'No' and 'Yes'.
The following features are required to be implemented for this class in accordance with the specifications given in $BINARY :-
This feature produces a new recognizer for potential answers given the affirmative and negative extended regular expressions as arguments. These regular expressions are provided for in the international culture spcification document (ISO/IEC 14652).
create(yes : REG_EXP, no : REG_EXP) res : SAME
pre yes <> no
The result, not being an optional object is the newly created recognizer and the post-condition is true.
This creation creates a recognizer for yes/no answers from the extended regular expression arguments.
This feature returns true provided that the string is a valid match for the 'yes' regular expression known to the recognizer, otherwise false. It must, however, be pointed out that returning false does not mean that the string was recognized as being negative - merely that it was not recognised as being affirmative.
yes(self : SAME, val : STR) res : BOOL
pre STR.size(val) > 0
post res = (response(self,val) = TRI_STATE.yes)
This predicate returns true if and only if the argument is a match for the affirmative regular expression known to the recognizer.
This feature returns true provided that the string is a valid match for the 'no' regular expression known to the recognizer, otherwise false. It must, however, be pointed out that returning false does not mean that the string was recognized as being affirmative - merely that it was not recognised as being negative.
no(self : SAME, val : STR) res : BOOL
pre STR.size(val) > 0
post res = (response(self,val) = TRI_STATE.no)
This predicate returns true if and only if the argument is a match for the negaative regular expression known to the recognizer.
This feature provides the response value explicitly, rather than as a truth value used in the previous two features.
response(self : SAME, val : STR) res : TRI_STATE
pre STR.size(val) > 0
post res in set dom TRI_STATE
This feature provides the three state logic value which represents the result of attempts at matching val against both affirmative and negative regular expressions as known to this recognizer.
![]() |
Language Index | ![]() |
Library Index | ![]() |
Non-numeric Index |
Comments
or enquiries should be made toKeith Hopper. Page last modified: Wednesday, 4 April 2001. |
![]() |