author | Claus Gittinger <cg@exept.de> |
Fri, 24 Jan 1997 23:11:36 +0100 | |
changeset 2262 | 4c4d810f006f |
parent 1294 | e26bbb61f6b2 |
child 2416 | 588d5d510c10 |
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). |
|
1294 | 49 |
|
50 |
[author:] |
|
51 |
Claus Gittinger |
|
88 | 52 |
" |
53 |
! ! |
|
1 | 54 |
|
55 |
!Boolean class methodsFor:'instance creation'! |
|
56 |
||
57 |
basicNew |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
698
diff
changeset
|
58 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
698
diff
changeset
|
59 |
|
1 | 60 |
"catch instance creation |
2 | 61 |
- there must be exactly one instance of each - no more" |
1 | 62 |
|
63 |
self error:'new instances of True/False are not allowed' |
|
64 |
! ! |
|
65 |
||
3 | 66 |
!Boolean class methodsFor:'queries'! |
67 |
||
68 |
isBuiltInClass |
|
1266 | 69 |
"return true if this class is known by the run-time-system. |
70 |
Here, true is returned (for my two subclasses)." |
|
3 | 71 |
|
72 |
^ true |
|
1266 | 73 |
|
74 |
"Modified: 23.4.1996 / 15:58:22 / cg" |
|
3 | 75 |
! ! |
76 |
||
698 | 77 |
!Boolean methodsFor:'binary storage'! |
78 |
||
79 |
hasSpecialBinaryRepresentation |
|
80 |
"return true, if the receiver has a special binary representation" |
|
81 |
||
82 |
^true |
|
83 |
! ! |
|
84 |
||
422 | 85 |
!Boolean methodsFor:'converting'! |
86 |
||
87 |
literalArrayEncoding |
|
1245 | 88 |
"encode myself as an array literal, from which a copy of the receiver |
89 |
can be reconstructed with #decodeAsLiteralArray." |
|
422 | 90 |
|
91 |
^ self |
|
92 |
||
93 |
"Modified: 5.9.1995 / 22:46:57 / claus" |
|
1245 | 94 |
"Modified: 22.4.1996 / 13:00:05 / cg" |
422 | 95 |
! ! |
96 |
||
1 | 97 |
!Boolean methodsFor:'copying'! |
98 |
||
159 | 99 |
copy |
100 |
"return a shallow copy of the receiver |
|
101 |
- since both true and false are unique, return the receiver" |
|
102 |
||
103 |
^ self |
|
104 |
! |
|
105 |
||
1 | 106 |
deepCopy |
107 |
"return a deep copy of the receiver |
|
108 |
- since both true and false are unique, return the receiver" |
|
109 |
||
110 |
^ self |
|
12 | 111 |
! |
112 |
||
113 |
deepCopyUsing:aDictionary |
|
114 |
"return a deep copy of the receiver |
|
115 |
- since both true and false are unique, return the receiver" |
|
116 |
||
117 |
^ self |
|
118 |
! |
|
119 |
||
698 | 120 |
shallowCopy |
121 |
"return a shallow copy of the receiver |
|
122 |
- since both true and false are unique, return the receiver" |
|
123 |
||
124 |
^ self |
|
125 |
! |
|
126 |
||
12 | 127 |
simpleDeepCopy |
128 |
"return a deep copy of the receiver |
|
129 |
- since both true and false are unique, return the receiver" |
|
130 |
||
131 |
^ self |
|
1 | 132 |
! ! |
133 |
||
698 | 134 |
!Boolean methodsFor:'printing & storing'! |
135 |
||
136 |
printOn:aStream |
|
137 |
"append a character sequence representing the receiver to the argument, |
|
138 |
aStream" |
|
139 |
||
140 |
aStream nextPutAll:self printString |
|
141 |
! |
|
142 |
||
143 |
storeOn:aStream |
|
144 |
"append a character sequence to the argument, aStream from which the |
|
145 |
receiver can be reconstructed using readFrom:." |
|
146 |
||
147 |
^ self printOn:aStream |
|
148 |
! |
|
149 |
||
150 |
storeString |
|
151 |
"return a character sequence to the argument, aStream from which the |
|
152 |
receiver can be reconstructed using readFrom:." |
|
153 |
||
154 |
^ self printString |
|
155 |
! ! |
|
156 |
||
379 | 157 |
!Boolean methodsFor:'queries'! |
158 |
||
159 |
isLiteral |
|
160 |
"return true, if the receiver can be used as a literal |
|
161 |
(i.e. can be used in constant arrays)" |
|
162 |
||
163 |
^ true |
|
164 |
! ! |
|
165 |
||
698 | 166 |
!Boolean class methodsFor:'documentation'! |
54 | 167 |
|
698 | 168 |
version |
1294 | 169 |
^ '$Header: /cvs/stx/stx/libbasic/Boolean.st,v 1.20 1996-04-25 16:52:01 cg Exp $' |
1 | 170 |
! ! |