1
|
1 |
"
|
5
|
2 |
COPYRIGHT (c) 1988 by Claus Gittinger
|
159
|
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:'
|
88
|
21 |
COPYRIGHT (c) 1988 by Claus Gittinger
|
159
|
22 |
All Rights Reserved
|
92
|
23 |
|
422
|
24 |
$Header: /cvs/stx/stx/libbasic/Boolean.st,v 1.14 1995-09-07 11:57:49 claus Exp $
|
88
|
25 |
'!
|
1
|
26 |
|
88
|
27 |
!Boolean class methodsFor:'documentation'!
|
|
28 |
|
|
29 |
copyright
|
|
30 |
"
|
|
31 |
COPYRIGHT (c) 1988 by Claus Gittinger
|
159
|
32 |
All Rights Reserved
|
1
|
33 |
|
88
|
34 |
This software is furnished under a license and may be used
|
|
35 |
only in accordance with the terms of that license and with the
|
|
36 |
inclusion of the above copyright notice. This software may not
|
|
37 |
be provided or otherwise made available to, or used by, any
|
|
38 |
other person. No title to or ownership of the software is
|
|
39 |
hereby transferred.
|
|
40 |
"
|
|
41 |
!
|
1
|
42 |
|
88
|
43 |
version
|
|
44 |
"
|
422
|
45 |
$Header: /cvs/stx/stx/libbasic/Boolean.st,v 1.14 1995-09-07 11:57:49 claus Exp $
|
88
|
46 |
"
|
|
47 |
!
|
1
|
48 |
|
88
|
49 |
documentation
|
|
50 |
"
|
|
51 |
Boolean is an abstract class defining the common protocol for logical
|
|
52 |
values. The logical values are represented by its two subclasses True and False.
|
|
53 |
|
|
54 |
There are no instances of Boolean in the system and there is only one
|
|
55 |
instance of True (which is the global true) and one of False (false).
|
1
|
56 |
|
88
|
57 |
Boolean redefines some messages which deal with copying Booleans,
|
|
58 |
to make certain there is only one instance of each.
|
|
59 |
The system will behave strange if you fiddle around here and create
|
|
60 |
new instances of True or False (i.e. it will not recognize these new
|
|
61 |
instances as being true or false).
|
|
62 |
"
|
|
63 |
! !
|
1
|
64 |
|
|
65 |
!Boolean class methodsFor:'instance creation'!
|
|
66 |
|
|
67 |
basicNew
|
|
68 |
"catch instance creation
|
2
|
69 |
- there must be exactly one instance of each - no more"
|
1
|
70 |
|
|
71 |
self error:'new instances of True/False are not allowed'
|
|
72 |
! !
|
|
73 |
|
3
|
74 |
!Boolean class methodsFor:'queries'!
|
|
75 |
|
|
76 |
isBuiltInClass
|
|
77 |
"this class is known by the run-time-system"
|
|
78 |
|
|
79 |
^ true
|
|
80 |
! !
|
|
81 |
|
422
|
82 |
!Boolean methodsFor:'converting'!
|
|
83 |
|
|
84 |
literalArrayEncoding
|
|
85 |
"encode myself as an array literal."
|
|
86 |
|
|
87 |
^ self
|
|
88 |
|
|
89 |
"Modified: 5.9.1995 / 22:46:57 / claus"
|
|
90 |
! !
|
|
91 |
|
1
|
92 |
!Boolean methodsFor:'copying'!
|
|
93 |
|
159
|
94 |
copy
|
|
95 |
"return a shallow copy of the receiver
|
|
96 |
- since both true and false are unique, return the receiver"
|
|
97 |
|
|
98 |
^ self
|
|
99 |
!
|
|
100 |
|
1
|
101 |
shallowCopy
|
|
102 |
"return a shallow copy of the receiver
|
|
103 |
- since both true and false are unique, return the receiver"
|
|
104 |
|
|
105 |
^ self
|
|
106 |
!
|
|
107 |
|
|
108 |
deepCopy
|
|
109 |
"return a deep copy of the receiver
|
|
110 |
- since both true and false are unique, return the receiver"
|
|
111 |
|
|
112 |
^ self
|
12
|
113 |
!
|
|
114 |
|
|
115 |
deepCopyUsing:aDictionary
|
|
116 |
"return a deep copy of the receiver
|
|
117 |
- since both true and false are unique, return the receiver"
|
|
118 |
|
|
119 |
^ self
|
|
120 |
!
|
|
121 |
|
|
122 |
simpleDeepCopy
|
|
123 |
"return a deep copy of the receiver
|
|
124 |
- since both true and false are unique, return the receiver"
|
|
125 |
|
|
126 |
^ self
|
1
|
127 |
! !
|
|
128 |
|
379
|
129 |
!Boolean methodsFor:'queries'!
|
|
130 |
|
|
131 |
isLiteral
|
|
132 |
"return true, if the receiver can be used as a literal
|
|
133 |
(i.e. can be used in constant arrays)"
|
|
134 |
|
|
135 |
^ true
|
|
136 |
! !
|
|
137 |
|
1
|
138 |
!Boolean methodsFor:'printing & storing'!
|
|
139 |
|
54
|
140 |
printOn:aStream
|
|
141 |
"append a character sequence representing the receiver to the argument,
|
|
142 |
aStream"
|
|
143 |
|
|
144 |
aStream nextPutAll:self printString
|
|
145 |
!
|
|
146 |
|
|
147 |
storeString
|
|
148 |
"return a character sequence to the argument, aStream from which the
|
281
|
149 |
receiver can be reconstructed using readFrom:."
|
54
|
150 |
|
|
151 |
^ self printString
|
|
152 |
!
|
|
153 |
|
1
|
154 |
storeOn:aStream
|
54
|
155 |
"append a character sequence to the argument, aStream from which the
|
281
|
156 |
receiver can be reconstructed using readFrom:."
|
1
|
157 |
|
54
|
158 |
^ self printOn:aStream
|
1
|
159 |
! !
|
2
|
160 |
|
|
161 |
!Boolean methodsFor: 'binary storage'!
|
|
162 |
|
|
163 |
hasSpecialBinaryRepresentation
|
37
|
164 |
"return true, if the receiver has a special binary representation"
|
|
165 |
|
159
|
166 |
^true
|
2
|
167 |
! !
|