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