FileDocCategorySizeDatePackage
CstInteger.javaAPI DocAndroid 1.5 API3353Wed May 06 22:41:02 BST 2009com.android.dx.rop.cst

CstInteger

public final class CstInteger extends CstLiteral32
Constants of type CONSTANT_Integer_info.

Fields Summary
private static final CstInteger[]
cache
non-null; array of cached instances
public static final CstInteger
VALUE_M1
non-null; instance representing -1
public static final CstInteger
VALUE_0
non-null; instance representing 0
public static final CstInteger
VALUE_1
non-null; instance representing 1
public static final CstInteger
VALUE_2
non-null; instance representing 2
public static final CstInteger
VALUE_3
non-null; instance representing 3
public static final CstInteger
VALUE_4
non-null; instance representing 4
public static final CstInteger
VALUE_5
non-null; instance representing 5
Constructors Summary
private CstInteger(int value)
Constructs an instance. This constructor is private; use {@link #make}.

param
value the int value

        super(value);
    
Methods Summary
public com.android.dx.rop.type.TypegetType()
{@inheritDoc}

        return Type.INT;
    
public intgetValue()
Gets the int value.

return
the value

        return getIntBits();
    
public static com.android.dx.rop.cst.CstIntegermake(int value)
Makes an instance for the given value. This may (but does not necessarily) return an already-allocated instance.

param
value the int value
return
non-null; the appropriate instance


                                     
         
        /*
         * Note: No need to synchronize, since we don't make any sort
         * of guarantee about ==, and it's okay to overwrite existing
         * entries too.
         */
        int idx = (value & 0x7fffffff) % cache.length;
        CstInteger obj = cache[idx];

        if ((obj != null) && (obj.getValue() == value)) {
            return obj;
        }

        obj = new CstInteger(value);
        cache[idx] = obj;
        return obj;
    
public java.lang.StringtoHuman()
{@inheritDoc}

        return Integer.toString(getIntBits());
    
public java.lang.StringtoString()
{@inheritDoc}

        int value = getIntBits();
        return "int{0x" + Hex.u4(value) + " / " + value + '}";
    
public java.lang.StringtypeName()
{@inheritDoc}

        return "int";