False.st
author Claus Gittinger <cg@exept.de>
Tue, 21 Oct 1997 19:44:59 +0200
changeset 3044 a0bbac91639b
parent 1303 8fdc2c653d13
child 6906 87afb9964006
permissions -rw-r--r--
*** empty log message ***

"
 COPYRIGHT (c) 1988 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"

Boolean subclass:#False
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Kernel-Objects'
!

!False class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1988 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

documentation
"
    False has only one instance, false, representing logical falsehood.

    Some methods are implemented here and in True, instead of the common
    superclass Boolean. This has the advantage, that no truth-value checks 
    are needed, but instead the thruth check is done in the method lookup.
    However, remember that some messages to booleans are inline coded in
    the compilers (both interpreted and machine code). Therefore redefinition
    of some methods here will not have any effect on compiled code.
    (redefining ifTrue: to something else will probably crash the smalltalk
     world anyway ...)

    [see also:]
        True

    [author:]
        Claus Gittinger
"
! !

!False methodsFor:'binary storage'!

storeBinaryOn: stream manager: manager
    "store a binary representation of the receiver on stream;
     redefined, since false is stored with a special type-code"

    stream nextPut: manager codeForFalse
! !

!False methodsFor:'conditional evaluation'!

and:aBlock
    "evaluate aBlock if the receiver is true.
     (since the receiver is false return false).
     Notice:
	This method is open coded (inlined) by the compiler(s)
	- redefining it may not work as expected."

    ^ self
!

ifFalse:aBlock
    "return the value of evaluating aBlock if the receiver is false.
     (since the receiver is known to be false always evaluate)
     Notice:
	This method is open coded (inlined) by the compiler(s)
	- redefining it may not work as expected."

    ^ aBlock value
!

ifFalse:falseBlock ifTrue:trueBlock
    "return the value of evaluating falseBlock (since the receiver is false)
     Notice:
	This method is open coded (inlined) by the compiler(s)
	- redefining it may not work as expected."

    ^ falseBlock value
!

ifTrue:aBlock
    "return the false alternative, nil (since the receiver is false)
     Notice:
	This method is open coded (inlined) by the compiler(s)
	- redefining it may not work as expected."

    ^ nil
!

ifTrue:trueBlock ifFalse:falseBlock
    "return the value of evaluating falseBlock (since the receiver is false)
     Notice:
	This method is open coded (inlined) by the compiler(s)
	- redefining it may not work as expected."

    ^ falseBlock value
!

or:aBlock
    "evaluate aBlock if the receiver is false.
     (since the receiver is false return the value of evaluating aBlock).
     Notice:
	This method is open coded (inlined) by the compiler(s)
	- redefining it may not work as expected."

    ^ aBlock value
! !

!False methodsFor:'logical operations'!

& aBoolean
    "return true, if both the receiver and the argument are true
     (since the receiver is false, return false)"

    ^ false
!

eqv:aBoolean
    "return true, if the receiver and the argument are the same truth value
     (since the receiver is false, return true if the argument is also false)"

    ^ aBoolean not
!

not
    "return true, if the receiver is false, false otherwise
     (since the receiver is false, return true).
     Notice:
	This method is open coded (inlined) by the compiler(s)
	- redefining it may not work as expected."

    ^ true
!

xor:aBoolean
    "return true, if the receiver and the argument are different truth values
     (since the receiver is false, return true, if the armument is not false)"

    ^ aBoolean
!

| aBoolean
    "return true, if either the receiver or the argument is true
     (since the receiver is false, return the argument)"

    ^ aBoolean
! !

!False methodsFor:'printing & storing'!

printString
    "return character sequence representing the receiver"

    ^ 'false'
! !

!False class methodsFor:'documentation'!

version
^ '$Header: /cvs/stx/stx/libbasic/False.st,v 1.18 1997-10-21 17:42:26 cg Exp $'! !