org.abora.gold.collection.sets
Class ImmuSet

java.lang.Object
  |
  +--org.abora.gold.java.AboraHeaper
        |
        +--org.abora.gold.xpp.basic.Heaper
              |
              +--org.abora.gold.collection.sets.ScruSet
                    |
                    +--org.abora.gold.collection.sets.ImmuSet
Direct Known Subclasses:
EmptyImmuSet, ImmuSetOnMu, TinyImmuSet

public class ImmuSet
extends ScruSet

ImmuSets are ScruSets which are guaranteed never to change. ImmuSets correspond to the
mathematical notion of a finite set of elements, except of course that here the elements
can be any valid X++ object. Just like mathematical sets, two are equal (according to
isEqual) iff they have the same elements. Just because the set cannot change, that
doesn''t prevent any of the members from undergoing state change.
ImmuSets implement some additional protocol to make new sets out of old ones according to
the familiar set theoretic operators (like intersect). XuRegions are much like ImmuSets
of Positions except that they aren''t necessarily finite or even enumerable. XuRegions
implement a similar protocol, but aren''t polymorphic with ImmuSets.


Field Summary
protected static ImmuSet EmptySet
           
 
Fields inherited from class org.abora.gold.xpp.basic.Heaper
AllBlasts, BecomeMap, GarbageCount, InGC, InitializedClasses, InitializingClasses, LastMemory, NextClientRequestNumber, NotOneElementSignal, PackageTable, PromiseNameTable, StringHashSBoxes
 
Fields inherited from class org.abora.gold.java.AboraHeaper
ActiveClubs, CurrentAuthor, CurrentBertCanopyCache, CurrentBertCrum, CurrentChunk, CurrentGrandMap, CurrentKeyMaster, CurrentPacker, CurrentSensorCanopyCache, CurrentServer, CurrentSession, CurrentSessions, CurrentTrace, InitialEditClub, InitialOwner, InitialReadClub, InitialSponsor, InsideTransactionFlag
 
Constructor Summary
ImmuSet()
           
 
Method Summary
 int actualHashForEqual()
           
 ImmuSet asImmuSet()
          Return an immu snapshot of my current state.
 MuSet asMuSet()
          Return a Mu whose initial state is the same as my current state, but which
will now deviate independently of me.
 ScruSet copy()
          don't need to actually make a copy, as this is immutable
 IntegerVar count()
          How many elements are currently in the set.
static void create(java.lang.Object ms)
          Create the frame and call the constructor defined for instances.
static ImmuSet from(MuSet set)
          This is for ImmuSet subclasses to produce results from temporary MuSets.
The difference between this and ImmuSet make.MuSet: is that this doesn't make a copy
of the MuSet when making an ImmuSetOnMu.
 boolean hasMember(Heaper someone)
          Is someone a member of the set now?
static void initTimeNonInherited()
           
 ImmuSet intersect(ScruSet another)
          Regular set intersection.
 boolean isEmpty()
          Whether it currently has any elements
 boolean isEqual(Heaper other)
          Return true if the two objects are equal.
static void linkTimeNonInherited()
           
static Heaper make()
           
static Heaper make(Heaper aSingleton)
           
static Heaper make(MuSet set)
           
static Heaper make(java.lang.Object thing)
           
 ImmuSet minus(ScruSet another)
          Return an ImmuSet containing those of my members which aren't members of 'another'
static ImmuSet newWith(Heaper value)
          A single element ImmuSet
 Stepper stepper()
          Returns a stepper which will enumerate all the elements of the set in some unspecified
order
 ImmuSet unionWith(ScruSet another)
          Return an ImmuSet containing those objects with are members of either of us
 ImmuSet with(Heaper anElement)
          'set->with (anElement)' means the same as 'set->unionWith (immuSet (anElement))'.
It returns an ImmuSet with all my members and having anElement as a member.
If anElement is a member of me, then the result is identical to me.
 ImmuSet without(Heaper anElement)
          'set->without (anElement)' means the same as 'set->minus (immuSet (anElement))'.
It returns an ImmuSet with all my members except anElement.
 
Methods inherited from class org.abora.gold.collection.sets.ScruSet
asArray, asOrderedCollection, contentsEqual, contentsHash, dox, inspect, intersects, isSubsetOf, printOn, printOnWithSimpleSyntax, printOnWithSyntax, problems, theOne
 
Methods inherited from class org.abora.gold.xpp.basic.Heaper
abstractDeclarationFor, abstractTypeFor, addMethodAttributeToInOf, addPackage, addPackageCategory, allClientProtocolOn, argumentTypesFor, arrow, blast, blast, BLAST, cachePromiseNameTable, cachePromiseNameTableIn, canYouBecome, cast, cleanPromiseClasses, cleanupGarbage, clientClassesDo, clientFunctionsOn, clientMethodsOn, clientProtocol, clientProtocolDo, clientProtocolOn, clientProtocolOn, collectibleClasses, compare, compileClientSubclasses, compileConstantPromiseMethods, compileCreateFromRcvr, compileEQ, compileGeneratedClassMethod, compileGeneratedMethod, compileHook, compilePromise, compilePromiseDefaultMethods, compilePromiseFluidDeclarations, compilePromiseHandlers, compilePromiseMethods, compileRequestCreateMsgInArguments, compileRequestEvaluateMsgInReturningArguments, compileRPCSpecialistEvaluateMsgForReturningArguments, compileSendSelfTo, compileSendSelfToSendHook, compileStubbleMethods, compileSubclassStubbleMethods, computeMangle, computePreorder, constantTypeValue, convert, convertCopyDeclarations, convertDeferredDeclarations, convertProxyDeclarations, convertSubclassCopyDeclarations, convertSubclassDeferredDeclarations, convertSubclassProxyDeclarations, copyReferencesToType, create, create, create, create, create, create, create, create, create, createRequestClassArguments, definesProxyMethods, delete, deref, destroy, destruct, destructor, enum, enumFlags, equals, exportName, fetchAttribute, fetchPackage, fetchSuperCategory, fileOutClientProtocol, findCategory, findSenderAndReceiverMethods, findTailInto, flushPromiseNameTable, foo, freezeClientClasses, freezeClientProtocol, freezeStProtocol, frozenClasses, garbageCollect, garbageCollectFrom, gcOpportunity, gcOpportunity, generatedCategory, generatePromiseNames, getCategory, getOrMakePackage, getSuperCategory, handlerSignaturesFrom, hash, hashForEqual, hasProxyMethods, info_clientClasses, info_clientSideClasses, info_promiseClasses, info_stProtocol, inGC, initializedClasses, initializingClasses, initPackages, initStringHashSBoxes, inspectPieces, instanceSize, IntegerVar, isByProxy, isConstructed, isDestructed, isEqualOrSubclassOf, isGenerated, isIntType, isKindOf, isRawType, isUnlocked, makeClassTable, makeFillTable, makeRequestTable, mangle, markChildren, markCount, markInstances, mayBecome, mayBecomeAnySubclassOf, new1, newX, nonCopyVariables, notWorking, pack, packageClasses, packagingCategory, parseExportName, passe, pointerToStaticMember, pointerToStaticMember, pointerToVirtualMember, preorderMax, preorderNumber, PROBLEM, promiseClass, promiseDefaultValue, promiseName, promiseNameTable, promiseToAbstract, registerPackageCategory, removeGeneratedCode, removeStubbleMethods, removeSubclassGeneratedCode, removeSubclassStubbleMethods, requestProcedure, requestProceduresFrom, returnTypeFor, rootName, scheduleTermination, sendProxyTo, sendSelfTo, serverNameFor, setGC, signal, signals, smalltalkSelector, stClientProtocol, stubbleSelectorTokenReturnsArguments, subclassNonCopyVariables, takeOop, togglePromiseName, togglePromiseOfParse, unimplemented, unmangle, verifyFreeze, wipeStubble
 
Methods inherited from class org.abora.gold.java.AboraHeaper
asOop, basicInspect, displayString, error, hack, halt, knownBug, mightNotImplement, REQUIRES, shouldImplement, shouldNotImplement, stubbleForSubclassResponsibility, thingToDo, willNotImplement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EmptySet

protected static ImmuSet EmptySet
Constructor Detail

ImmuSet

public ImmuSet()
Method Detail

hasMember

public boolean hasMember(Heaper someone)
Description copied from class: ScruSet
Is someone a member of the set now?

Overrides:
hasMember in class ScruSet

isEmpty

public boolean isEmpty()
Description copied from class: ScruSet
Whether it currently has any elements

Overrides:
isEmpty in class ScruSet

intersect

public ImmuSet intersect(ScruSet another)
Regular set intersection. Return an ImmuSet containing only those objects which are
members of
both sets


minus

public ImmuSet minus(ScruSet another)
Return an ImmuSet containing those of my members which aren't members of 'another'


unionWith

public ImmuSet unionWith(ScruSet another)
Return an ImmuSet containing those objects with are members of either of us


with

public ImmuSet with(Heaper anElement)
'set->with (anElement)' means the same as 'set->unionWith (immuSet (anElement))'.
It returns an ImmuSet with all my members and having anElement as a member.
If anElement is a member of me, then the result is identical to me.


without

public ImmuSet without(Heaper anElement)
'set->without (anElement)' means the same as 'set->minus (immuSet (anElement))'.
It returns an ImmuSet with all my members except anElement. If anElement isn't already a
member,
then the result is identical to me.


copy

public ScruSet copy()
don't need to actually make a copy, as this is immutable

Overrides:
copy in class ScruSet

asImmuSet

public ImmuSet asImmuSet()
Description copied from class: ScruSet
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.

Overrides:
asImmuSet in class ScruSet

asMuSet

public MuSet asMuSet()
Description copied from class: ScruSet
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.

Overrides:
asMuSet in class ScruSet

count

public IntegerVar count()
Description copied from class: ScruSet
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'.

Overrides:
count in class ScruSet

stepper

public Stepper stepper()
Description copied from class: ScruSet
Returns a stepper which will enumerate all the elements of the set in some unspecified
order

Overrides:
stepper in class ScruSet

actualHashForEqual

public int actualHashForEqual()
Overrides:
actualHashForEqual in class ScruSet

isEqual

public boolean isEqual(Heaper other)
Description copied from class: Heaper
Return true if the two objects are equal.

Overrides:
isEqual in class ScruSet

create

public static void create(java.lang.Object ms)
Description copied from class: Heaper
Create the frame and call the constructor defined for instances.


make

public static Heaper make(java.lang.Object thing)

from

public static ImmuSet from(MuSet set)
This is for ImmuSet subclasses to produce results from temporary MuSets.
The difference between this and ImmuSet make.MuSet: is that this doesn't make a copy
of the MuSet when making an ImmuSetOnMu.


make

public static Heaper make()

make

public static Heaper make(MuSet set)

newWith

public static ImmuSet newWith(Heaper value)
A single element ImmuSet


initTimeNonInherited

public static void initTimeNonInherited()

linkTimeNonInherited

public static void linkTimeNonInherited()

make

public static Heaper make(Heaper aSingleton)


Translation - Copyright © 2003 David G Jones. All Rights Reserved.
Original Udanax-Gold - Copyright © 1979-1999 Udanax.com. All rights reserved.