|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
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
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.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 |
protected IntegerVar myValue
protected static IntegerPos TheZero
| Constructor Detail |
public IntegerPos(IntegerVar newValue)
public IntegerPos(Rcvr receiver)
| Method Detail |
public int actualHashForEqual()
actualHashForEqual in class Positionpublic boolean isEqual(Heaper other)
Heaper
isEqual in class Positionpublic boolean isGE(Position other)
isGE in class Positionpublic int asInt32()
public IntegerVar asIntegerVar()
public XnRegion asRegion()
Position
asRegion in class Positionpublic CoordinateSpace coordinateSpace()
Position
coordinateSpace in class Positionpublic IntegerVar value()
public void basicCast(java.lang.Object someClass)
public void printOn(java.io.PrintWriter oo)
printOn in class Heaperpublic void sendSelfTo(Xmtr xmtr)
Heaper
sendSelfTo in class Heaperpublic static Heaper make(IntegerVar newValue)
public static IntegerPos zero()
public static void IntegerVar(java.lang.Object number)
public static int integerHash(IntegerVar value)
public static void info()
public static java.lang.String exportName()
Heaper
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||