| java.lang.Object EDU.purdue.cs.bloat.editor.Switch
Switch | public class Switch (Code) | | Switch is used to hold the lookup values and branch targets of a tableswitch
or lookup switch instruction.
The tableswitch low-to-high range of values is represented by storing each
lookup value in the range. This allows the tableswitch to be replaced with a
lookupswitch if branches are deleted.
author: Nate Nystrom (author: href="mailto:nystrom@cs.purdue.edu">nystrom@cs.purdue.edu) |
Constructor Summary | |
public | Switch(Label defaultTarget, Label[] targets, int[] values) Constructor.
Parameters: defaultTarget - The default target of the switch. Parameters: targets - The non-default branch targets of the switch. Parameters: values - The lookup values of the switch. |
Method Summary | |
public Label | defaultTarget() Get the default target of the switch. | public boolean | hasContiguousValues() Check if the all the values in the range of lookup values are contiguous.
If they are, a table switch can be used. | public int | highValue() Get the high value in the range the lookup values. | public int | lowValue() Get the low value in the range the lookup values. | public void | setDefaultTarget(Label target) Set the default target of the switch. | public Label[] | targets() Get the non-default branch targets of the switch. | public String | toString() Convert the operand to a string. | public int[] | values() Get the lookup values of the switch, sorted low to high. |
Switch | public Switch(Label defaultTarget, Label[] targets, int[] values)(Code) | | Constructor.
Parameters: defaultTarget - The default target of the switch. Parameters: targets - The non-default branch targets of the switch. Parameters: values - The lookup values of the switch. This array must be the samesize as the targets array. |
defaultTarget | public Label defaultTarget()(Code) | | Get the default target of the switch.
The default target of the switch. |
hasContiguousValues | public boolean hasContiguousValues()(Code) | | Check if the all the values in the range of lookup values are contiguous.
If they are, a table switch can be used. If not a lookupswitch can be
used.
true if contiguous, false if not. |
highValue | public int highValue()(Code) | | Get the high value in the range the lookup values.
The high value. |
lowValue | public int lowValue()(Code) | | Get the low value in the range the lookup values.
The low value. |
setDefaultTarget | public void setDefaultTarget(Label target)(Code) | | Set the default target of the switch.
Parameters: target - The default target of the switch. |
targets | public Label[] targets()(Code) | | Get the non-default branch targets of the switch. The targets are sorted
by the corresponding lookup value.
The non-default branch targets of the switch. |
toString | public String toString()(Code) | | Convert the operand to a string.
A string representation of the operand. |
values | public int[] values()(Code) | | Get the lookup values of the switch, sorted low to high.
The lookup values of the switch. |
|
|