Boolean.st
author Claus Gittinger <cg@exept.de>
Sat, 23 Mar 1996 18:22:50 +0100
changeset 1119 956d62a5656c
parent 698 04533375e12c
child 1245 c8afea3d5af0
permissions -rw-r--r--
compile seldom used methods with optSpace (is this a good idea ?)

"
 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).
"
! !

!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
    "this class is known by the run-time-system"

    ^ true
! !

!Boolean methodsFor:'binary storage'!

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

	^true
! !

!Boolean methodsFor:'converting'!

literalArrayEncoding
    "encode myself as an array literal."

    ^ self

    "Modified: 5.9.1995 / 22:46:57 / claus"
! !

!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.17 1996-03-23 17:20:22 cg Exp $'
! !