org.abora.gold.spaces.integers
Class IntegerPos

java.lang.Object
  |
  +--org.abora.gold.java.AboraHeaper
        |
        +--org.abora.gold.xpp.basic.Heaper
              |
              +--org.abora.gold.spaces.basic.Position
                    |
                    +--org.abora.gold.spaces.integers.IntegerPos

public class IntegerPos
extends Position

Because of the constraints of C++, we have two very different types representing integers
in our system.
XuInteger is the boxed representation which must be used in any context which only knows
that it is dealing with a Position. XuInteger is a Heaper with all that implies.
Specifically, one can take advantage of all the advantages of polymorphism (leading to
uses by code that only knows it is dealing with a Position), but at the cost of
representing each value by a heap allocated object to which pointers are passed. Such a
representation is referred to as "boxed" because the pointer combined with the storage
structure overhead of maintaining a heap allocated object constitutes a "box" between the
user of the data (the guy holding onto the pointer), and the actual data (which is inside
the Heaper).
In contrast, IntegerVar is the efficient, unboxed representation of an integer.
(actually, it is only unboxed so long as it fits within some size limit such as 32 bits.
Those IntegerVars that exceed this limit pay their own boxing cost to store their
representation on the heap. This need not concern us here.) See "The Var vs Heaper
distinction" and IntegerVar. When we know that we are dealing specifically with an
integer, we`d like to be able to stick with IntegerVars without having to convert them to
XuIntegers. However, we`d like to be able to do everything that we could normally do if
we had an XuInteger.
For this purpose, many messages (such as Position * Dsp::of(Position*)) have an additional
overloading (IntegerVar Dsp::of(IntegerVar)) whose semantics is defined in terms of
converting the argument to an XuInteger, applying the original operation, and converting
the result (which is asserted to be an XuInteger) back to an IntegerVar. Dsp even
provides a default implementation to do exactly that. However, if we actually rely on
this default implementation then we are defeating the whole purpose of avoiding boxing
overhead. Instead, IntegerDsp overrides this to provide an efficient implementation.
Any particular case may at the moment simply be relying on the default. The point is to
get interfaces defined early which allow efficiency tuning to proceed in a modular fashion
later. Should any particular reliance on the default actually prove to be an efficiency
issue, we will deal with it then.


Field Summary
protected  IntegerVar myValue
           
protected static IntegerPos TheZero
           
 
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
IntegerPos(IntegerVar newValue)
           
IntegerPos(Rcvr receiver)
           
 
Method Summary
 int actualHashForEqual()
          This must use an external function so other parts of the system can
compute the hash from an integerVar without boxing.
 int asInt32()
          Unboxed version as an integer.
 IntegerVar asIntegerVar()
          Essential.
 XnRegion asRegion()
          Essential.
 void basicCast(java.lang.Object someClass)
           
 CoordinateSpace coordinateSpace()
          Essential.
static java.lang.String exportName()
          Return the completely stripped rootName for this class.
static void info()
          {IntegerVar CLIENT INLINE} value
static int integerHash(IntegerVar value)
          NOTE: Do NOT change this without also changing the implementation of hashForEqual in
XuInteger!!!!!!.
static void IntegerVar(java.lang.Object number)
           
 boolean isEqual(Heaper other)
          Return true if the two objects are equal.
 boolean isGE(Position other)
          Just the full ordering you'd expect on integers
static Heaper make(IntegerVar newValue)
          Box an integer.
 void printOn(java.io.PrintWriter oo)
           
 void sendSelfTo(Xmtr xmtr)
          do nothing
 IntegerVar value()
          Essential.
static IntegerPos zero()
          Box an integer.
 
Methods inherited from class org.abora.gold.spaces.basic.Position
isAfterOrEqual
 
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, 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, 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, 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

myValue

protected IntegerVar myValue

TheZero

protected static IntegerPos TheZero
Constructor Detail

IntegerPos

public IntegerPos(IntegerVar newValue)

IntegerPos

public IntegerPos(Rcvr receiver)
Method Detail

actualHashForEqual

public int actualHashForEqual()
This must use an external function so other parts of the system can
compute the hash from an integerVar without boxing.

Overrides:
actualHashForEqual in class Position

isEqual

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

Overrides:
isEqual in class Position

isGE

public boolean isGE(Position other)
Just the full ordering you'd expect on integers

Overrides:
isGE in class Position

asInt32

public int asInt32()
Unboxed version as an integer. See class comment


asIntegerVar

public IntegerVar asIntegerVar()
Essential. Unboxed version. See class comment


asRegion

public XnRegion asRegion()
Description copied from class: Position
Essential. A region containing this position as its only element.

Overrides:
asRegion in class Position

coordinateSpace

public CoordinateSpace coordinateSpace()
Description copied from class: Position
Essential. The coordinate space this is a position in. This implies that a position
object is only a position in one particular coordinate space.

Overrides:
coordinateSpace in class Position

value

public IntegerVar value()
Essential. Unboxed version. See class comment


basicCast

public void basicCast(java.lang.Object someClass)

printOn

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

sendSelfTo

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

Overrides:
sendSelfTo in class Heaper

make

public static Heaper make(IntegerVar newValue)
Box an integer. See XuInteger class comment. you can also create an
integer in smalltalk by sending the integer message to a Smalltalk integer


zero

public static IntegerPos zero()
Box an integer. See XuInteger class comment. you can also create an
integer in smalltalk by sending the integer message to a Smalltalk integer.
This should return the canonical zero eventually.


IntegerVar

public static void IntegerVar(java.lang.Object number)

integerHash

public static int integerHash(IntegerVar value)
NOTE: Do NOT change this without also changing the implementation of hashForEqual in
XuInteger!!!!!!.


info

public static void info()
{IntegerVar CLIENT INLINE} value


exportName

public static java.lang.String exportName()
Description copied from class: Heaper
Return the completely stripped rootName for this class. Get rid of prefixes.
Some classes will implement this directly in order to provide another name.



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