Boolean.st
author Claus Gittinger <cg@exept.de>
Sat, 04 Sep 1999 20:20:55 +0200
changeset 4682 4158042a9c8c
parent 4656 aa895a9835a2
child 4728 37eaa8241422
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.
"

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

!Boolean 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
"
    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 redefines 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 (i.e. it will not recognize these new
    instances as being true or false).

    [author:]
	Claus Gittinger
"
! !

!Boolean class methodsFor:'instance creation'!

basicNew
    "{ Pragma: +optSpace }"

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

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

!Boolean class methodsFor:'queries'!

hasSharedInstances
    "return true if this class has shared instances, that is, instances
     with the same value are identical.
     False is returned here, only redefined in classes which have unified
     instances (or should be treated so)."

    ^ true

!

isBuiltInClass
    "return true if this class is known by the run-time-system.
     Here, true is returned (for my two subclasses)."

    ^ true

    "Modified: 23.4.1996 / 15:58:22 / cg"
! !

!Boolean methodsFor:'binary storage'!

hasSpecialBinaryRepresentation
    "return true, if the receiver has a special binary representation"

    ^ true
! !

!Boolean methodsFor:'converting'!

decodeAsLiteralArray
    "given a literalEncoding in the receiver,
     create & return the corresponding object.
     The inverse operation to #literalArrayEncoding."

    ^ self

    "Created: 25.2.1997 / 19:16:43 / cg"
    "Modified: 25.2.1997 / 19:17:45 / cg"
!

literalArrayEncoding
    "encode myself as an array literal, from which a copy of the receiver
     can be reconstructed with #decodeAsLiteralArray."

    ^ self

    "Modified: 5.9.1995 / 22:46:57 / claus"
    "Modified: 22.4.1996 / 13:00:05 / cg"
! !

!Boolean methodsFor:'copying'!

copy
    "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
!

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

    ^ self
!

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

    ^ self
!

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

    ^ self
! !

!Boolean methodsFor:'printing & storing'!

printOn:aStream
    "append a character sequence representing the receiver to the argument,
     aStream"

    aStream nextPutAll:self printString
!

storeOn:aStream
    "append a character sequence to the argument, aStream from which the
     receiver can be reconstructed using readFrom:."

    ^ self printOn:aStream
!

storeString
    "return  a character sequence to the argument, aStream from which the
     receiver can be reconstructed using readFrom:."

    ^ self printString
! !

!Boolean methodsFor:'queries'!

isLiteral
    "return true, if the receiver can be used as a literal constant in ST syntax
     (i.e. can be used in constant arrays)"

    ^ true
! !

!Boolean methodsFor:'tracing'!

traceInto:aRequestor level:level from:referrer
    "double dispatch into tracer, passing my type implicitely in the selector"

    ^ aRequestor traceBoolean:self level:level from:referrer


! !

!Boolean class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libbasic/Boolean.st,v 1.24 1999-09-04 18:20:45 cg Exp $'
! !