1
|
1 |
"
|
5
|
2 |
COPYRIGHT (c) 1988 by Claus Gittinger
|
2
|
3 |
All Rights Reserved
|
1
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
Object subclass:#Boolean
|
|
14 |
instanceVariableNames:''
|
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Kernel-Objects'
|
|
18 |
!
|
|
19 |
|
|
20 |
Boolean comment:'
|
|
21 |
|
5
|
22 |
COPYRIGHT (c) 1988 by Claus Gittinger
|
2
|
23 |
All Rights Reserved
|
1
|
24 |
|
|
25 |
Boolean is an abstract class defining the common protocol for logical
|
|
26 |
values. The logical values are represented by its two subclasses True and False.
|
|
27 |
|
|
28 |
There are no instances of Boolean in the system and there is only one
|
|
29 |
instance of True (which is the global true) and one of False (false).
|
|
30 |
|
|
31 |
Boolean catches some messages which deal with copying Booleans to make
|
|
32 |
certain there is only one instance of each.
|
|
33 |
The system will behave strange if you fiddle around here and create
|
|
34 |
new instances of True or False.
|
|
35 |
|
|
36 |
written 1988 by claus
|
|
37 |
|
5
|
38 |
$Header: /cvs/stx/stx/libbasic/Boolean.st,v 1.4 1993-10-13 02:11:10 claus Exp $
|
1
|
39 |
'!
|
|
40 |
|
|
41 |
!Boolean class methodsFor:'instance creation'!
|
|
42 |
|
|
43 |
basicNew
|
|
44 |
"catch instance creation
|
2
|
45 |
- there must be exactly one instance of each - no more"
|
1
|
46 |
|
|
47 |
self error:'new instances of True/False are not allowed'
|
|
48 |
! !
|
|
49 |
|
3
|
50 |
!Boolean class methodsFor:'queries'!
|
|
51 |
|
|
52 |
isBuiltInClass
|
|
53 |
"this class is known by the run-time-system"
|
|
54 |
|
|
55 |
^ true
|
|
56 |
! !
|
|
57 |
|
1
|
58 |
!Boolean methodsFor:'copying'!
|
|
59 |
|
|
60 |
shallowCopy
|
|
61 |
"return a shallow copy of the receiver
|
|
62 |
- since both true and false are unique, return the receiver"
|
|
63 |
|
|
64 |
^ self
|
|
65 |
!
|
|
66 |
|
|
67 |
deepCopy
|
|
68 |
"return a deep copy of the receiver
|
|
69 |
- since both true and false are unique, return the receiver"
|
|
70 |
|
|
71 |
^ self
|
|
72 |
! !
|
|
73 |
|
|
74 |
!Boolean methodsFor:'printing & storing'!
|
|
75 |
|
|
76 |
storeOn:aStream
|
|
77 |
"append a Character sequence to the argument, aStream from which the
|
|
78 |
receiver can be reconstructed.
|
|
79 |
return the receiver"
|
|
80 |
|
|
81 |
self printOn:aStream
|
|
82 |
! !
|
2
|
83 |
|
|
84 |
!Boolean methodsFor: 'binary storage'!
|
|
85 |
|
|
86 |
hasSpecialBinaryRepresentation
|
|
87 |
^true
|
|
88 |
! !
|
|
89 |
|