com.pnfsoftware.jeb.core.units.code.java.IJavaSwitch |
Java AST interface to represent switch
statements. They support integer keys
(standard switch), String keys, and Enum keys. Limitation: These objects do not support
case-block replacement.
A switch-statement consists of an expression, zero or more cases and an optional default case.
Example:
switch(exp) case c0: b0 case c1: b1 default: b2
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
com.pnfsoftware.jeb.core.units.code.java.IJavaElement
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract void |
addCase(List<Integer> keys, IJavaBlock b)
Add a case to the switch
| ||||||||||
abstract void | addCase(Map<Integer, String> casekeymap, IJavaBlock b) | ||||||||||
abstract void | convertToSwitchOnEnum(IJavaExpression updatedSwitchedOnValue, Map<Integer, String> enummap) | ||||||||||
abstract void | convertToSwitchOnInteger(IJavaExpression updatedSwitchedOnValue) | ||||||||||
abstract void | convertToSwitchOnString(IJavaExpression updatedSwitchedOnValue, Map<Integer, String> indexToStringMap) | ||||||||||
abstract IJavaSwitch |
duplicate()
Duplicate this element.
| ||||||||||
abstract List<IJavaBlock> |
getCaseBodies()
Get the case bodies.
| ||||||||||
abstract IJavaBlock | getCaseBody(String stringkey) | ||||||||||
abstract IJavaBlock |
getCaseBody(int key)
Get a case body by key.
| ||||||||||
abstract SortedSet<Integer> |
getCaseKeys()
Get the list of case keys.
| ||||||||||
abstract IJavaBlock |
getDefaultBlock()
Get the default case block.
| ||||||||||
abstract IJavaBlock |
getDefaultBody()
This method is deprecated.
use
getDefaultBlock()
| ||||||||||
abstract Map<Integer, String> | getEnumMap() | ||||||||||
abstract Map<Integer, String> | getStringMap() | ||||||||||
abstract int | getSwitchType() | ||||||||||
abstract IJavaExpression |
getSwitchedExpression()
Get the expression being switched on.
| ||||||||||
abstract boolean |
hasDefaultBlock()
Determine if the switch block has a default case.
| ||||||||||
abstract boolean |
hasDefaultBody()
This method is deprecated.
use
hasDefaultBlock()
| ||||||||||
abstract boolean | isSwitchOnEnum() | ||||||||||
abstract boolean | isSwitchOnInteger() | ||||||||||
abstract boolean | isSwitchOnString() | ||||||||||
abstract boolean |
replaceSubElement(IJavaElement oldElement, IJavaElement newElement)
Note: case-replacements are currently not supported.
| ||||||||||
abstract void |
setDefaultBlock(IJavaBlock b)
Set the default case block for the switch.
| ||||||||||
abstract void |
setDefaultBody(IJavaBlock b)
This method is deprecated.
use
setDefaultBlock(IJavaBlock)
| ||||||||||
abstract void |
setSwitchedExpression(IJavaExpression e)
Set the switch expression.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
com.pnfsoftware.jeb.core.units.code.java.IJavaCompound
| |||||||||||
From interface
com.pnfsoftware.jeb.core.units.code.java.IJavaElement
| |||||||||||
From interface
com.pnfsoftware.jeb.core.units.code.java.IJavaExpression
| |||||||||||
From interface
com.pnfsoftware.jeb.core.units.code.java.IJavaStatement
|
Add a case to the switch
keys | mandatory list of keys, this list must contain at least one element |
---|---|
b | the case body |
Duplicate this element.
Get the case bodies.
Get a case body by key.
key | case key |
---|
Get the list of case keys.
Get the default case block.
Get the expression being switched on.
Determine if the switch block has a default case.
Note: case-replacements are currently not supported.
oldElement | the element to be replaced |
---|---|
newElement | the new element |
Set the default case block for the switch.
b | optional default case body, null to remove the default case |
---|
Set the switch expression.
e | mandatory expression |
---|