False.st
author Claus Gittinger <cg@exept.de>
Fri, 07 Jul 2000 16:13:34 +0200
changeset 5449 bf1de72fd2bb
parent 3044 a0bbac91639b
child 6906 87afb9964006
permissions -rw-r--r--
preps for rel5 migration
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     1
"
5
67342904af11 *** empty log message ***
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1988 by Claus Gittinger
379
5b5a130ccd09 revision added
claus
parents: 92
diff changeset
     3
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     4
a27a279701f8 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    12
a27a279701f8 Initial revision
claus
parents:
diff changeset
    13
Boolean subclass:#False
1238
a1b8da9895ad commentary
Claus Gittinger <cg@exept.de>
parents: 692
diff changeset
    14
	instanceVariableNames:''
a1b8da9895ad commentary
Claus Gittinger <cg@exept.de>
parents: 692
diff changeset
    15
	classVariableNames:''
a1b8da9895ad commentary
Claus Gittinger <cg@exept.de>
parents: 692
diff changeset
    16
	poolDictionaries:''
a1b8da9895ad commentary
Claus Gittinger <cg@exept.de>
parents: 692
diff changeset
    17
	category:'Kernel-Objects'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    18
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    19
88
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    20
!False class methodsFor:'documentation'!
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    21
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    22
copyright
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    23
"
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    24
 COPYRIGHT (c) 1988 by Claus Gittinger
379
5b5a130ccd09 revision added
claus
parents: 92
diff changeset
    25
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    26
88
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    27
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    28
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    30
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    31
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    32
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    33
"
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    34
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    35
88
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    36
documentation
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    37
"
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    38
    False has only one instance, false, representing logical falsehood.
1238
a1b8da9895ad commentary
Claus Gittinger <cg@exept.de>
parents: 692
diff changeset
    39
88
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    40
    Some methods are implemented here and in True, instead of the common
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    41
    superclass Boolean. This has the advantage, that no truth-value checks 
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    42
    are needed, but instead the thruth check is done in the method lookup.
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    43
    However, remember that some messages to booleans are inline coded in
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    44
    the compilers (both interpreted and machine code). Therefore redefinition
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    45
    of some methods here will not have any effect on compiled code.
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    46
    (redefining ifTrue: to something else will probably crash the smalltalk
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    47
     world anyway ...)
1294
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1238
diff changeset
    48
1303
8fdc2c653d13 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
    49
    [see also:]
8fdc2c653d13 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
    50
        True
8fdc2c653d13 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
    51
1294
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1238
diff changeset
    52
    [author:]
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1238
diff changeset
    53
        Claus Gittinger
574
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
    54
"
692
24ea6761b4a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 574
diff changeset
    55
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    56
574
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
    57
!False methodsFor:'binary storage'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    58
574
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
    59
storeBinaryOn: stream manager: manager
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
    60
    "store a binary representation of the receiver on stream;
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
    61
     redefined, since false is stored with a special type-code"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    62
574
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
    63
    stream nextPut: manager codeForFalse
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    64
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
    65
a27a279701f8 Initial revision
claus
parents:
diff changeset
    66
!False methodsFor:'conditional evaluation'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    67
a27a279701f8 Initial revision
claus
parents:
diff changeset
    68
and:aBlock
a27a279701f8 Initial revision
claus
parents:
diff changeset
    69
    "evaluate aBlock if the receiver is true.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    70
     (since the receiver is false return false).
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
    71
     Notice:
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
    72
	This method is open coded (inlined) by the compiler(s)
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
    73
	- redefining it may not work as expected."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    74
a27a279701f8 Initial revision
claus
parents:
diff changeset
    75
    ^ self
a27a279701f8 Initial revision
claus
parents:
diff changeset
    76
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    77
a27a279701f8 Initial revision
claus
parents:
diff changeset
    78
ifFalse:aBlock
a27a279701f8 Initial revision
claus
parents:
diff changeset
    79
    "return the value of evaluating aBlock if the receiver is false.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    80
     (since the receiver is known to be false always evaluate)
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
    81
     Notice:
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
    82
	This method is open coded (inlined) by the compiler(s)
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
    83
	- redefining it may not work as expected."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    84
a27a279701f8 Initial revision
claus
parents:
diff changeset
    85
    ^ aBlock value
a27a279701f8 Initial revision
claus
parents:
diff changeset
    86
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    87
574
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
    88
ifFalse:falseBlock ifTrue:trueBlock
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
    89
    "return the value of evaluating falseBlock (since the receiver is false)
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
    90
     Notice:
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
    91
	This method is open coded (inlined) by the compiler(s)
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
    92
	- redefining it may not work as expected."
574
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
    93
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
    94
    ^ falseBlock value
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
    95
!
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
    96
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    97
ifTrue:aBlock
a27a279701f8 Initial revision
claus
parents:
diff changeset
    98
    "return the false alternative, nil (since the receiver is false)
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
    99
     Notice:
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
   100
	This method is open coded (inlined) by the compiler(s)
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
   101
	- redefining it may not work as expected."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   102
a27a279701f8 Initial revision
claus
parents:
diff changeset
   103
    ^ nil
a27a279701f8 Initial revision
claus
parents:
diff changeset
   104
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   105
a27a279701f8 Initial revision
claus
parents:
diff changeset
   106
ifTrue:trueBlock ifFalse:falseBlock
a27a279701f8 Initial revision
claus
parents:
diff changeset
   107
    "return the value of evaluating falseBlock (since the receiver is false)
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
   108
     Notice:
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
   109
	This method is open coded (inlined) by the compiler(s)
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
   110
	- redefining it may not work as expected."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   111
a27a279701f8 Initial revision
claus
parents:
diff changeset
   112
    ^ falseBlock value
a27a279701f8 Initial revision
claus
parents:
diff changeset
   113
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   114
574
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   115
or:aBlock
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   116
    "evaluate aBlock if the receiver is false.
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   117
     (since the receiver is false return the value of evaluating aBlock).
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
   118
     Notice:
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
   119
	This method is open coded (inlined) by the compiler(s)
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
   120
	- redefining it may not work as expected."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   121
574
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   122
    ^ aBlock value
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   123
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   124
574
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   125
!False methodsFor:'logical operations'!
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   126
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   127
& aBoolean
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   128
    "return true, if both the receiver and the argument are true
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   129
     (since the receiver is false, return false)"
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   130
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   131
    ^ false
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   132
!
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   133
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   134
eqv:aBoolean
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   135
    "return true, if the receiver and the argument are the same truth value
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   136
     (since the receiver is false, return true if the argument is also false)"
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   137
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   138
    ^ aBoolean not
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   139
!
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   140
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   141
not
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   142
    "return true, if the receiver is false, false otherwise
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
   143
     (since the receiver is false, return true).
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
   144
     Notice:
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
   145
	This method is open coded (inlined) by the compiler(s)
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
   146
	- redefining it may not work as expected."
574
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   147
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   148
    ^ true
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   149
!
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   150
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   151
xor:aBoolean
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   152
    "return true, if the receiver and the argument are different truth values
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   153
     (since the receiver is false, return true, if the armument is not false)"
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   154
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   155
    ^ aBoolean
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   156
!
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   157
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   158
| aBoolean
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   159
    "return true, if either the receiver or the argument is true
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   160
     (since the receiver is false, return the argument)"
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   161
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   162
    ^ aBoolean
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   163
! !
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   164
5e7cbb66d6c7 testing cvs
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   165
!False methodsFor:'printing & storing'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   166
a27a279701f8 Initial revision
claus
parents:
diff changeset
   167
printString
54
06dbdeeed4f9 *** empty log message ***
claus
parents: 38
diff changeset
   168
    "return character sequence representing the receiver"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   169
a27a279701f8 Initial revision
claus
parents:
diff changeset
   170
    ^ 'false'
a27a279701f8 Initial revision
claus
parents:
diff changeset
   171
! !
2
claus
parents: 1
diff changeset
   172
692
24ea6761b4a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 574
diff changeset
   173
!False class methodsFor:'documentation'!
24ea6761b4a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 574
diff changeset
   174
24ea6761b4a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 574
diff changeset
   175
version
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
   176
^ '$Header: /cvs/stx/stx/libbasic/False.st,v 1.18 1997-10-21 17:42:26 cg Exp $'! !