eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'Boolean':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: Boolean


Inheritance:

   Object
   |
   +--Boolean
      |
      +--False
      |
      +--True

Package:
stx:libbasic
Category:
Kernel-Objects
Version:
rev: 1.44 date: 2015/11/18 12:17:52
user: cg
file: Boolean.st directory: libbasic
module: stx stc-classLibrary: libbasic
Author:
Claus Gittinger

Description:


Boolean is an abstract class defining the common protocol for logical
values. The logical values are represented by its two subclasses True and False.

There are no instances of Boolean in the system and there is only one
instance of True (which is the global true) and one of False (false).

Boolean redefines some messages which deal with copying Booleans,
to make certain there is only one instance of each.
The system will behave strange if you fiddle around here and create
new instances of True or False (i.e. it will not recognize these new
instances as being true or false).


Class protocol:

instance creation
o  basicNew
catch instance creation
- there must be exactly one instance of each - no more

o  readFrom: aStringOrStream onError: exceptionBlock
return a new Boolean, reading a printed representation from aStringOrStream.

usage example(s):

     Boolean readFrom:'true'      
     Boolean readFrom:'false'     
     Boolean readFrom:'xxx'  
     Boolean readFrom:'  true'     
     Boolean readFrom:'  false'    
     Boolean readFrom:'true xxx'      
     Boolean readFrom:'false xxx'     

     Boolean readFromString:'true xxx'   
     Boolean readFromString:'false xxx'  

queries
o  hasSharedInstances
return true if this class has shared instances, that is, instances
with the same value are identical.
True returned here - there is only one true and only one false.

o  isAbstract

o  isBuiltInClass
return true if this class is known by the run-time-system.
Here, true is returned (for my two subclasses).


Instance protocol:

Javascript support
o  js_asBoolean
( an extension from the stx:libjavascript package )

o  typeof
( an extension from the stx:libjavascript package )
return a string describing what I am

usage example(s):

     JavaScriptParser
	evaluate:'''hello''.typeof()'

     JavaScriptParser
	evaluate:'false.typeof();'

blocked
o  addDependent: someOne
not really an error ...

o  onChangeSend: selector to: someOne
not really an error ...

converting
o  asBoolean

o  literalArrayEncoding
encode myself as an array literal, from which a copy of the receiver
can be reconstructed with #decodeAsLiteralArray.

copying
o  copy
return a shallow copy of the receiver
- since both true and false are unique, return the receiver

o  deepCopyUsing: aDictionary postCopySelector: postCopySelector
return a deep copy of the receiver
- since both true and false are unique, return the receiver

o  shallowCopy
return a shallow copy of the receiver
- since both true and false are unique, return the receiver

o  simpleDeepCopy
return a deep copy of the receiver
- since both true and false are unique, return the receiver

inspecting
o  inspectorValueStringInListFor: anInspector
( an extension from the stx:libtool package )
returns a string to be shown in the inspector's selection list

printing & storing
o  printOn: aStream
append a character sequence representing the receiver to the argument, aStream

o  storeOn: aStream
append a character sequence to the argument, aStream from which the
receiver can be reconstructed using readFrom:.

o  storeString
return a character sequence to the argument, aStream from which the
receiver can be reconstructed using readFrom:.

testing
o  isBoolean
Return true, because it is a boolean.

o  isLiteral
return true, if the receiver can be used as a literal constant in ST syntax
(i.e. can be used in constant arrays)

tracing
o  traceInto: aRequestor level: level from: referrer
double dispatch into tracer, passing my type implicitely in the selector

visiting
o  acceptVisitor: aVisitor with: aParameter
dispatch for visitor pattern; send #visitBoolean:with: to aVisitor



ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Sat, 20 Apr 2024 10:01:10 GMT