Index - All Packages - All Categories - All Classes

Class ScruSet

X++ has three basic kinds of collection classes. Tables, Sets and XuRegions. XuRegions are not-necessarily-discrete collections of positions, and are documented in the space module. Sets and Tables are both discrete and finite, and similar in many ways. Both originate in a three-way type distinction between:

ScruX -- The protocol for examining one. Ie., it is *Scru*table
ImmuX -- The contract guarantees that the set or table you're looking at won't change (though the things it contains may change)
MuX -- Additional protocol for changing it.


Concrete classes may be a subclass of any of the above. It makes sense to have a concrete subclass of ScruX which isn't a subclass of either MuX or ImmuX when, for example, it represents a tracking, filtered view of some other set which is itself changing. All kinds of collection can be iterated over when appropriate using Steppers--our basic iteration abstraction (see Stepper).

Immu's are sort of like Stamps -- they represent a particular state a colection can have. Mu's are sort of like Berts -- they represent a continuing collection identity which can change its current state.

Sets are pure collections--their contents are just a set of Heapers. Sets (as opposed to tables) do not provide any organization of these contents.

Package: Udanax-Gold
All Superclasses: Object Heaper
Immediate Subclasses: ImmuSet MuSet
Protocols: Object
Categories: Xanadu-Collection-Sets

Class Methods

problemsNotInSet



Instance Methods

actualHashForEqual



Overridden by: ImmuSet MuSet

asArray

The elements in the set in an array, in some random order

asImmuSet

Return an immu snapshot of my current state. Should probably be done with a
Converter rather than with a message (for the reasons listed in the Converter
class comment). In terms of the Stamp/Bert analogy mentioned in the class
comment, asImmuSet is like asking for the current Stamp.

Overridden by: ImmuSet MuSet GrandHashSet HashSet

asMuSet

Return a Mu whose initial state is the same as my current state, but which
will now deviate independently of me. In terms of the Stamp/Bert analogy
mentioned in the class comment, asMuSet is like asking for a new Bert starting
on the current Stamp.

Overridden by: ImmuSet EmptyImmuSet ImmuSetOnMu TinyImmuSet MuSet GrandHashSet HashSet

asOrderedCollection

return all of my elements in an ordered collection for smalltalk MVC hacking

contentsEqual: other

Returns whether the two ScruSets have exactly the same set of elements at the moment.
'a->contentsEqual(b)' is equivalent to
'a->asImmuSet()->isEqual(b->asImmuSet())'.

contentsHash

Has the same relationship to contentsEqual that hashForEqual has to isEqual.
Ie., if 'a->contentsEqual (b)', then 'a->contentsHash() == b->contentsHash()'.
The same complex caveats apply as to the stability and portability of the
hash values as apply for hashForEqual.

Overridden by: ActualHashSet

copy

A new one whose initial state is my current state, but that doesn't track
changes. Note that there is no implication that these can be 'destroy'ed
separately, because (for example) an ImmuSet just returns itself

Overrides: Object
Overridden by: ImmuSet MuSet GrandHashSet HashSet ActualHashSet

count

How many elements are currently in the set. Being a set, if the same element is put into the set twice,
it is only in the set once. 'Same' above is according to 'isEqual'.

Overridden by: ImmuSet EmptyImmuSet ImmuSetOnMu TinyImmuSet MuSet GrandHashSet HashSet ActualHashSet

do: aBlock


hasMember: someone

Is someone a member of the set now?

Overridden by: ImmuSet EmptyImmuSet ImmuSetOnMu TinyImmuSet MuSet GrandHashSet HashSet ActualHashSet

inspect



Overrides: Object

intersects: other

tell whether they have any points in common

isEmpty

Whether it currently has any elements

Overridden by: ImmuSet EmptyImmuSet ImmuSetOnMu TinyImmuSet MuSet GrandHashSet HashSet ActualHashSet

isEqual: other



Overridden by: ImmuSet MuSet

isSubsetOf: another

Whether another currently has all my elements

Overridden by: EmptyImmuSet ImmuSetOnMu TinyImmuSet

printOn: oo



Overrides: Object
Overridden by: GrandHashSet

printOnWithSimpleSyntax: oo with: open with: sep with: close



Overridden by: GrandHashSet

printOnWithSyntax: oo with: open with: sep with: close with: fullPrint


stepper

Returns a stepper which will enumerate all the elements of the set in some unspecified order

Overridden by: ImmuSet EmptyImmuSet ImmuSetOnMu TinyImmuSet MuSet GrandHashSet HashSet ActualHashSet

theOne

Iff I contain exactly one member, return it. Otherwise BLAST.
The idea for this message is taken from the THE function of ONTIC
(reference McAllester)

Overridden by: EmptyImmuSet ImmuSetOnMu TinyImmuSet HashSet ActualHashSet


Index - All Packages - All Categories - All Classes