org.abora.gold.collection.basic
Class PrimArray

java.lang.Object
  |
  +--org.abora.gold.java.AboraHeaper
        |
        +--org.abora.gold.xpp.basic.Heaper
              |
              +--org.abora.gold.collection.basic.PrimArray
Direct Known Subclasses:
PrimDataArray, PtrArray

public class PrimArray
extends Heaper

Array objects in smalltalk vary in size, while in x++ the allocate separate storage for the varying part. Thus they require very different Recipes. Recipes are normally registered by the class'' associated Recipe class at its own initialization time. In smalltalk, the Array classes share a common Recipe class, (STArrayRecipe), which registers an instance of itself for each appropriate concrete subclass of PrimArray.X. (WeakPtrArrays are not in the browser because they currently have no clients and may disappear.)


Field Summary
protected static int OurGutsCount
          in units of PrimArrayHeap allocation
 
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
protected PrimArray(int count, int datumSize)
          we get the datum size all the way up here so that the caller does not have to repeat whatever calculation went into newCount
 
Method Summary
static void cleanup()
           
 BooleanVar contentsEqual(PrimArray other)
          Whether the two ranges contain semantically the same values.
 int contentsHash()
          A hash of the entire contents of the array.
 PrimArray copy()
           
 PrimArray copy(int count)
           
 PrimArray copy(int count, int start)
           
 PrimArray copy(int count, int start, int before)
           
 PrimArray copy(int count, int start, int before, int after)
          Make a copy of a piece of this array.
protected  void copyElements(int to, PrimArray source, int from, int count)
          subclasses with non-32 bit or other interesting values should override
 PrimArray copyGrow(int after)
          Make a copy of the array into a larger array.
 void copyToBuffer(int[] buffer, int size)
           
 void copyToBuffer(int[] buffer, int size, int count)
           
 void copyToBuffer(int[] buffer, int size, int count, int start)
          Copy of a piece of this array into the provided buffer with size bytes of space available.
 int count()
          How many elements the array can hold
 BooleanVar elementsEqual(int here, PrimArray other)
           
 BooleanVar elementsEqual(int here, PrimArray other, int there)
           
 BooleanVar elementsEqual(int here, PrimArray other, int there, int n)
          Whether the two ranges contain the same values, using the criteria defined in contentsEqual
 int elementsHash()
           
 int elementsHash(int count)
           
 int elementsHash(int count, int start)
          A hash of the range of values out of the array.
 Heaper fetchValue(int index)
          Fetch a value; may be a Heaper, NULL, or a PrimValue as appropriate to PrimArray subclass.
 Heaper getValue(int index)
          Same fetchValue except it will BLAST if value is NULL
 int indexOf(Heaper value)
           
 int indexOf(Heaper value, int start)
           
 int indexOf(Heaper value, int start, int n)
          The index of the nth occurrence of the given value at or after (before if n is negative) the given index, or -1 if there is none.
 int indexOfElements(PrimArray other)
           
 int indexOfElements(PrimArray other, int valueCount)
           
 int indexOfElements(PrimArray other, int valueCount, int valueStart)
           
 int indexOfElements(PrimArray other, int valueCount, int valueStart, int start)
           
 int indexOfElements(PrimArray other, int valueCount, int valueStart, int start, int nth)
          The index of the nth occurrence of the given sequence of values at or after (before if n is negative) the given starting index, or -1 if there is none.
 int indexPast(Heaper value)
           
 int indexPast(Heaper value, int start)
           
 int indexPast(Heaper value, int start, int n)
          The index of the nth occurrence of anything but the given value at or after (before if n is negative) the given index, or -1 if there is none.
protected  PrimArray makeNew(int size, PrimArray source, int sourceOffset, int count, int destOffset)
           
protected  void moveTo(int newLoc)
          used in compaction
protected  void outOfBounds()
          the canonical out-of-bounds blast for prim arrays
protected  void printElementOn(int index, java.io.PrintWriter oo)
           
 void printOn(java.io.PrintWriter oo)
           
protected  int rangeCheck(int index)
           
protected  int size()
          used in compaction
 PrimSpec spec()
          A description of the kinds of things which can be stored in this array
protected  int[] storage()
           
 void storeAll()
           
 void storeAll(Heaper value)
           
 void storeAll(Heaper value, int count)
           
 void storeAll(Heaper value, int count, int start)
          Set a range of elements to have the same value
 void storeMany(int to, PrimArray other)
          Copy n elements from the other array into this one.
 void storeMany(int to, PrimArray other, int count)
          Copy n elements from the other array into this one.
 void storeMany(int to, PrimArray other, int count, int from)
          Copy n elements from the other array into this one.
 void storeValue(int index, Heaper value)
          Store a value; may be a Heaper, NULL, or a PrimValue as appropriate to PrimArray subclass.
protected  void zeroElements()
           
protected  void zeroElements(int from)
           
protected  void zeroElements(int from, int count)
           
 
Methods inherited from class org.abora.gold.xpp.basic.Heaper
abstractDeclarationFor, abstractTypeFor, actualHashForEqual, 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, 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, problems, 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, 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

OurGutsCount

protected static int OurGutsCount
in units of PrimArrayHeap allocation

Constructor Detail

PrimArray

protected PrimArray(int count,
                    int datumSize)
we get the datum size all the way up here so that the caller does not have to repeat whatever calculation went into newCount

Method Detail

count

public int count()
How many elements the array can hold


storeValue

public void storeValue(int index,
                       Heaper value)
Store a value; may be a Heaper, NULL, or a PrimValue as appropriate to PrimArray subclass. It is expected that most PrimArray clients will want to use less abstract access methods


fetchValue

public Heaper fetchValue(int index)
Fetch a value; may be a Heaper, NULL, or a PrimValue as appropriate to PrimArray subclass. It is expected that most PrimArray clients will want to use less abstract access methods.


getValue

public Heaper getValue(int index)
Same fetchValue except it will BLAST if value is NULL


spec

public PrimSpec spec()
A description of the kinds of things which can be stored in this array


contentsEqual

public BooleanVar contentsEqual(PrimArray other)
Whether the two ranges contain semantically the same values. Two non-NULL pointers match iff the Heapers they point to are isEqual. Two integers match iff they have the same value, even though they may be represented as different sizes. Two floats likewise.


contentsHash

public int contentsHash()
A hash of the entire contents of the array. If two arrays are contentsEqual, they will have the same contentsHash.


storeMany

public void storeMany(int to,
                      PrimArray other,
                      int count,
                      int from)
Copy n elements from the other array into this one. The other array must be of a compatible type.


storeMany

public void storeMany(int to,
                      PrimArray other,
                      int count)
Copy n elements from the other array into this one. The other array must be of a compatible type.


storeMany

public void storeMany(int to,
                      PrimArray other)
Copy n elements from the other array into this one. The other array must be of a compatible type.


copy

public PrimArray copy(int count,
                      int start,
                      int before,
                      int after)
Make a copy of a piece of this array. With no arguments, copy the entire array. With one argument copy count elements from the beginning of the array. With two arguments, copy 'count' elements starting from start. The third and fourth arguments both default to 0 and represent the number of null/0 elements to put in the result before/after the copied elements. If after = 10, for instance, the resulting array would be 10 larger than count, and the copied elements would start at index 10.


copy

public PrimArray copy(int count,
                      int start,
                      int before)

copy

public PrimArray copy(int count,
                      int start)

copy

public PrimArray copy(int count)

copy

public PrimArray copy()

copyGrow

public PrimArray copyGrow(int after)
Make a copy of the array into a larger array. The array has 'after' slots after the copied elements.


indexOf

public int indexOf(Heaper value,
                   int start,
                   int n)
The index of the nth occurrence of the given value at or after (before if n is negative) the given index, or -1 if there is none.


indexOf

public int indexOf(Heaper value,
                   int start)

indexOf

public int indexOf(Heaper value)

indexOfElements

public int indexOfElements(PrimArray other,
                           int valueCount,
                           int valueStart,
                           int start,
                           int nth)
The index of the nth occurrence of the given sequence of values at or after (before if n is negative) the given starting index, or -1 if there is none. Negative numbers for start are relative to the end of the array.


indexOfElements

public int indexOfElements(PrimArray other,
                           int valueCount,
                           int valueStart,
                           int start)

indexOfElements

public int indexOfElements(PrimArray other,
                           int valueCount,
                           int valueStart)

indexOfElements

public int indexOfElements(PrimArray other,
                           int valueCount)

indexOfElements

public int indexOfElements(PrimArray other)

indexPast

public int indexPast(Heaper value,
                     int start,
                     int n)
The index of the nth occurrence of anything but the given value at or after (before if n is negative) the given index, or -1 if there is none.


indexPast

public int indexPast(Heaper value,
                     int start)

indexPast

public int indexPast(Heaper value)

storeAll

public void storeAll(Heaper value,
                     int count,
                     int start)
Set a range of elements to have the same value


storeAll

public void storeAll(Heaper value,
                     int count)

storeAll

public void storeAll(Heaper value)

storeAll

public void storeAll()

copyToBuffer

public void copyToBuffer(int[] buffer,
                         int size,
                         int count,
                         int start)
Copy of a piece of this array into the provided buffer with size bytes of space available. The default is to start at the beginning and go to the end. The elements will be copied from this array beginning with start, and taking as many of count elements or upto the end of this array as will fit in size bytes. WARNING: Note that if this array is a PtrArray, the pointers copied to buffer will not be considered as references for garbage collection. Therefore the buffer should not be allowed to contain the only pointer to an object in a garbage collecting environment.


copyToBuffer

public void copyToBuffer(int[] buffer,
                         int size,
                         int count)

copyToBuffer

public void copyToBuffer(int[] buffer,
                         int size)

elementsEqual

public BooleanVar elementsEqual(int here,
                                PrimArray other,
                                int there,
                                int n)
Whether the two ranges contain the same values, using the criteria defined in contentsEqual


elementsEqual

public BooleanVar elementsEqual(int here,
                                PrimArray other,
                                int there)

elementsEqual

public BooleanVar elementsEqual(int here,
                                PrimArray other)

elementsHash

public int elementsHash(int count,
                        int start)
A hash of the range of values out of the array. If two ranges are elementsEqual, they will have the same hash. For data values, additional zeros on the end make no difference to the hash.


elementsHash

public int elementsHash(int count)

elementsHash

public int elementsHash()

printOn

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

rangeCheck

protected int rangeCheck(int index)

storage

protected int[] storage()

printElementOn

protected void printElementOn(int index,
                              java.io.PrintWriter oo)

copyElements

protected void copyElements(int to,
                            PrimArray source,
                            int from,
                            int count)
subclasses with non-32 bit or other interesting values should override


zeroElements

protected void zeroElements(int from,
                            int count)

zeroElements

protected void zeroElements(int from)

zeroElements

protected void zeroElements()

makeNew

protected PrimArray makeNew(int size,
                            PrimArray source,
                            int sourceOffset,
                            int count,
                            int destOffset)

cleanup

public static void cleanup()

outOfBounds

protected void outOfBounds()
the canonical out-of-bounds blast for prim arrays


size

protected int size()
used in compaction


moveTo

protected void moveTo(int newLoc)
used in compaction



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