author | Claus Gittinger <cg@exept.de> |
Sat, 11 Nov 1995 16:28:41 +0100 | |
changeset 530 | 07d0bce293c9 |
parent 528 | a083413dfbe8 |
child 698 | 04533375e12c |
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 |
|
14 |
instanceVariableNames:'' |
|
15 |
classVariableNames:'' |
|
16 |
poolDictionaries:'' |
|
17 |
category:'Kernel-Objects' |
|
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 |
version |
528
a083413dfbe8
converted version methods from comment-only to returning-a-string
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
37 |
^ '$Header: /cvs/stx/stx/libbasic/Boolean.st,v 1.15 1995-11-11 14:27:17 cg Exp $' |
88 | 38 |
! |
1 | 39 |
|
88 | 40 |
documentation |
41 |
" |
|
42 |
Boolean is an abstract class defining the common protocol for logical |
|
43 |
values. The logical values are represented by its two subclasses True and False. |
|
44 |
||
45 |
There are no instances of Boolean in the system and there is only one |
|
46 |
instance of True (which is the global true) and one of False (false). |
|
1 | 47 |
|
88 | 48 |
Boolean redefines some messages which deal with copying Booleans, |
49 |
to make certain there is only one instance of each. |
|
50 |
The system will behave strange if you fiddle around here and create |
|
51 |
new instances of True or False (i.e. it will not recognize these new |
|
52 |
instances as being true or false). |
|
53 |
" |
|
54 |
! ! |
|
1 | 55 |
|
56 |
!Boolean class methodsFor:'instance creation'! |
|
57 |
||
58 |
basicNew |
|
59 |
"catch instance creation |
|
2 | 60 |
- there must be exactly one instance of each - no more" |
1 | 61 |
|
62 |
self error:'new instances of True/False are not allowed' |
|
63 |
! ! |
|
64 |
||
3 | 65 |
!Boolean class methodsFor:'queries'! |
66 |
||
67 |
isBuiltInClass |
|
68 |
"this class is known by the run-time-system" |
|
69 |
||
70 |
^ true |
|
71 |
! ! |
|
72 |
||
422 | 73 |
!Boolean methodsFor:'converting'! |
74 |
||
75 |
literalArrayEncoding |
|
76 |
"encode myself as an array literal." |
|
77 |
||
78 |
^ self |
|
79 |
||
80 |
"Modified: 5.9.1995 / 22:46:57 / claus" |
|
81 |
! ! |
|
82 |
||
1 | 83 |
!Boolean methodsFor:'copying'! |
84 |
||
159 | 85 |
copy |
86 |
"return a shallow copy of the receiver |
|
87 |
- since both true and false are unique, return the receiver" |
|
88 |
||
89 |
^ self |
|
90 |
! |
|
91 |
||
1 | 92 |
shallowCopy |
93 |
"return a shallow copy of the receiver |
|
94 |
- since both true and false are unique, return the receiver" |
|
95 |
||
96 |
^ self |
|
97 |
! |
|
98 |
||
99 |
deepCopy |
|
100 |
"return a deep copy of the receiver |
|
101 |
- since both true and false are unique, return the receiver" |
|
102 |
||
103 |
^ self |
|
12 | 104 |
! |
105 |
||
106 |
deepCopyUsing:aDictionary |
|
107 |
"return a deep copy of the receiver |
|
108 |
- since both true and false are unique, return the receiver" |
|
109 |
||
110 |
^ self |
|
111 |
! |
|
112 |
||
113 |
simpleDeepCopy |
|
114 |
"return a deep copy of the receiver |
|
115 |
- since both true and false are unique, return the receiver" |
|
116 |
||
117 |
^ self |
|
1 | 118 |
! ! |
119 |
||
379 | 120 |
!Boolean methodsFor:'queries'! |
121 |
||
122 |
isLiteral |
|
123 |
"return true, if the receiver can be used as a literal |
|
124 |
(i.e. can be used in constant arrays)" |
|
125 |
||
126 |
^ true |
|
127 |
! ! |
|
128 |
||
1 | 129 |
!Boolean methodsFor:'printing & storing'! |
130 |
||
54 | 131 |
printOn:aStream |
132 |
"append a character sequence representing the receiver to the argument, |
|
133 |
aStream" |
|
134 |
||
135 |
aStream nextPutAll:self printString |
|
136 |
! |
|
137 |
||
138 |
storeString |
|
139 |
"return a character sequence to the argument, aStream from which the |
|
281 | 140 |
receiver can be reconstructed using readFrom:." |
54 | 141 |
|
142 |
^ self printString |
|
143 |
! |
|
144 |
||
1 | 145 |
storeOn:aStream |
54 | 146 |
"append a character sequence to the argument, aStream from which the |
281 | 147 |
receiver can be reconstructed using readFrom:." |
1 | 148 |
|
54 | 149 |
^ self printOn:aStream |
1 | 150 |
! ! |
2 | 151 |
|
152 |
!Boolean methodsFor: 'binary storage'! |
|
153 |
||
154 |
hasSpecialBinaryRepresentation |
|
37 | 155 |
"return true, if the receiver has a special binary representation" |
156 |
||
159 | 157 |
^true |
2 | 158 |
! ! |