# Interface: com.pnfsoftware.jeb.core.units.code.android.ir.IDImm
- Super interfaces: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression`

This dual\-purpose `dexdec` IR element serves to encode immediate values \(primitives and  pooled strings\) and [evaluated](com.pnfsoftware.jeb.core.units.code.android.ir.IDState.md) values \(primitives and objects\).  

  They can be:
  \- primitives
  \- null objects
  \- pooled `java.lang.String` objects
  \- references to live objects \(including arrays\) living in an [IR state](com.pnfsoftware.jeb.core.units.code.android.ir.IDState.md)
  

  Examples:   

```

 String s = a == 1 ? "hello": null;
                 ^   ^^^^^^^  ^^^^
 
```

## Abstract Method: _add
- parameter: `o`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform an integer addition.
parameter: o: addend
return: the resulting immediate

## Abstract Method: _and
- parameter: `o`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform a bitwise and operation.
parameter: o: other immediate
return: the resulting immediate

## Abstract Method: _cmp
- parameter: `o`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `int`

Description: Perform a signed operand comparison.
parameter: o: other immediate
return: 0, 1, or \-1

## Abstract Method: _cmpU
- parameter: `o`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `int`

Description: Perform an unsigned operand comparison.
parameter: o: other immediate
return: 0, 1, or \-1

## Abstract Method: _div
- parameter: `o`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform an integer division.
parameter: o: divisor
return: the resulting immediate

## Abstract Method: _isPowerOf2
- return type: `boolean`

Description: Determine whether this immediate \(treated as an unsigned integer\) is a power of 2.
return: true if this immediate is a power of 2

## Abstract Method: _log2
- return type: `java.lang.Integer`

Description: Perform an exact log2 on this immediate treated as an unsigned integer. If the immediate is  not a power of 2, a null value is returned.
return: a non\-null log2 of this immediate

## Abstract Method: _mul
- parameter: `o`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform an integer multiplication.
parameter: o: multiplier
return: the resulting immediate

## Abstract Method: _neg
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform an integer negation.
return: the resulting immediate

## Abstract Method: _not
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform a bitwise not operation.
return: the resulting immediate

## Abstract Method: _or
- parameter: `o`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform a bitwise or operation.
parameter: o: other immediate
return: the resulting immediate

## Abstract Method: _pow
- parameter: `exponent`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform an exponentiation.
parameter: exponent: must be positive or zero
return: the resulting immediate

## Abstract Method: _rem
- parameter: `o`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform an integer modulo operation.
parameter: o: divisor
return: the resulting immediate

## Abstract Method: _sar
- parameter: `cnt`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform an arithmetic right\-shift operation \(sign bit is maintained\). The effective count is  computed modulo\-positive 32 or 64, depending on the type of this integer.
parameter: cnt: shift count
return: the resulting immediate

## Abstract Method: _shl
- parameter: `cnt`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform a left\-shift operation. The effective count is computed modulo\-positive 32 or 64,  depending on the type of this integer.
parameter: cnt: shift count
return: the resulting immediate

## Abstract Method: _shr
- parameter: `cnt`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform a regular right\-shift operation. The effective count is computed modulo\-positive 32  or 64, depending on the type of this integer.
parameter: cnt: shift count
return: the resulting immediate

## Abstract Method: _sub
- parameter: `o`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform an integer subtraction.
parameter: o: subtrahend
return: the resulting immediate

## Abstract Method: _testbit
- parameter: `pos`, type: `int`
- return type: `boolean`

Description: Test if a given bit is set.
parameter: pos: bit position
return: true if set, false if unset

## Abstract Method: _xor
- parameter: `o`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform a bitwise xor operation.
parameter: o: other immediate
return: the resulting immediate

## Abstract Method: canReadAsLong
- return type: `boolean`

Description: Determine whether this immediate can be read as a long value.
return: true if this immediate can be read as a long value

## Abstract Method: duplicate
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`


## Abstract Method: duplicateWithDifferentType
- parameter: `type`, type: `com.pnfsoftware.jeb.core.units.code.java.IJavaType`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Duplicate this immediate and assign it a different type.
parameter: type: type of the duplicated immediate; note for String constants: although type update             is allowed, it must be a type implementing `java.lang.CharSequence`
return: the duplicated immediate

## Abstract Method: getImmediateAsJavaObject
- parameter: `gctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDGlobalContext`
- return type: `java.lang.Object`

Description: Resolve this primitive or pooled string immediate to a Java object: either the effective  `String` value if it is a string, or one of boxed primitive object type if it is a  primitive.
parameter: gctx: global IR context used to resolve pooled strings
return: Java object representation

## Abstract Method: getObjectReferenceId
- return type: `int`

Description: Get the reference object id. The value returned by this method is moot unless  [#isRef()](#isRef()) is true.
return: object reference id

## Abstract Method: getRawValue
- return type: `long`

Description: Retrieve the raw value encoded by this immediate. All values \(primitives, pool indices,  object references\) can fit on a `long`; hence this method's return type.
return: raw encoded value

## Abstract Method: getStringIndex
- return type: `int`

Description: Retrieve the pool index of a pooled string immediate. This method will fail unless  [#isString()](#isString()) is `true`.
return: string pool index

## Abstract Method: getStringValue
- parameter: `gctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDGlobalContext`
- return type: `java.lang.String`

Description: Resolve the pooled string constant to its effective value. This method will throw if this  immediate is not [a string constant](#isStringImm()).
parameter: gctx: global IR context used to resolve the string
return: effective string value

## Abstract Method: getValueAsLong
- return type: `long`

Description: Read this immediate as a long value.
return: long value

## Abstract Method: isNonNullRef
- return type: `boolean`

Description: Determine whether this immediate is a non\-null reference. Beware: if the immediate is not  typed as an object, this method will return false in all case.
return: true if this immediate is a non\-null reference

## Abstract Method: isNullRef
- return type: `boolean`

Description: Determine whether this immediate is a null reference. Beware: if the immediate is not typed  as an object, this method will return false in all case.
return: true if this immediate is a null reference

## Abstract Method: isOnes
- return type: `boolean`

Description: Determine whether this immediate has all its bits set to 1.  

  Note: do not mix this up with a zero\-value equality check. That works if the underlying value  is to be interpreted as an 2\-complement integer, but may not work if the imm is to be  understood as an ieee754 float value, for example.
return: true if all bits are 1

## Abstract Method: isRef
- return type: `boolean`

Description: Determine whether this immediate is a reference.  

  Note: pooled strings are not treated as references by this method.
return: true if this immediate is a reference

## Abstract Method: isString
- return type: `boolean`

Description: Determine whether this immediate is a **pooled string**.
return: true if this immediate is a pooled string

## Abstract Method: isZero
- return type: `boolean`

Description: Determine whether this immediate has all its bits set to 0.  

  Note: do not mix this up with a zero\-value equality check. That works if the underlying value  is to be interpreted as an 2\-complement integer, but may not work if the imm is to be  understood as an ieee754 float value, for example.
return: true if all bits are 0

## Abstract Method: isZeroEquivalent
- return type: `boolean`

Description: 
deprecated: use [#isZero()](#isZero()) instead
return: true if this immediate is equivalent to zero

## Abstract Method: maybeNonNullRef
- return type: `boolean`

Description: Determine whether this immediate may be a reference that is not the null reference.
return: true if this immediate may be a non\-null reference

## Abstract Method: maybeNullRef
- return type: `boolean`

Description: Determine whether this immediate may be a reference that is the null reference.
return: true if this immediate may be a null reference

## Abstract Method: maybeRef
- return type: `boolean`

Description: Determine whether this immediate may be a reference.  

  Note: pooled strings are not treated as references by this method.
return: true if this immediate may be a reference

## Abstract Method: toDouble
- return type: `double`
- throws: `com.pnfsoftware.jeb.core.units.code.android.ir.DexDecEvaluationException`

Description: Evaluate this immediate as a double\-precision float. The immediate must be of type  `float` or `double`.
return: double value
throws: if the value cannot be read as a double

## Abstract Method: toFloat
- return type: `float`
- throws: `com.pnfsoftware.jeb.core.units.code.android.ir.DexDecEvaluationException`

Description: Evaluate this immediate as a single\-precision float. The immediate must be of type  `float`.
return: float value
throws: if the value cannot be read as a float

## Abstract Method: toLong
- return type: `long`
- throws: `com.pnfsoftware.jeb.core.units.code.android.ir.DexDecEvaluationException`

Description: Evaluate this immediate as a signed long primitive.  

  Note: if this constant is an object reference, the reference id is returned.
return: signed long value
throws: if the value cannot be read as a long

## Abstract Method: toLong
- parameter: `treatSregAsInt`, type: `boolean`
- return type: `long`
- throws: `com.pnfsoftware.jeb.core.units.code.android.ir.DexDecEvaluationException`

Description: Evaluate this immediate as a signed long primitive.  

  Note: if this constant is an object reference, the reference id is returned.
parameter: treatSregAsInt: if true, and if this object is typed as a             [single\-slot wildcard](IJavaType#isSingleSlotWildcard()), it is treated as a             signed immediate \(and sign\-extension is applied\)
return: signed long value
throws: if the value cannot be read as a long

## Abstract Method: toUnsignedLong
- return type: `long`
- throws: `com.pnfsoftware.jeb.core.units.code.android.ir.DexDecEvaluationException`

Description: Evaluate this immediate as an unsigned long.  

  Note: if this constant is an object reference, the reference id is returned.
return: unsigned long value
throws: the type of this immediate does not permit its resolution              to a long primitive

