|
Sun SPOT API |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.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. |
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. |
int |
hashCode()
Gets a hashcode value for this offset which is just the value itself. |
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. |
String |
toString()
Gets a string representation of this offset. |
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, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static Offset fromPrimitive(int value)
throws com.sun.squawk.pragma.NativePragma
value - an offset expressed as an int or long
offset
com.sun.squawk.pragma.NativePragma
public int toPrimitive()
throws com.sun.squawk.pragma.NativePragma
com.sun.squawk.pragma.NativePragma
public int toInt()
throws com.sun.squawk.pragma.NativePragma
com.sun.squawk.pragma.NativePragma
public UWord toUWord()
throws com.sun.squawk.pragma.NativePragma
com.sun.squawk.pragma.NativePragma
public static Offset zero()
throws com.sun.squawk.pragma.NativePragma
null.
null
com.sun.squawk.pragma.NativePragma
public Offset add(int delta)
throws com.sun.squawk.pragma.NativePragma
delta - the signed value to add
delta to this offset
com.sun.squawk.pragma.NativePragma
public Offset sub(int delta)
throws com.sun.squawk.pragma.NativePragma
delta - the signed value to subract
delta from this offset
com.sun.squawk.pragma.NativePragma
public Offset wordsToBytes()
throws com.sun.squawk.pragma.NativePragma
com.sun.squawk.pragma.NativePragma
public Offset bytesToWords()
throws com.sun.squawk.pragma.NativePragma
com.sun.squawk.pragma.NativePragma
public boolean isZero()
throws com.sun.squawk.pragma.NativePragma
com.sun.squawk.pragma.NativePragma
public boolean eq(Offset offset2)
throws com.sun.squawk.pragma.NativePragma
offset2 - the offset to compare this offset against
offset2
com.sun.squawk.pragma.NativePragma
public boolean ne(Offset offset2)
throws com.sun.squawk.pragma.NativePragma
offset2 - the offset to compare this offset against
offset2
com.sun.squawk.pragma.NativePragma
public boolean lt(Offset offset2)
throws com.sun.squawk.pragma.NativePragma
offset2 - the offset to compare this offset against
offset2
com.sun.squawk.pragma.NativePragma
public boolean le(Offset offset2)
throws com.sun.squawk.pragma.NativePragma
offset2 - the offset to compare this offset against
offset2
com.sun.squawk.pragma.NativePragma
public boolean gt(Offset offset2)
throws com.sun.squawk.pragma.NativePragma
offset2 - the offset to compare this offset against
offset2
com.sun.squawk.pragma.NativePragma
public boolean ge(Offset offset2)
throws com.sun.squawk.pragma.NativePragma
offset2 - the offset to compare this offset against
offset2
com.sun.squawk.pragma.NativePragma
public int hashCode()
throws com.sun.squawk.pragma.HostedPragma
hashCode in class Objectcom.sun.squawk.pragma.HostedPragmaObject.equals(java.lang.Object),
Hashtable
public String toString()
throws com.sun.squawk.pragma.HostedPragma
toString in class Objectcom.sun.squawk.pragma.HostedPragma
|
Sun SPOT API |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||