public final class SwitchList extends MutabilityControl
tableswitch or lookupswitch instruction. It
also holds the default target for the switch.| Constructor and Description |
|---|
SwitchList(int size)
Constructs an instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int value,
int target)
Adds the given item.
|
int |
getDefaultTarget()
Gets the default target.
|
int |
getTarget(int n)
Gets the indicated target.
|
IntList |
getTargets()
Gets the list of all targets.
|
int |
getValue(int n)
Gets the indicated test value.
|
IntList |
getValues()
Gets the list of all case values.
|
void |
removeSuperfluousDefaults()
Shrinks this instance if possible, removing test elements that
refer to the default target.
|
void |
setDefaultTarget(int target)
Sets the default target.
|
void |
setImmutable()
Makes this instance immutable.
|
int |
size()
Gets the size of the list.
|
isImmutable, isMutable, throwIfImmutable, throwIfMutablepublic SwitchList(int size)
size - >= 0; the number of elements to be in the tablepublic void setImmutable()
setImmutable in class MutabilityControlpublic int size()
>= 0; the list sizepublic int getValue(int n)
n - >= 0;, < size(); which indexpublic int getTarget(int n)
size()
returns the default target.n - >= 0, <= size(); which index>= 0; the targetpublic int getDefaultTarget()
getTarget(size()).>= 0; the default targetpublic IntList getTargets()
non-null; the target listpublic IntList getValues()
non-null; the case value listpublic void setDefaultTarget(int target)
target - >= 0; the absolute (not relative) default target
addresspublic void add(int value,
int target)
value - the test valuetarget - >= 0; the absolute (not relative) target addresspublic void removeSuperfluousDefaults()
Copyright © 2020. All Rights Reserved.