|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
|
+--org.abora.white.xpp.basic.Heaper
|
+--org.abora.white.spaces.basic.Position
|
+--org.abora.white.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, IntegerValue 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 IntegerValues 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 IntegerValue. When we know that we are dealing specifically with an integer, we`d like to be able to stick with IntegerValues 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 (IntegerValue Dsp::of(IntegerValue)) 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 IntegerValue. 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 IntegerValue |
myValue
|
protected static IntegerPos |
TheZero
|
| Constructor Summary | |
IntegerPos(IntegerValue 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. |
IntegerValue |
asIntegerVar()
Essential. |
XnRegion |
asRegion()
Essential. |
CoordinateSpace |
coordinateSpace()
Essential. |
static java.lang.String |
exportName()
|
static void |
info()
{IntegerValue CLIENT INLINE} value |
static int |
integerHash(IntegerValue value)
NOTE: Do NOT change this without also changing the implementation of hashForEqual in XuInteger!!!!!!. |
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 IntegerPos |
make(IntegerValue newValue)
Box an integer. |
static IntegerPos |
make(long newValue)
|
void |
printOn(java.io.PrintWriter oo)
This should rarely be overridden. |
void |
sendSelfTo(Xmtr xmtr)
|
IntegerValue |
value()
Essential. |
static IntegerPos |
zero()
Box an integer. |
| Methods inherited from class org.abora.white.xpp.basic.Heaper |
destroy, destruct, equals, hashForEqual, printContentsOn, toString |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected IntegerValue myValue
protected static IntegerPos TheZero
| Constructor Detail |
public IntegerPos(IntegerValue 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)
public int asInt32()
public IntegerValue asIntegerVar()
public XnRegion asRegion()
Position
asRegion in class Positionpublic CoordinateSpace coordinateSpace()
Position
coordinateSpace in class Positionpublic IntegerValue value()
public void printOn(java.io.PrintWriter oo)
Heaper
printOn in class Heaperpublic void sendSelfTo(Xmtr xmtr)
sendSelfTo in class Heaperpublic static IntegerPos make(IntegerValue newValue)
public static IntegerPos make(long newValue)
public static IntegerPos zero()
public static int integerHash(IntegerValue value)
public static void info()
public static java.lang.String exportName()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||