Boolean.st
author claus
Mon, 04 Oct 1993 11:32:33 +0100
changeset 2 6526dde5f3ac
parent 1 a27a279701f8
child 3 24d81bf47225
permissions -rw-r--r--
2.7.2

"
 COPYRIGHT (c) 1988/89/90 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.
"

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

Boolean comment:'

COPYRIGHT (c) 1988/89/90 by Claus Gittinger
              All Rights Reserved

Boolean is an abstract class defining the common protocol for logical
values. The logical values are represented by its two subclasses True and False.

There are no instances of Boolean in the system and there is only one
instance of True (which is the global true) and one of False (false).

Boolean catches some messages which deal with copying Booleans to make
certain there is only one instance of each.
The system will behave strange if you fiddle around here and create
new instances of True or False.

written 1988 by claus

%W% %E%
'!

!Boolean class methodsFor:'instance creation'!

basicNew
    "catch instance creation
     - there must be exactly one instance of each - no more"

    self error:'new instances of True/False are not allowed'
! !

!Boolean methodsFor:'copying'!

shallowCopy
    "return a shallow copy of the receiver
     - since both true and false are unique, return the receiver"

    ^ self
!

deepCopy
    "return a deep copy of the receiver
     - since both true and false are unique, return the receiver"

    ^ self
! !

!Boolean methodsFor:'printing & storing'!

storeOn:aStream
    "append a Character sequence to the argument, aStream from which the
     receiver can be reconstructed.
     return the receiver"

    self printOn:aStream
! !

!Boolean methodsFor: 'binary storage'!

hasSpecialBinaryRepresentation
        ^true
! !