|
" 2013 FRC Java 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 SQUAWKPRIMITIVE
and programming with it requires adhering to the restrictions implied by this
attribute. Some of these constraints are imposed to keep the job of the
translator simple. All of these constraints are currently enforced by the
translator. The constraints are:
null
) than T.
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, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static Offset fromPrimitive(int value) throws NativePragma
value
- an offset expressed as an int or long
offset
NativePragma
public int toPrimitive() throws NativePragma
NativePragma
public int toInt() throws NativePragma
NativePragma
public UWord toUWord() throws NativePragma
NativePragma
public static Offset zero() throws NativePragma
null
.
null
NativePragma
public Offset add(int delta) throws NativePragma
delta
- the signed value to add
delta
to this offset
NativePragma
public Offset sub(int delta) throws NativePragma
delta
- the signed value to subract
delta
from this offset
NativePragma
public Offset wordsToBytes() throws NativePragma
NativePragma
public Offset bytesToWords() throws NativePragma
NativePragma
public boolean isZero() throws NativePragma
NativePragma
public boolean eq(Offset offset2) throws NativePragma
offset2
- the offset to compare this offset against
offset2
NativePragma
public boolean ne(Offset offset2) throws NativePragma
offset2
- the offset to compare this offset against
offset2
NativePragma
public boolean lt(Offset offset2) throws NativePragma
offset2
- the offset to compare this offset against
offset2
NativePragma
public boolean le(Offset offset2) throws NativePragma
offset2
- the offset to compare this offset against
offset2
NativePragma
public boolean gt(Offset offset2) throws NativePragma
offset2
- the offset to compare this offset against
offset2
NativePragma
public boolean ge(Offset offset2) throws NativePragma
offset2
- the offset to compare this offset against
offset2
NativePragma
public int hashCode() throws HostedPragma
hashCode
in class Object
HostedPragma
Object.equals(java.lang.Object)
,
Hashtable
public String toString() throws HostedPragma
toString
in class Object
HostedPragma
|
" 2013 FRC Java API " |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |