1
|
1 |
"
|
5
|
2 |
COPYRIGHT (c) 1988 by Claus Gittinger
|
379
|
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 |
|
6906
|
13 |
"{ Package: 'stx:libbasic' }"
|
|
14 |
|
1
|
15 |
Boolean subclass:#False
|
1238
|
16 |
instanceVariableNames:''
|
|
17 |
classVariableNames:''
|
|
18 |
poolDictionaries:''
|
|
19 |
category:'Kernel-Objects'
|
1
|
20 |
!
|
|
21 |
|
88
|
22 |
!False class methodsFor:'documentation'!
|
|
23 |
|
|
24 |
copyright
|
|
25 |
"
|
|
26 |
COPYRIGHT (c) 1988 by Claus Gittinger
|
379
|
27 |
All Rights Reserved
|
1
|
28 |
|
88
|
29 |
This software is furnished under a license and may be used
|
|
30 |
only in accordance with the terms of that license and with the
|
|
31 |
inclusion of the above copyright notice. This software may not
|
|
32 |
be provided or otherwise made available to, or used by, any
|
|
33 |
other person. No title to or ownership of the software is
|
|
34 |
hereby transferred.
|
|
35 |
"
|
|
36 |
!
|
1
|
37 |
|
88
|
38 |
documentation
|
|
39 |
"
|
|
40 |
False has only one instance, false, representing logical falsehood.
|
1238
|
41 |
|
88
|
42 |
Some methods are implemented here and in True, instead of the common
|
|
43 |
superclass Boolean. This has the advantage, that no truth-value checks
|
|
44 |
are needed, but instead the thruth check is done in the method lookup.
|
|
45 |
However, remember that some messages to booleans are inline coded in
|
|
46 |
the compilers (both interpreted and machine code). Therefore redefinition
|
|
47 |
of some methods here will not have any effect on compiled code.
|
|
48 |
(redefining ifTrue: to something else will probably crash the smalltalk
|
|
49 |
world anyway ...)
|
1294
|
50 |
|
1303
|
51 |
[see also:]
|
|
52 |
True
|
|
53 |
|
1294
|
54 |
[author:]
|
|
55 |
Claus Gittinger
|
574
|
56 |
"
|
692
|
57 |
! !
|
1
|
58 |
|
574
|
59 |
!False methodsFor:'binary storage'!
|
1
|
60 |
|
574
|
61 |
storeBinaryOn: stream manager: manager
|
|
62 |
"store a binary representation of the receiver on stream;
|
|
63 |
redefined, since false is stored with a special type-code"
|
1
|
64 |
|
574
|
65 |
stream nextPut: manager codeForFalse
|
1
|
66 |
! !
|
|
67 |
|
|
68 |
!False methodsFor:'conditional evaluation'!
|
|
69 |
|
|
70 |
and:aBlock
|
|
71 |
"evaluate aBlock if the receiver is true.
|
|
72 |
(since the receiver is false return false).
|
3044
|
73 |
Notice:
|
|
74 |
This method is open coded (inlined) by the compiler(s)
|
|
75 |
- redefining it may not work as expected."
|
1
|
76 |
|
|
77 |
^ self
|
|
78 |
!
|
|
79 |
|
|
80 |
ifFalse:aBlock
|
9225
|
81 |
"If the receiver is false, return the value of evaluating aBlock; nil otherwise.
|
|
82 |
Since the receiver is definitely false here, unconditionally return the blocks value.
|
3044
|
83 |
Notice:
|
9225
|
84 |
This method is open coded (inlined) by the compiler(s)
|
|
85 |
- redefining it may not work as expected."
|
1
|
86 |
|
|
87 |
^ aBlock value
|
|
88 |
!
|
|
89 |
|
574
|
90 |
ifFalse:falseBlock ifTrue:trueBlock
|
|
91 |
"return the value of evaluating falseBlock (since the receiver is false)
|
3044
|
92 |
Notice:
|
|
93 |
This method is open coded (inlined) by the compiler(s)
|
|
94 |
- redefining it may not work as expected."
|
574
|
95 |
|
|
96 |
^ falseBlock value
|
|
97 |
!
|
|
98 |
|
1
|
99 |
ifTrue:aBlock
|
9225
|
100 |
"If the receiver is true, return the value of evaluating aBlock; nil otherwise.
|
|
101 |
Since the receiver is definitely false here, unconditionally return nil value.
|
3044
|
102 |
Notice:
|
9225
|
103 |
This method is open coded (inlined) by the compiler(s)
|
|
104 |
- redefining it may not work as expected."
|
1
|
105 |
|
|
106 |
^ nil
|
|
107 |
!
|
|
108 |
|
|
109 |
ifTrue:trueBlock ifFalse:falseBlock
|
|
110 |
"return the value of evaluating falseBlock (since the receiver is false)
|
3044
|
111 |
Notice:
|
|
112 |
This method is open coded (inlined) by the compiler(s)
|
|
113 |
- redefining it may not work as expected."
|
1
|
114 |
|
|
115 |
^ falseBlock value
|
|
116 |
!
|
|
117 |
|
574
|
118 |
or:aBlock
|
|
119 |
"evaluate aBlock if the receiver is false.
|
|
120 |
(since the receiver is false return the value of evaluating aBlock).
|
3044
|
121 |
Notice:
|
|
122 |
This method is open coded (inlined) by the compiler(s)
|
|
123 |
- redefining it may not work as expected."
|
1
|
124 |
|
574
|
125 |
^ aBlock value
|
1
|
126 |
! !
|
|
127 |
|
574
|
128 |
!False methodsFor:'logical operations'!
|
|
129 |
|
|
130 |
& aBoolean
|
|
131 |
"return true, if both the receiver and the argument are true
|
6906
|
132 |
(since the receiver is false, return false)
|
|
133 |
Notice:
|
|
134 |
as this is a binary message, the argument is always evaluated.
|
|
135 |
It might be better to use and:[...], which does not evaluate
|
|
136 |
the argument if the receiver is already false."
|
574
|
137 |
|
|
138 |
^ false
|
|
139 |
!
|
|
140 |
|
|
141 |
eqv:aBoolean
|
|
142 |
"return true, if the receiver and the argument are the same truth value
|
|
143 |
(since the receiver is false, return true if the argument is also false)"
|
|
144 |
|
|
145 |
^ aBoolean not
|
|
146 |
!
|
|
147 |
|
9000
|
148 |
implies:aBoolean
|
|
149 |
"return true if receiver => argument"
|
|
150 |
|
|
151 |
^ true
|
|
152 |
!
|
|
153 |
|
574
|
154 |
not
|
|
155 |
"return true, if the receiver is false, false otherwise
|
3044
|
156 |
(since the receiver is false, return true).
|
|
157 |
Notice:
|
|
158 |
This method is open coded (inlined) by the compiler(s)
|
|
159 |
- redefining it may not work as expected."
|
574
|
160 |
|
|
161 |
^ true
|
|
162 |
!
|
|
163 |
|
|
164 |
xor:aBoolean
|
|
165 |
"return true, if the receiver and the argument are different truth values
|
|
166 |
(since the receiver is false, return true, if the armument is not false)"
|
|
167 |
|
|
168 |
^ aBoolean
|
|
169 |
!
|
|
170 |
|
|
171 |
| aBoolean
|
|
172 |
"return true, if either the receiver or the argument is true
|
6906
|
173 |
(since the receiver is false, return the argument).
|
|
174 |
Notice:
|
|
175 |
as this is a binary message, the argument is always evaluated.
|
|
176 |
It might be better to use or:[...], which does not evaluate
|
|
177 |
the argument if the receiver is already true."
|
574
|
178 |
|
|
179 |
^ aBoolean
|
|
180 |
! !
|
|
181 |
|
|
182 |
!False methodsFor:'printing & storing'!
|
1
|
183 |
|
|
184 |
printString
|
54
|
185 |
"return character sequence representing the receiver"
|
1
|
186 |
|
|
187 |
^ 'false'
|
|
188 |
! !
|
2
|
189 |
|
692
|
190 |
!False class methodsFor:'documentation'!
|
|
191 |
|
|
192 |
version
|
9225
|
193 |
^ '$Header: /cvs/stx/stx/libbasic/False.st,v 1.21 2006-03-06 08:57:41 cg Exp $'
|
6906
|
194 |
! !
|