com.android.dx.rop.cst
Class CstKnownNull

java.lang.Object
  extended by com.android.dx.rop.cst.Constant
      extended by com.android.dx.rop.cst.TypedConstant
          extended by com.android.dx.rop.cst.CstLiteralBits
              extended by com.android.dx.rop.cst.CstKnownNull
All Implemented Interfaces:
TypeBearer, ToHuman, Comparable<Constant>

public final class CstKnownNull
extends CstLiteralBits

Constant type to represent a known-null value.


Field Summary
static CstKnownNull THE_ONE
          non-null; unique instance of this class
 
Method Summary
protected  int compareTo0(Constant other)
          Compare the values of this and another instance, which are guaranteed to be of the same class.
 boolean equals(Object other)
          
 boolean fitsInInt()
          Returns whether or not this instance's value may be accurately represented as an int.
 int getIntBits()
          Gets the value as int bits.
 long getLongBits()
          Gets the value as long bits.
 Type getType()
          Gets the type associated with this instance.
 int hashCode()
          
 boolean isCategory2()
          Returns true if this instance is a category-2 constant, meaning it takes up two slots in the constant pool, or false if this instance is category-1.
 String toHuman()
          Return the "human" string form of this instance.
 String toString()
          
 String typeName()
          Returns the human name for the particular type of constant this instance is.
 
Methods inherited from class com.android.dx.rop.cst.CstLiteralBits
fitsIn16Bits, fitsIn8Bits
 
Methods inherited from class com.android.dx.rop.cst.TypedConstant
getBasicFrameType, getBasicType, getFrameType, isConstant
 
Methods inherited from class com.android.dx.rop.cst.Constant
compareTo
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

THE_ONE

public static final CstKnownNull THE_ONE
non-null; unique instance of this class

Method Detail

equals

public boolean equals(Object other)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

compareTo0

protected int compareTo0(Constant other)
Compare the values of this and another instance, which are guaranteed to be of the same class. Subclasses must implement this.

Specified by:
compareTo0 in class Constant
Parameters:
other - non-null; the instance to compare to
Returns:
-1, 0, or 1, as usual for a comparison

toString

public String toString()

Overrides:
toString in class Object

getType

public Type getType()
Gets the type associated with this instance.

Returns:
non-null; the type

typeName

public String typeName()
Returns the human name for the particular type of constant this instance is.

Specified by:
typeName in class Constant
Returns:
non-null; the name

isCategory2

public boolean isCategory2()
Returns true if this instance is a category-2 constant, meaning it takes up two slots in the constant pool, or false if this instance is category-1.

Specified by:
isCategory2 in class Constant
Returns:
true iff this instance is category-2

toHuman

public String toHuman()
Return the "human" string form of this instance. This is generally less "debuggy" than toString().

Returns:
non-null; the human string form

fitsInInt

public boolean fitsInInt()
Returns whether or not this instance's value may be accurately represented as an int. The rule is that if there is an int which may be sign-extended to yield this instance's value, then this method returns true. Otherwise, it returns false.

Specified by:
fitsInInt in class CstLiteralBits
Returns:
true iff this instance fits in an int

getIntBits

public int getIntBits()
Gets the value as int bits. If this instance contains more bits than fit in an int, then this returns only the low-order bits. As "literal bits," a known-null is always represented as the number zero.

Specified by:
getIntBits in class CstLiteralBits
Returns:
the bits

getLongBits

public long getLongBits()
Gets the value as long bits. If this instance contains fewer bits than fit in a long, then the result of this method is the sign extension of the value. As "literal bits," a known-null is always represented as the number zero.

Specified by:
getLongBits in class CstLiteralBits
Returns:
the bits


Copyright © 2013. All Rights Reserved.