# Interface: com.pnfsoftware.jeb.core.units.code.android.ir.IDSwitchData

`dexdec` IR switch data, used to specify the case and target values of a high\-level [switch](DOpcodeType#IR_SWITCH) [instruction](IDInstruction). 

 The keys may be `integer` or `String` values.

## Method: addCase
- parameter: `key`, type: `java.lang.Object`
- parameter: `target`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDTarget`
- parameter: `overwriteIfKeyExists`, type: `boolean`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDTarget`

Description: Add a case to this switch.
parameter: key: switch key
parameter: target: target
parameter: overwriteIfKeyExists: if false and a case for the provided key exists, this method            throws [IllegalStateException](IllegalStateException)
return: the previous value, if one existed and `overwriteIfKeyExists` was true

## Method: clear

Description: Delete all cases entry, resulting in an empty switch.

## Method: convertToStringKeys
- parameter: `convmap`, type: `java.util.Map<java.lang.Integer,java.lang.String>`
- return type: `boolean`

Description: Convert a regular switch to a switch\-on\-strings. This operation is not reversible.
parameter: convmap: a map of current `integer-keys` to new `string-keys`; every            integer key must be accounted for, else this method will fail \(and the object be            left untouched\)
return: success indicator

## Method: deleteCase
- parameter: `key`, type: `java.lang.Object`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDTarget`

Description: Delete a case entry.
parameter: key: case key
return: the target,if the case existed; else, null

## Method: deleteCasesTo
- parameter: `offset`, type: `int`
- return type: `int`

Description: Delete all cases pointing to the provided target.
parameter: offset: target offset
return: the number of deleted cases

## Method: deleteCasesToTarget
- parameter: `target`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDTarget`
- return type: `int`

Description: Delete all cases pointing to the provided target.
parameter: target: target whose cases should be deleted
return: the number of deleted cases

## Method: duplicate
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDSwitchData`


## Method: getCaseCount
- return type: `int`

Description: Get the number of cases.
return: the case count

## Method: getCases
- return type: `java.util.Set<java.lang.Object>`

Description: Get the collection of case keys.
return: the case keys

## Method: getCasesAsInt
- return type: `java.util.Set<java.lang.Integer>`

Description: Get the collection of case keys as integers. The switch must be a regular switch.
return: the case keys as integers

## Method: getKeysForTargets
- parameter: `target`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDTarget`
- return type: `java.util.List<java.lang.Object>`

Description: Retrieve all case keys that point to the provided target.
parameter: target: target to look up
return: the case keys pointing to the target

## Method: getTargetCount
- return type: `int`

Description: Get the number of unique targets.
return: the number of unique targets

## Method: getTargetForCase
- parameter: `key`, type: `java.lang.Object`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDTarget`

Description: Get the target for the provided case key.
parameter: key: case key
return: the associated target, or null if no case exists for the key

## Method: getTargets
- parameter: `removeDuplicates`, type: `boolean`
- return type: `java.util.Collection<com.pnfsoftware.jeb.core.units.code.android.ir.IDTarget>`

Description: Get the collection of targets.
parameter: removeDuplicates: if true, the returned collection does not contain duplicate targets;            else, it may contain duplicate targets if two or more case keys point to the same            target
return: a collection of targets

## Method: isEmptySwitch
- return type: `boolean`

Description: Determine whether this switch is empty.
return: true if the switch has no cases

## Method: isRegularSwitch
- return type: `boolean`

Description: Determine whether this switch is a normal switch, switching on integer values. An empty switch is considered a regular switch.
return: true if case keys are integer values

## Method: isStringSwitch
- return type: `boolean`

Description: Determine whether this switch evaluates and switches on `string` immediates. Those switches cannot be directly created: a regular switch is converted to a string switch using [#convertToStringKeys(Map)](#convertToStringKeys(Map)).
return: true if case keys are string values

## Method: updateCases
- parameter: `oldOffset`, type: `int`
- parameter: `newOffset`, type: `int`
- return type: `int`

Description: Update case targets by offset. All cases pointing to the old target will be updated to point to the new target. Other cases are left untouched.
parameter: oldOffset: old target offset
parameter: newOffset: new target offset
return: the number of updates

## Method: updateCases
- parameter: `oldToNewOffsets`, type: `java.util.Map<java.lang.Integer,java.lang.Integer>`
- parameter: `failOnMissedEntry`, type: `boolean`
- return type: `int`

Description: Update all case targets by offset. A bulk version of [#updateCases(int, int)](#updateCases(int, int)).
parameter: oldToNewOffsets: map of old\-to\-new offset
parameter: failOnMissedEntry: if true, this method will throw an [IllegalArgumentException](IllegalArgumentException)            if an existing case target is unaccounted for
return: the number of updates

