eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'CharacterSet':

Home

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

Class: CharacterSet


Inheritance:

   Object
   |
   +--Collection
      |
      +--CharacterSet

Package:
stx:libbasic2
Category:
Collections-Unordered
Version:
rev: 1.8 date: 2021/06/20 11:38:56
user: cg
file: CharacterSet.st directory: libbasic2
module: stx stc-classLibrary: libbasic2

Description:


Used to represent 8-bit character sets (for now) as a bitmap.
Bit[n] is set, if Character codePoint:(n-1) is included in the set.

copyright

COPYRIGHT (c) 2011 by eXept Software AG 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:

instance creation
o  allSingleByteCharacters
return a new character set, which contains all single-byte characters

o  empty
return a new, empty character set

o  new
return a new, empty character set

o  nonSeparators
return a new character set, which contains any but whitespace characters

o  separators
return a new character set, which contains all whitespace characters


Instance protocol:

accessing
o  byteArrayMap

adding & removing
o  add: aCharacter
add aCharacter to the collection.
Returns aCharacter (sigh)

o  remove: aCharacter ifAbsent: exceptionValue
(comment from inherited method)
search for the first element, which is equal to anObject;
if found, remove and return it.
If not found, return the value of the exceptionBlock.
Uses equality compare (=) to search for the occurrence.
An error is raised here - it is to be implemented by a concrete subclass.

comparing
o  = something
(comment from inherited method)
return true if the receiver and the arg have the same structure.
Notice:
This method is partially open coded (inlined) by the compiler(s)
identical objects are always considered equal.
redefining it may not work as expected.

o  hash
(comment from inherited method)
return an Integer useful as a hash key for the receiver.
This hash should return same values for objects with same
contents (i.e. use this to hash on structure)

copying-private
o  postCopy
make sure that the bitmap is not shared with the copy

initialization
o  addAllSingleByteCharacters
self assert:(
CharacterSet new addAllCharacters
includesAll:((Character value:0) to:(Character value:255)))

self assert:(
CharacterSet allCharacters
includesAll:((Character value:0) to:(Character value:255)))

o  initialize
empty

o  setByteArrayMap: aByteArray

queries
o  do: aBlock
(comment from inherited method)
evaluate the argument, aBlock for each element.
Return the receiver
(subclasses should care to also return the receiver,
in case do: is used in a chain of messages.)

o  includes: aCharacter
Return true if the set contains aCharacter

o  size
(comment from inherited method)
return the number of elements in the receiver.
This is usually redefined in subclasses for more performance.

set operations
o  complement
return a character set containing all characters (from codepoint 0 to 255),
which are NOT included in the receiver



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Wed, 08 May 2024 21:07:24 GMT