public abstract class StringSwitcher
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
StringSwitcher.Generator |
(package private) static interface |
StringSwitcher.StringSwitcherKey |
| Modifier and Type | Field and Description |
|---|---|
private static Signature |
INT_VALUE |
private static StringSwitcher.StringSwitcherKey |
KEY_FACTORY |
private static org.objectweb.asm.Type |
STRING_SWITCHER |
| Modifier | Constructor and Description |
|---|---|
protected |
StringSwitcher() |
| Modifier and Type | Method and Description |
|---|---|
static StringSwitcher |
create(java.lang.String[] strings,
int[] ints,
boolean fixedInput)
Helper method to create a StringSwitcher.
|
abstract int |
intValue(java.lang.String s)
Return the integer associated with the given key.
|
private static final org.objectweb.asm.Type STRING_SWITCHER
private static final Signature INT_VALUE
private static final StringSwitcher.StringSwitcherKey KEY_FACTORY
public static StringSwitcher create(java.lang.String[] strings, int[] ints, boolean fixedInput)
strings - the array of String keys; must be the same length as the value arrayints - the array of integer results; must be the same length as the key arrayfixedInput - if false, an unknown key will be returned from intValue(java.lang.String) as -1; if true,
the result will be undefined, and the resulting code will be fasterpublic abstract int intValue(java.lang.String s)
s - the key-1 if the key is unknown (unless
fixedInput was specified when this StringSwitcher was created,
in which case the return value for an unknown key is undefined)