org.abora.gold.spaces.cross
Class PtrArrayStepper

java.lang.Object
  |
  +--org.abora.gold.java.AboraHeaper
        |
        +--org.abora.gold.xpp.basic.Heaper
              |
              +--org.abora.gold.collection.steppers.Stepper
                    |
                    +--org.abora.gold.collection.steppers.TableStepper
                          |
                          +--org.abora.gold.spaces.cross.PtrArrayStepper

public class PtrArrayStepper
extends TableStepper

A Stepper for stepping over the elements of a PtrArray in ascending or descending order.
This is a TableStepper even though it is stepping over a PtrArray instead of a table.
Should probably eventually be generalized to PrimArrays. NOT.A.TYPE


Field Summary
protected  PtrArray myArray
           
protected  int myIndex
           
protected  int myPastEnd
           
protected  int myStep
           
 
Fields inherited from class org.abora.gold.collection.steppers.Stepper
TheEmptyStepper
 
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
PtrArrayStepper(PtrArray array, int start, int pastEnd, int step)
           
PtrArrayStepper(Rcvr receiver)
           
 
Method Summary
static TableStepper ascending(PtrArray array)
          Note: this being a low level operation, and there being no lightweight form of immutable
or lazily copied PtrArray, it is my caller's responsibility to pass me a PtrArray which
will in fact not be changed during the life of this stepper.
 Stepper copy()
          Return a new stepper which steps independently of me, but whose current value is the same
as mine, and which must produce a future history of values which satisfies the same
obligation that my contract obligates me to produce now.
static TableStepper descending(PtrArray array)
          Note: this being a low level operation, and there being no lightweight form of immutable
or lazily copied PtrArray, it is my caller's responsibility to pass me a PtrArray which
will in fact not be changed during the life of this stepper.
 Heaper fetch()
          If I am exhausted (i.e., if (!! this->hasValue())), then return NULL.
 boolean hasValue()
          Iff I have a current value (i.e.
 IntegerVar index()
          Unboxed version of TableStepper::key.
 Position position()
          A TableStepper actually enumerates the associations of a table.
 void sendSelfTo(Xmtr xmtr)
          do nothing
 void step()
          Essential.
 
Methods inherited from class org.abora.gold.collection.steppers.TableStepper
forIndices, forKeyValues, forPositions, forPromisedPairs, info, key, stepManyPairs, stepManyPairs
 
Methods inherited from class org.abora.gold.collection.steppers.Stepper
actualHashForEqual, asArray, atEnd, emptyStepper, forEach, forEachPromise, get, initTimeNonInherited, isEqual, itemStepper, linkTimeNonInherited, stepMany, stepMany, 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, 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, isEqual, isEqualOrSubclassOf, isGenerated, isIntType, isKindOf, isRawType, isUnlocked, make, makeClassTable, makeFillTable, makeRequestTable, mangle, markChildren, markCount, markInstances, mayBecome, mayBecomeAnySubclassOf, new1, newX, nonCopyVariables, notWorking, pack, packageClasses, packagingCategory, parseExportName, passe, pointerToStaticMember, pointerToStaticMember, pointerToVirtualMember, preorderMax, preorderNumber, printOn, PROBLEM, problems, promiseClass, promiseDefaultValue, promiseName, promiseNameTable, promiseToAbstract, registerPackageCategory, removeGeneratedCode, removeStubbleMethods, removeSubclassGeneratedCode, removeSubclassStubbleMethods, requestProcedure, requestProceduresFrom, returnTypeFor, rootName, scheduleTermination, sendProxyTo, 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, inspect, 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

myArray

protected PtrArray myArray

myIndex

protected int myIndex

myPastEnd

protected int myPastEnd

myStep

protected int myStep
Constructor Detail

PtrArrayStepper

public PtrArrayStepper(PtrArray array,
                       int start,
                       int pastEnd,
                       int step)

PtrArrayStepper

public PtrArrayStepper(Rcvr receiver)
Method Detail

copy

public Stepper copy()
Description copied from class: Stepper
Return a new stepper which steps independently of me, but whose current value is the same
as mine, and which must produce a future history of values which satisfies the same
obligation that my contract obligates me to produce now. Typically, this will mean that he
must produce the same future history that I'm going to produce. However, let's say that I
am enumerating the elements of a partial order in some full order which is consistent with
the partial order. If a copy of me is made after I'm part way through, then me and my copy
may produce any future history compatable both with the partial order and the elements
I've already produced by the time of the copy. Of course, a subclass or a Stepper creating
message (like IntegerRegion::stepper()) may specify the more stringent requirement (that a
copy must produce the same sequence).
To prevent aliasing, Steppers should typically be passed by copy. See class comment.

Overrides:
copy in class TableStepper

fetch

public Heaper fetch()
Description copied from class: Stepper
If I am exhausted (i.e., if (!! this->hasValue())), then return NULL. Else return
current element. I return wimpily since most items returned are held by collections.
If I create a new object, I should cache it.

Overrides:
fetch in class TableStepper

hasValue

public boolean hasValue()
Description copied from class: Stepper
Iff I have a current value (i.e. this message returns true), then I am not
exhasted. 'fetch' and 'get' will both return this value, and I can be 'step'ped to
my next state. As I am stepped, eventually I may become exhausted (the
reverse of all the above), which is a permanent condition.
Note that not all steppers have to be exhaustable. A Stepper which
enumerates all primes is perfectly reasonable. Assuming otherwise will create
infinite loops. See class comment.

Overrides:
hasValue in class TableStepper

step

public void step()
Description copied from class: Stepper
Essential. If I am currently exhausted (see Stepper::hasValue()), then it is an error to
step me. The result of doing so isn't currently specified (we probably should specify it
to BLAST, but I know that the implementation doesn't currently live up to that spec).
If I am not exhausted, then this advances me to my next state. If my current value (see
Stepper::get()) was my final value, then I am now exhausted, otherwise my new current
value is the next value.

Overrides:
step in class TableStepper

index

public IntegerVar index()
Description copied from class: TableStepper
Unboxed version of TableStepper::key. See class comment in XuInteger.

Overrides:
index in class TableStepper

position

public Position position()
Description copied from class: TableStepper
A TableStepper actually enumerates the associations of a table. Through the normal Stepper
protocol, it makes available the range element of the current association. Through this
additional protocol, it make accessible the key of the current association. This message
returns the same object as TwoStepper::other, the only difference being the static
knowledge that it's a Position.

Overrides:
position in class TableStepper

sendSelfTo

public void sendSelfTo(Xmtr xmtr)
Description copied from class: Heaper
do nothing

Overrides:
sendSelfTo in class Heaper

ascending

public static TableStepper ascending(PtrArray array)
Note: this being a low level operation, and there being no lightweight form of immutable
or lazily copied PtrArray, it is my caller's responsibility to pass me a PtrArray which
will in fact not be changed during the life of this stepper. This is an unchecked an
uncheckable precondition on my clients.


descending

public static TableStepper descending(PtrArray array)
Note: this being a low level operation, and there being no lightweight form of immutable
or lazily copied PtrArray, it is my caller's responsibility to pass me a PtrArray which
will in fact not be changed during the life of this stepper. This is an unchecked an
uncheckable precondition on my clients.



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