1"======================================================================
2|
3|   False Method Definitions
4|
5|
6 ======================================================================"
7
8"======================================================================
9|
10| Copyright 1988,92,94,95,99,2000,2001
11| Free Software Foundation, Inc.
12| Written by Steve Byrne.
13|
14| This file is part of the GNU Smalltalk class library.
15|
16| The GNU Smalltalk class library is free software; you can redistribute it
17| and/or modify it under the terms of the GNU Lesser General Public License
18| as published by the Free Software Foundation; either version 2.1, or (at
19| your option) any later version.
20|
21| The GNU Smalltalk class library is distributed in the hope that it will be
22| useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
23| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
24| General Public License for more details.
25|
26| You should have received a copy of the GNU Lesser General Public License
27| along with the GNU Smalltalk class library; see the file COPYING.LIB.
28| If not, write to the Free Software Foundation, 59 Temple Place - Suite
29| 330, Boston, MA 02110-1301, USA.
30|
31 ======================================================================"
32
33
34
35Boolean subclass: False [
36    | truthValue |
37
38    <category: 'Language-Data types'>
39    <comment: 'I always tell lies.
40I have a single instance in the system, which represents the value false.'>
41
42    asCBooleanValue [
43	<category: 'C hacks'>
44	^0
45    ]
46
47    ifTrue: trueBlock ifFalse: falseBlock [
48	"We are false -- evaluate the falseBlock"
49
50	<category: 'basic'>
51	^falseBlock value
52    ]
53
54    ifFalse: falseBlock ifTrue: trueBlock [
55	"We are false -- evaluate the falseBlock"
56
57	<category: 'basic'>
58	^falseBlock value
59    ]
60
61    ifTrue: trueBlock [
62	"We are false -- answer nil"
63
64	<category: 'basic'>
65	^nil
66    ]
67
68    ifFalse: falseBlock [
69	"We are false -- evaluate the falseBlock"
70
71	<category: 'basic'>
72	^falseBlock value
73    ]
74
75    not [
76	"We are false -- answer true"
77
78	<category: 'basic'>
79	^true
80    ]
81
82    & aBoolean [
83	"We are false -- anded with anything, we always answer false"
84
85	<category: 'basic'>
86	^false
87    ]
88
89    | aBoolean [
90	"We are false -- ored with anything, we always answer the other operand"
91
92	<category: 'basic'>
93	^aBoolean
94    ]
95
96    eqv: aBoolean [
97	"Answer whether the receiver and aBoolean represent the
98	 same boolean value"
99
100	<category: 'basic'>
101	^aBoolean not
102    ]
103
104    xor: aBoolean [
105	"Answer whether the receiver and aBoolean represent different
106	 boolean values"
107
108	<category: 'basic'>
109	^aBoolean
110    ]
111
112    and: aBlock [
113	"We are false -- anded with anything, we always answer false"
114
115	<category: 'basic'>
116	^false
117    ]
118
119    or: aBlock [
120	"We are false -- ored with anything, we always answer the other operand,
121	 so evaluate aBlock"
122
123	<category: 'basic'>
124	^aBlock value
125    ]
126
127    printOn: aStream [
128	"Print a representation of the receiver on aStream"
129
130	<category: 'printing'>
131	aStream nextPutAll: 'false'
132    ]
133]
134
135