1
|
1 |
"
|
5
|
2 |
COPYRIGHT (c) 1988 by Claus Gittinger
|
38
|
3 |
All Rights Reserved
|
1
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
Boolean subclass:#False
|
|
14 |
instanceVariableNames:''
|
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Kernel-Objects'
|
|
18 |
!
|
|
19 |
|
|
20 |
False comment:'
|
88
|
21 |
COPYRIGHT (c) 1988 by Claus Gittinger
|
|
22 |
All Rights Reserved
|
|
23 |
'!
|
1
|
24 |
|
88
|
25 |
!False class methodsFor:'documentation'!
|
|
26 |
|
|
27 |
copyright
|
|
28 |
"
|
|
29 |
COPYRIGHT (c) 1988 by Claus Gittinger
|
38
|
30 |
All Rights Reserved
|
1
|
31 |
|
88
|
32 |
This software is furnished under a license and may be used
|
|
33 |
only in accordance with the terms of that license and with the
|
|
34 |
inclusion of the above copyright notice. This software may not
|
|
35 |
be provided or otherwise made available to, or used by, any
|
|
36 |
other person. No title to or ownership of the software is
|
|
37 |
hereby transferred.
|
|
38 |
"
|
|
39 |
!
|
1
|
40 |
|
88
|
41 |
version
|
|
42 |
"
|
|
43 |
$Header: /cvs/stx/stx/libbasic/False.st,v 1.7 1994-06-02 16:20:14 claus Exp $
|
|
44 |
"
|
|
45 |
!
|
|
46 |
|
|
47 |
documentation
|
|
48 |
"
|
|
49 |
False has only one instance, false, representing logical falsehood.
|
|
50 |
Some methods are implemented here and in True, instead of the common
|
|
51 |
superclass Boolean. This has the advantage, that no truth-value checks
|
|
52 |
are needed, but instead the thruth check is done in the method lookup.
|
|
53 |
However, remember that some messages to booleans are inline coded in
|
|
54 |
the compilers (both interpreted and machine code). Therefore redefinition
|
|
55 |
of some methods here will not have any effect on compiled code.
|
|
56 |
(redefining ifTrue: to something else will probably crash the smalltalk
|
|
57 |
world anyway ...)
|
|
58 |
"
|
|
59 |
! !
|
1
|
60 |
|
|
61 |
!False methodsFor:'logical operations'!
|
|
62 |
|
|
63 |
& aBoolean
|
|
64 |
"return true, if both the receiver and the argument are true
|
|
65 |
(since the receiver is false, return false)"
|
|
66 |
|
|
67 |
^ false
|
|
68 |
!
|
|
69 |
|
|
70 |
| aBoolean
|
|
71 |
"return true, if either the receiver or the argument is true
|
|
72 |
(since the receiver is false, return the argument)"
|
|
73 |
|
|
74 |
^ aBoolean
|
|
75 |
!
|
|
76 |
|
|
77 |
not
|
|
78 |
"return true, if the receiver is false, false otherwise
|
|
79 |
(since the receiver is false, return true)"
|
|
80 |
|
|
81 |
^ true
|
|
82 |
!
|
|
83 |
|
|
84 |
eqv:aBoolean
|
|
85 |
"return true, if the receiver and the argument are the same truth value
|
|
86 |
(since the receiver is false, return true if the argument is also false)"
|
|
87 |
|
|
88 |
^ aBoolean not
|
|
89 |
!
|
|
90 |
|
|
91 |
xor:aBoolean
|
|
92 |
"return true, if the receiver and the argument are different truth values
|
|
93 |
(since the receiver is false, return true, if the armument is not false)"
|
|
94 |
|
|
95 |
^ aBoolean
|
|
96 |
! !
|
|
97 |
|
|
98 |
!False methodsFor:'conditional evaluation'!
|
|
99 |
|
|
100 |
and:aBlock
|
|
101 |
"evaluate aBlock if the receiver is true.
|
|
102 |
(since the receiver is false return false).
|
|
103 |
- open coded by compiler"
|
|
104 |
|
|
105 |
^ self
|
|
106 |
!
|
|
107 |
|
|
108 |
or:aBlock
|
|
109 |
"evaluate aBlock if the receiver is false.
|
|
110 |
(since the receiver is false return the value of evaluating aBlock).
|
|
111 |
- open coded by compiler"
|
|
112 |
|
|
113 |
^ aBlock value
|
|
114 |
!
|
|
115 |
|
|
116 |
ifFalse:aBlock
|
|
117 |
"return the value of evaluating aBlock if the receiver is false.
|
|
118 |
(since the receiver is known to be false always evaluate)
|
|
119 |
- open coded by compiler"
|
|
120 |
|
|
121 |
^ aBlock value
|
|
122 |
!
|
|
123 |
|
|
124 |
ifTrue:aBlock
|
|
125 |
"return the false alternative, nil (since the receiver is false)
|
|
126 |
- open coded by compiler"
|
|
127 |
|
|
128 |
^ nil
|
|
129 |
!
|
|
130 |
|
|
131 |
ifTrue:trueBlock ifFalse:falseBlock
|
|
132 |
"return the value of evaluating falseBlock (since the receiver is false)
|
|
133 |
- open coded by compiler"
|
|
134 |
|
|
135 |
^ falseBlock value
|
|
136 |
!
|
|
137 |
|
|
138 |
ifFalse:falseBlock ifTrue:trueBlock
|
|
139 |
"return the value of evaluating falseBlock (since the receiver is false)
|
|
140 |
- open coded by compiler"
|
|
141 |
|
|
142 |
^ falseBlock value
|
|
143 |
! !
|
|
144 |
|
|
145 |
!False methodsFor: 'printing'!
|
|
146 |
|
|
147 |
printString
|
54
|
148 |
"return character sequence representing the receiver"
|
1
|
149 |
|
|
150 |
^ 'false'
|
|
151 |
! !
|
2
|
152 |
|
|
153 |
!False methodsFor: 'binary storage'!
|
|
154 |
|
|
155 |
storeBinaryOn: stream manager: manager
|
38
|
156 |
"store a binary representation of the receiver on stream;
|
|
157 |
redefined, since false is stored with a special type-code"
|
|
158 |
|
2
|
159 |
stream nextPut: manager codeForFalse
|
|
160 |
! !
|