org.abora.gold.collection.sets
Class ScruSet

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

public class ScruSet
extends Heaper

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. I.e., 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.


Field Summary
 
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
ScruSet()
           
 
Method Summary
 int actualHashForEqual()
           
 PtrArray asArray()
          The elements in the set in an array, in some random order
 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.
 void asOrderedCollection()
          return all of my elements in an ordered collection for smalltalk MVC hacking
 boolean contentsEqual(ScruSet 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())'.
 int contentsHash()
          Has the same relationship to contentsEqual that hashForEqual has to isEqual.
I.e., 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.
 ScruSet copy()
          A new one whose initial state is my current state, but that doesn't track
changes.
 IntegerVar count()
          How many elements are currently in the set.
 void dox(BlockClosure aBlock)
           
 boolean hasMember(Heaper someone)
          Is someone a member of the set now?
 void inspect()
           
 boolean intersects(ScruSet other)
          tell whether they have any points in common
 boolean isEmpty()
          Whether it currently has any elements
 boolean isEqual(Heaper other)
          Return true if the two objects are equal.
 boolean isSubsetOf(ScruSet another)
          Whether another currently has all my elements
 void printOn(java.io.PrintWriter oo)
           
 void printOnWithSimpleSyntax(java.io.PrintWriter oo, java.lang.String open, java.lang.String sep, java.lang.String close)
           
 void printOnWithSyntax(java.io.PrintWriter oo, java.lang.String open, java.lang.String sep, java.lang.String close, boolean fullPrint)
          For example, if we have the set '{a, b, c}' and we print it with
'p->printOnWithSyntax(oo,
static void problems()
          A ProblemList for all X++ BLASTs
 Stepper stepper()
          Returns a stepper which will enumerate all the elements of the set in some unspecified
order
 Heaper theOne()
          Iff I contain exactly one member, return it.
 
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, 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, linkTimeNonInherited, make, 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
 

Constructor Detail

ScruSet

public ScruSet()
Method Detail

actualHashForEqual

public int actualHashForEqual()
Overrides:
actualHashForEqual in class Heaper

contentsEqual

public boolean contentsEqual(ScruSet 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

public int contentsHash()
Has the same relationship to contentsEqual that hashForEqual has to isEqual.
I.e., 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.


hasMember

public boolean hasMember(Heaper someone)
Is someone a member of the set now?


intersects

public boolean intersects(ScruSet other)
tell whether they have any points in common


isEmpty

public boolean isEmpty()
Whether it currently has any elements


isEqual

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

Overrides:
isEqual in class Heaper

isSubsetOf

public boolean isSubsetOf(ScruSet another)
Whether another currently has all my elements


copy

public ScruSet 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


asArray

public PtrArray asArray()
The elements in the set in an array, in some random order


asImmuSet

public ImmuSet 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.


asMuSet

public MuSet 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.


printOn

public void printOn(java.io.PrintWriter oo)
Overrides:
printOn in class Heaper

printOnWithSimpleSyntax

public void printOnWithSimpleSyntax(java.io.PrintWriter oo,
                                    java.lang.String open,
                                    java.lang.String sep,
                                    java.lang.String close)

printOnWithSyntax

public void printOnWithSyntax(java.io.PrintWriter oo,
                              java.lang.String open,
                              java.lang.String sep,
                              java.lang.String close,
                              boolean fullPrint)
For example, if we have the set '{a, b, c}' and we print it with
'p->printOnWithSyntax(oo,


count

public IntegerVar 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'.


stepper

public Stepper stepper()
Returns a stepper which will enumerate all the elements of the set in some unspecified
order


theOne

public Heaper 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)


inspect

public void inspect()
Overrides:
inspect in class AboraHeaper

asOrderedCollection

public void asOrderedCollection()
return all of my elements in an ordered collection for smalltalk MVC hacking


dox

public void dox(BlockClosure aBlock)

problems

public static void problems()
Description copied from class: Heaper
A ProblemList for all X++ BLASTs



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