|
Class: CharacterSet
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
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.
copyrightCOPYRIGHT (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.
instance creation
-
allSingleByteCharacters
-
return a new character set, which contains all single-byte characters
-
empty
-
return a new, empty character set
-
new
-
return a new, empty character set
-
nonSeparators
-
return a new character set, which contains any but whitespace characters
-
separators
-
return a new character set, which contains all whitespace characters
accessing
-
byteArrayMap
-
adding & removing
-
add: aCharacter
-
add aCharacter to the collection.
Returns aCharacter (sigh)
-
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
-
= 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.
-
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
-
postCopy
-
make sure that the bitmap is not shared with the copy
initialization
-
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)))
-
initialize
-
empty
-
setByteArrayMap: aByteArray
-
queries
-
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.)
-
includes: aCharacter
-
Return true if the set contains aCharacter
-
size
-
(comment from inherited method)
return the number of elements in the receiver.
This is usually redefined in subclasses for more performance.
set operations
-
complement
-
return a character set containing all characters (from codepoint 0 to 255),
which are NOT included in the receiver
|