Squeak Class Documentation category index | class index  
 
CharacterSet
  category: Collections-Text
  superclass: Collection
  subclasses:

A set of characters. Lookups for inclusion are very fast.

instance methods
  collection ops
  add:
do:
includes:
remove:

  comparison
  =
hash
species

  conversion
  complement

  private
  byteArrayMap
initialize

class methods
  instance creation
  allCharacters
empty
new
newFrom:
nonSeparators
separators

instance methods
  collection ops top  
 

add:

Include newObject as one of the receiver's elements. Answer newObject.
ArrayedCollections cannot respond to this message.


 

do:

evaluate aBlock with each character in the set


 

includes:

Answer whether anObject is one of the receiver's elements.


 

remove:

Remove oldObject from the receiver's elements. Answer oldObject
unless no element is equal to oldObject, in which case, raise an error.
ArrayedCollections cannot respond to this message.


  comparison top  
 

=

Answer whether the receiver and the argument represent the same
object. If = is redefined in any subclass, consider also redefining the
message hash.


 

hash

Answer an integer hash value for the receiver such that,
-- the hash value of an unchanged object is constant over time, and
-- two equal objects have equal hash values


 

species

Answer the preferred class for reconstructing the receiver. For example,
collections create new collections whenever enumeration messages such as
collect: or select: are invoked. The new kind of collection is determined by
the species of the original collection. Species and class are not always the
same. For example, the species of Interval is Array.


  conversion top  
 

complement

return a character set containing precisely the characters the receiver does not


  private top  
 

byteArrayMap

return a ByteArray mapping each ascii value to a 1 if that ascii value is in the set, and a 0 if it isn't. Intended for use by primitives only


 

initialize


class methods
  instance creation top  
 

allCharacters

return a set containing all characters


 

empty

return an empty set of characters


 

new

Answer a new instance of the receiver (which is a class) with no indexable variables. Fail if the class is indexable.


 

newFrom:

Create an object that has similar contents to aSimilarObject.
If the classes have any instance varaibles with the same names, copy them across.
If this is bad for a class, override this method.


 

nonSeparators

return a set containing everything but the whitespace characters


 

separators

return a set containing just the whitespace characters