SunSPOT API V5.0


com.sun.squawk
Class UWord

java.lang.Object
  extended by com.sun.squawk.UWord

public final class UWord
extends Object

The word type is used by the runtime system and collector to denote machine word-sized quantities. 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:

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_Word class in the Jikes RVM.


Method Summary
 UWord and(UWord word)
          Logically AND a word with this word.
 boolean eq(UWord word2)
          Determines if this word is equal to a given word.
static UWord fromPrimitive(int value)
          Casts a word expressed as the appropriate Java primitive type for the platform (i.e. int or long) into a value of type UWord.
 boolean hi(UWord word2)
          Determines if this word is higher than a given word.
 boolean hieq(UWord word2)
          Determines if this word is higher than or equal to a given word.
 boolean isMax()
          Determines if this word is equals to max.
 boolean isZero()
          Determines if this word is 0.
 boolean lo(UWord word2)
          Determines if this word is lower than a given word.
 boolean loeq(UWord word2)
          Determines if this word is lower than or equal to a given word.
static UWord max()
          Gets the largest possible machine word.
 boolean ne(UWord word2)
          Determines if this word is not equal to a given word.
 UWord or(UWord word)
          Logically OR a word with this word.
 int toInt()
          Casts a value of type UWord into an int.
 Offset toOffset()
          Casts a value of type UWord into an Offset.
 int toPrimitive()
          Casts a value of type UWord into the appropriate Java primitive type for the platform (i.e. int or long).
static UWord zero()
          Gets the canonical UWord representation of null.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

and

public UWord and(UWord word)
Logically AND a word with this word.

Parameters:
word - the word to AND this word with
Returns:
the result of the AND operation

eq

public boolean eq(UWord word2)
Determines if this word is equal to a given word.

Parameters:
word2 - the word to compare this word against
Returns:
true if this word is equal to word2

fromPrimitive

public static UWord fromPrimitive(int value)
Casts a word expressed as the appropriate Java primitive type for the platform (i.e. int or long) into a value of type UWord.

Parameters:
value - a word expressed as an int or long
Returns:
the canonical UWord instance for value

hi

public boolean hi(UWord word2)
Determines if this word is higher than a given word.

Parameters:
word2 - the word to compare this word against
Returns:
true if this word is higher than word2

hieq

public boolean hieq(UWord word2)
Determines if this word is higher than or equal to a given word.

Parameters:
word2 - the word to compare this word against
Returns:
true if this word is higher than or equal to word2

isMax

public boolean isMax()
Determines if this word is equals to max.

Returns:
true if this word is equals to max

isZero

public boolean isZero()
Determines if this word is 0.

Returns:
true if this word is 0.

lo

public boolean lo(UWord word2)
Determines if this word is lower than a given word.

Parameters:
word2 - the word to compare this word against
Returns:
true if this word is lower than or equals to word2

loeq

public boolean loeq(UWord word2)
Determines if this word is lower than or equal to a given word.

Parameters:
word2 - the word to compare this word against
Returns:
true if this word is lower than or equal to word2

max

public static UWord max()
Gets the largest possible machine word.

Returns:
the largest possible machine word

ne

public boolean ne(UWord word2)
Determines if this word is not equal to a given word.

Parameters:
word2 - the word to compare this word against
Returns:
true if this word is not equal to word2

or

public UWord or(UWord word)
Logically OR a word with this word.

Parameters:
word - the word to OR this word with
Returns:
the result of the OR operation

toInt

public int toInt()
Casts a value of type UWord into an int. This will cause a fatal error if this UWord value cannot be expressed as a signed 32 bit Java int without changing its sign or truncating its magnitude.

Returns:
this UWord value as an int

toOffset

public Offset toOffset()
Casts a value of type UWord into an Offset. This may cause a change in sign if this word value cannot be expressed as a signed quantity.

Returns:
this UWord value as an Offset

toPrimitive

public int toPrimitive()
Casts a value of type UWord into the appropriate Java primitive type for the platform (i.e. int or long). This will cause a fatal error if this cast cannot occur without changing this uword's sign or truncating its magnitude.

Returns:
this UWord value as an int or long

zero

public static UWord zero()
Gets the canonical UWord representation of null.

Returns:
the canonical UWord representation of null

SunSPOT API V5.0


Copyright � 2006-2008 Sun Microsystems, Inc. All Rights Reserved.