Boolean.st
author Stefan Vogel <sv@exept.de>
Wed, 22 Sep 2004 16:42:22 +0200
changeset 8586 a38e882affa5
parent 8517 c3827ae1ead2
child 8830 df7adfaf1a57
permissions -rw-r--r--
take care of time-wrap in #millisecondsToRun:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     1
"
5
67342904af11 *** empty log message ***
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1988 by Claus Gittinger
159
514c749165c3 *** empty log message ***
claus
parents: 92
diff changeset
     3
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     4
a27a279701f8 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    12
5467
248b61f615c8 General encoding method (#encodeOn:with:)
Stefan Vogel <sv@exept.de>
parents: 4878
diff changeset
    13
"{ Package: 'stx:libbasic' }"
248b61f615c8 General encoding method (#encodeOn:with:)
Stefan Vogel <sv@exept.de>
parents: 4878
diff changeset
    14
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    15
Object subclass:#Boolean
1245
c8afea3d5af0 commentary
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
    16
	instanceVariableNames:''
c8afea3d5af0 commentary
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
    17
	classVariableNames:''
c8afea3d5af0 commentary
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
    18
	poolDictionaries:''
c8afea3d5af0 commentary
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
    19
	category:'Kernel-Objects'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    20
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    21
88
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    22
!Boolean class methodsFor:'documentation'!
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    23
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    24
copyright
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    25
"
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    26
 COPYRIGHT (c) 1988 by Claus Gittinger
159
514c749165c3 *** empty log message ***
claus
parents: 92
diff changeset
    27
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    28
88
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    29
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    30
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    32
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    33
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    34
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    35
"
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    36
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    37
88
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    38
documentation
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    39
"
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    40
    Boolean is an abstract class defining the common protocol for logical
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    41
    values. The logical values are represented by its two subclasses True and False.
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    42
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    43
    There are no instances of Boolean in the system and there is only one
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    44
    instance of True (which is the global true) and one of False (false).
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    45
88
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    46
    Boolean redefines some messages which deal with copying Booleans,
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    47
    to make certain there is only one instance of each.
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    48
    The system will behave strange if you fiddle around here and create
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    49
    new instances of True or False (i.e. it will not recognize these new
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    50
    instances as being true or false).
1294
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
    51
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
    52
    [author:]
4656
aa895a9835a2 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
    53
	Claus Gittinger
88
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    54
"
81dacba7a63a *** empty log message ***
claus
parents: 54
diff changeset
    55
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    56
a27a279701f8 Initial revision
claus
parents:
diff changeset
    57
!Boolean class methodsFor:'instance creation'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    58
a27a279701f8 Initial revision
claus
parents:
diff changeset
    59
basicNew
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
    60
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
    61
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    62
    "catch instance creation
2
claus
parents: 1
diff changeset
    63
     - there must be exactly one instance of each - no more"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    64
a27a279701f8 Initial revision
claus
parents:
diff changeset
    65
    self error:'new instances of True/False are not allowed'
8517
c3827ae1ead2 readFrom fixed.
Claus Gittinger <cg@exept.de>
parents: 8394
diff changeset
    66
!
c3827ae1ead2 readFrom fixed.
Claus Gittinger <cg@exept.de>
parents: 8394
diff changeset
    67
c3827ae1ead2 readFrom fixed.
Claus Gittinger <cg@exept.de>
parents: 8394
diff changeset
    68
readFrom:aStringOrStream onError:exceptionBlock
c3827ae1ead2 readFrom fixed.
Claus Gittinger <cg@exept.de>
parents: 8394
diff changeset
    69
    "return a new Boolean, reading a printed representation from aStringOrStream."
c3827ae1ead2 readFrom fixed.
Claus Gittinger <cg@exept.de>
parents: 8394
diff changeset
    70
c3827ae1ead2 readFrom fixed.
Claus Gittinger <cg@exept.de>
parents: 8394
diff changeset
    71
    |str word|
c3827ae1ead2 readFrom fixed.
Claus Gittinger <cg@exept.de>
parents: 8394
diff changeset
    72
c3827ae1ead2 readFrom fixed.
Claus Gittinger <cg@exept.de>
parents: 8394
diff changeset
    73
    str := aStringOrStream readStream.
c3827ae1ead2 readFrom fixed.
Claus Gittinger <cg@exept.de>
parents: 8394
diff changeset
    74
    str skipSeparators.
c3827ae1ead2 readFrom fixed.
Claus Gittinger <cg@exept.de>
parents: 8394
diff changeset
    75
    word := str nextAlphaNumericWord.
c3827ae1ead2 readFrom fixed.
Claus Gittinger <cg@exept.de>
parents: 8394
diff changeset
    76
    word = 'true' ifTrue:[^ true].
c3827ae1ead2 readFrom fixed.
Claus Gittinger <cg@exept.de>
parents: 8394
diff changeset
    77
    word = 'false' ifTrue:[^ false].
c3827ae1ead2 readFrom fixed.
Claus Gittinger <cg@exept.de>
parents: 8394
diff changeset
    78
    ^ exceptionBlock value.
c3827ae1ead2 readFrom fixed.
Claus Gittinger <cg@exept.de>
parents: 8394
diff changeset
    79
c3827ae1ead2 readFrom fixed.
Claus Gittinger <cg@exept.de>
parents: 8394
diff changeset
    80
    "
c3827ae1ead2 readFrom fixed.
Claus Gittinger <cg@exept.de>
parents: 8394
diff changeset
    81
     Boolean readFrom:'true'      
c3827ae1ead2 readFrom fixed.
Claus Gittinger <cg@exept.de>
parents: 8394
diff changeset
    82
     Boolean readFrom:'false'     
c3827ae1ead2 readFrom fixed.
Claus Gittinger <cg@exept.de>
parents: 8394
diff changeset
    83
     Boolean readFrom:'xxx'  
c3827ae1ead2 readFrom fixed.
Claus Gittinger <cg@exept.de>
parents: 8394
diff changeset
    84
     Boolean readFrom:'  true'     
c3827ae1ead2 readFrom fixed.
Claus Gittinger <cg@exept.de>
parents: 8394
diff changeset
    85
     Boolean readFrom:'  false'    
c3827ae1ead2 readFrom fixed.
Claus Gittinger <cg@exept.de>
parents: 8394
diff changeset
    86
     Boolean readFrom:'true xxx'      
c3827ae1ead2 readFrom fixed.
Claus Gittinger <cg@exept.de>
parents: 8394
diff changeset
    87
     Boolean readFrom:'false xxx'     
c3827ae1ead2 readFrom fixed.
Claus Gittinger <cg@exept.de>
parents: 8394
diff changeset
    88
c3827ae1ead2 readFrom fixed.
Claus Gittinger <cg@exept.de>
parents: 8394
diff changeset
    89
     Boolean readFromString:'true xxx'   
c3827ae1ead2 readFrom fixed.
Claus Gittinger <cg@exept.de>
parents: 8394
diff changeset
    90
     Boolean readFromString:'false xxx'  
c3827ae1ead2 readFrom fixed.
Claus Gittinger <cg@exept.de>
parents: 8394
diff changeset
    91
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    92
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
    93
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
    94
!Boolean class methodsFor:'queries'!
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
    95
4656
aa895a9835a2 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
    96
hasSharedInstances
aa895a9835a2 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
    97
    "return true if this class has shared instances, that is, instances
aa895a9835a2 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
    98
     with the same value are identical.
aa895a9835a2 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
    99
     False is returned here, only redefined in classes which have unified
aa895a9835a2 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   100
     instances (or should be treated so)."
aa895a9835a2 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   101
aa895a9835a2 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   102
    ^ true
aa895a9835a2 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   103
aa895a9835a2 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   104
!
aa895a9835a2 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   105
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   106
isBuiltInClass
1266
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   107
    "return true if this class is known by the run-time-system.
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   108
     Here, true is returned (for my two subclasses)."
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   109
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   110
    ^ true
1266
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   111
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   112
    "Modified: 23.4.1996 / 15:58:22 / cg"
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   113
! !
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   114
698
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   115
!Boolean methodsFor:'binary storage'!
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   116
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   117
hasSpecialBinaryRepresentation
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   118
    "return true, if the receiver has a special binary representation"
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   119
3070
1bf5a29fddc9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2416
diff changeset
   120
    ^ true
698
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   121
! !
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   122
4878
1a64a89d6c01 blocked #onChangeSend:to:
ca
parents: 4728
diff changeset
   123
!Boolean methodsFor:'blocked'!
1a64a89d6c01 blocked #onChangeSend:to:
ca
parents: 4728
diff changeset
   124
1a64a89d6c01 blocked #onChangeSend:to:
ca
parents: 4728
diff changeset
   125
onChangeSend:selector to:someOne
1a64a89d6c01 blocked #onChangeSend:to:
ca
parents: 4728
diff changeset
   126
    "/ not really an error ...
1a64a89d6c01 blocked #onChangeSend:to:
ca
parents: 4728
diff changeset
   127
    "/ self error:'should not be invoked for booleans'
1a64a89d6c01 blocked #onChangeSend:to:
ca
parents: 4728
diff changeset
   128
! !
1a64a89d6c01 blocked #onChangeSend:to:
ca
parents: 4728
diff changeset
   129
422
claus
parents: 384
diff changeset
   130
!Boolean methodsFor:'converting'!
claus
parents: 384
diff changeset
   131
5937
928b9ed64cbb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5825
diff changeset
   132
asBoolean
928b9ed64cbb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5825
diff changeset
   133
    ^ self
928b9ed64cbb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5825
diff changeset
   134
!
928b9ed64cbb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5825
diff changeset
   135
2416
588d5d510c10 literal encodings
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
   136
decodeAsLiteralArray
588d5d510c10 literal encodings
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
   137
    "given a literalEncoding in the receiver,
588d5d510c10 literal encodings
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
   138
     create & return the corresponding object.
588d5d510c10 literal encodings
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
   139
     The inverse operation to #literalArrayEncoding."
588d5d510c10 literal encodings
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
   140
588d5d510c10 literal encodings
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
   141
    ^ self
588d5d510c10 literal encodings
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
   142
588d5d510c10 literal encodings
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
   143
    "Created: 25.2.1997 / 19:16:43 / cg"
588d5d510c10 literal encodings
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
   144
    "Modified: 25.2.1997 / 19:17:45 / cg"
588d5d510c10 literal encodings
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
   145
!
588d5d510c10 literal encodings
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
   146
422
claus
parents: 384
diff changeset
   147
literalArrayEncoding
1245
c8afea3d5af0 commentary
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
   148
    "encode myself as an array literal, from which a copy of the receiver
c8afea3d5af0 commentary
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
   149
     can be reconstructed with #decodeAsLiteralArray."
422
claus
parents: 384
diff changeset
   150
claus
parents: 384
diff changeset
   151
    ^ self
claus
parents: 384
diff changeset
   152
claus
parents: 384
diff changeset
   153
    "Modified: 5.9.1995 / 22:46:57 / claus"
1245
c8afea3d5af0 commentary
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
   154
    "Modified: 22.4.1996 / 13:00:05 / cg"
422
claus
parents: 384
diff changeset
   155
! !
claus
parents: 384
diff changeset
   156
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   157
!Boolean methodsFor:'copying'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   158
159
514c749165c3 *** empty log message ***
claus
parents: 92
diff changeset
   159
copy
514c749165c3 *** empty log message ***
claus
parents: 92
diff changeset
   160
    "return a shallow copy of the receiver
514c749165c3 *** empty log message ***
claus
parents: 92
diff changeset
   161
     - since both true and false are unique, return the receiver"
514c749165c3 *** empty log message ***
claus
parents: 92
diff changeset
   162
514c749165c3 *** empty log message ***
claus
parents: 92
diff changeset
   163
    ^ self
514c749165c3 *** empty log message ***
claus
parents: 92
diff changeset
   164
!
514c749165c3 *** empty log message ***
claus
parents: 92
diff changeset
   165
12
8e03bd717355 *** empty log message ***
claus
parents: 5
diff changeset
   166
deepCopyUsing:aDictionary
8e03bd717355 *** empty log message ***
claus
parents: 5
diff changeset
   167
    "return a deep copy of the receiver
8e03bd717355 *** empty log message ***
claus
parents: 5
diff changeset
   168
     - since both true and false are unique, return the receiver"
8e03bd717355 *** empty log message ***
claus
parents: 5
diff changeset
   169
8e03bd717355 *** empty log message ***
claus
parents: 5
diff changeset
   170
    ^ self
8e03bd717355 *** empty log message ***
claus
parents: 5
diff changeset
   171
!
8e03bd717355 *** empty log message ***
claus
parents: 5
diff changeset
   172
698
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   173
shallowCopy
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   174
    "return a shallow copy of the receiver
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   175
     - since both true and false are unique, return the receiver"
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   176
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   177
    ^ self
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   178
!
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   179
12
8e03bd717355 *** empty log message ***
claus
parents: 5
diff changeset
   180
simpleDeepCopy
8e03bd717355 *** empty log message ***
claus
parents: 5
diff changeset
   181
    "return a deep copy of the receiver
8e03bd717355 *** empty log message ***
claus
parents: 5
diff changeset
   182
     - since both true and false are unique, return the receiver"
8e03bd717355 *** empty log message ***
claus
parents: 5
diff changeset
   183
8e03bd717355 *** empty log message ***
claus
parents: 5
diff changeset
   184
    ^ self
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   185
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   186
698
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   187
!Boolean methodsFor:'printing & storing'!
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   188
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   189
printOn:aStream
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   190
    "append a character sequence representing the receiver to the argument,
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   191
     aStream"
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   192
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   193
    aStream nextPutAll:self printString
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   194
!
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   195
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   196
storeOn:aStream
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   197
    "append a character sequence to the argument, aStream from which the
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   198
     receiver can be reconstructed using readFrom:."
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   199
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   200
    ^ self printOn:aStream
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   201
!
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   202
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   203
storeString
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   204
    "return  a character sequence to the argument, aStream from which the
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   205
     receiver can be reconstructed using readFrom:."
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   206
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   207
    ^ self printString
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   208
! !
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   209
5825
6743e22cd010 Added method isBoolean; need this!
martin
parents: 5467
diff changeset
   210
!Boolean methodsFor:'testing'!
6743e22cd010 Added method isBoolean; need this!
martin
parents: 5467
diff changeset
   211
6743e22cd010 Added method isBoolean; need this!
martin
parents: 5467
diff changeset
   212
isBoolean
6743e22cd010 Added method isBoolean; need this!
martin
parents: 5467
diff changeset
   213
6743e22cd010 Added method isBoolean; need this!
martin
parents: 5467
diff changeset
   214
    "
6743e22cd010 Added method isBoolean; need this!
martin
parents: 5467
diff changeset
   215
    Return true, because it is a boolean.
6743e22cd010 Added method isBoolean; need this!
martin
parents: 5467
diff changeset
   216
    "
6743e22cd010 Added method isBoolean; need this!
martin
parents: 5467
diff changeset
   217
6743e22cd010 Added method isBoolean; need this!
martin
parents: 5467
diff changeset
   218
    ^ true.
8305
7f80b5a18ffc asBoolean for WO
werner
parents: 5937
diff changeset
   219
!
7f80b5a18ffc asBoolean for WO
werner
parents: 5937
diff changeset
   220
7f80b5a18ffc asBoolean for WO
werner
parents: 5937
diff changeset
   221
isLiteral
7f80b5a18ffc asBoolean for WO
werner
parents: 5937
diff changeset
   222
    "return true, if the receiver can be used as a literal constant in ST syntax
7f80b5a18ffc asBoolean for WO
werner
parents: 5937
diff changeset
   223
     (i.e. can be used in constant arrays)"
7f80b5a18ffc asBoolean for WO
werner
parents: 5937
diff changeset
   224
7f80b5a18ffc asBoolean for WO
werner
parents: 5937
diff changeset
   225
    ^ true
5825
6743e22cd010 Added method isBoolean; need this!
martin
parents: 5467
diff changeset
   226
! !
4728
37eaa8241422 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
   227
4656
aa895a9835a2 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   228
!Boolean methodsFor:'tracing'!
aa895a9835a2 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   229
4682
4158042a9c8c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4656
diff changeset
   230
traceInto:aRequestor level:level from:referrer
4656
aa895a9835a2 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   231
    "double dispatch into tracer, passing my type implicitely in the selector"
aa895a9835a2 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   232
4682
4158042a9c8c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4656
diff changeset
   233
    ^ aRequestor traceBoolean:self level:level from:referrer
4656
aa895a9835a2 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   234
aa895a9835a2 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   235
aa895a9835a2 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   236
! !
aa895a9835a2 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   237
8394
da194de43766 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8305
diff changeset
   238
!Boolean methodsFor:'visiting'!
da194de43766 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8305
diff changeset
   239
da194de43766 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8305
diff changeset
   240
acceptVisitor:aVisitor with:aParameter
da194de43766 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8305
diff changeset
   241
da194de43766 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8305
diff changeset
   242
    ^ aVisitor visitBoolean:self with:aParameter
da194de43766 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8305
diff changeset
   243
! !
da194de43766 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8305
diff changeset
   244
698
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   245
!Boolean class methodsFor:'documentation'!
54
06dbdeeed4f9 *** empty log message ***
claus
parents: 37
diff changeset
   246
698
04533375e12c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   247
version
8517
c3827ae1ead2 readFrom fixed.
Claus Gittinger <cg@exept.de>
parents: 8394
diff changeset
   248
    ^ '$Header: /cvs/stx/stx/libbasic/Boolean.st,v 1.32 2004-09-03 17:11:36 cg Exp $'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   249
! !