Boolean.st
author Claus Gittinger <cg@exept.de>
Sun, 02 Nov 1997 18:03:45 +0100
changeset 3070 1bf5a29fddc9
parent 2416 588d5d510c10
child 4656 aa895a9835a2
permissions -rw-r--r--
checkin from browser

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

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

    "Modified: / 2.11.1997 / 14:13:56 / cg"
! !

!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
     (i.e. can be used in constant arrays)"

    ^ true
! !

!Boolean class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libbasic/Boolean.st,v 1.22 1997-11-02 17:03:45 cg Exp $'
! !