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.54 date: 2023/11/22 11:10:46
user: cg
file: Boolean.st directory: libbasic
module: stx stc-classLibrary: libbasic

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).

copyright

COPYRIGHT (c) 1988 by Claus Gittinger All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

Class protocol:

Javascript support
o  js_new: argument
( an extension from the stx:libjavascript package )
redefined JS-new, for compatibility i.e. allow new Boolean(arg)

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 can share instances when stored binary,
that is, instances with the same value can be stored by reference.
True returned here - there is only one true and only one false.

o  isAbstract
Return if this class is an abstract class.
True is returned here for myself only; false for subclasses.
Abstract subclasses must redefine this again.

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  js_typeof
( an extension from the stx:libjavascript package )
return a string describing what I am

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

o  onChangeSend: selector to: someOne
It doesn't make sense to add dependents to a constant; will never change.
Silently ignore ...

converting
o  asBoolean

o  asBooleanValue
( an extension from the stx:libview2 package )
return a valueHolder for the receiver.

o  asBooleanValueWithDependent: aDependent
( an extension from the stx:libview2 package )
return a valueHolder for the receiver,
and make aDependent dependent of it

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.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Fri, 13 Dec 2024 15:33:40 GMT