|
SunSPOT API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.squawk.Offset
public final class Offset
The offset type is used by the runtime system and collector to denote the directed distance between two machine addresses. It is used instead of 'int' or 'Object' for coding clarity, machine-portability (it can map to 32 bit and 64 bit integral types) and access to unsigned operations (Java does not have unsigned int types).
This class is known specially by the translator as a Modifier#SQUAWKPRIMITIVE
and programming with it requires adhering to the restrictions implied by this
attribute.
Only the public methods of this class which do not override any of the
methods in java.lang.Object will be available in a non-hosted
environment. The translator replaces any calls to these methods to native
method calls.
This mechanism was largely inspired by the VM_Address class in the Jikes RVM.
Method Summary | |
---|---|
Offset |
add(int delta)
Adds a value to this offset and return the resulting offset. |
Offset |
bytesToWords()
Scales this offset which currently expresses an offset in bytes to express the same offset in words. |
boolean |
eq(Offset offset2)
Determines if this offset is equal to a given offset. |
static Offset |
fromPrimitive(int value)
Casts an offset expressed as the appropriate Java primitive type for the platform (i.e. int or long) into a value of type Offset. |
boolean |
ge(Offset offset2)
Determines if this offset is greater than or equal to a given offset. |
boolean |
gt(Offset offset2)
Determines if this offset is greater than a given offset. |
boolean |
isZero()
Determines if this offset is 0. |
boolean |
le(Offset offset2)
Determines if this offset is less than or equal to a given offset. |
boolean |
lt(Offset offset2)
Determines if this offset is less than a given offset. |
boolean |
ne(Offset offset2)
Determines if this offset is not equal to a given offset. |
Offset |
sub(int delta)
Subtracts a value from this offset and return the resulting offset. |
int |
toInt()
Casts a value of type Offset into an int. |
int |
toPrimitive()
Casts a value of type Offset into the appropriate Java primitive type for the platform (i.e. int or long). |
UWord |
toUWord()
Casts a value of type Offset into a UWord. |
Offset |
wordsToBytes()
Scales this offset which currently expresses an offset in words to express the same offset in bytes. |
static Offset |
zero()
Gets the canonical Offset representation of null . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public Offset add(int delta)
delta
- the signed value to add
delta
to this offsetpublic Offset bytesToWords()
public boolean eq(Offset offset2)
offset2
- the offset to compare this offset against
offset2
public static Offset fromPrimitive(int value)
value
- an offset expressed as an int or long
offset
public boolean ge(Offset offset2)
offset2
- the offset to compare this offset against
offset2
public boolean gt(Offset offset2)
offset2
- the offset to compare this offset against
offset2
public boolean isZero()
public boolean le(Offset offset2)
offset2
- the offset to compare this offset against
offset2
public boolean lt(Offset offset2)
offset2
- the offset to compare this offset against
offset2
public boolean ne(Offset offset2)
offset2
- the offset to compare this offset against
offset2
public Offset sub(int delta)
delta
- the signed value to subract
delta
from this offsetpublic int toInt()
public int toPrimitive()
public UWord toUWord()
public Offset wordsToBytes()
public static Offset zero()
null
.
null
|
SunSPOT API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |