public class Mnemonic extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
CASE_LOWER |
static int |
CASE_SENSITIVE |
static int |
CASE_UPPER |
| Constructor and Description |
|---|
Mnemonic(String description,
int wordcase)
Creates a new Mnemonic table.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int val,
String str)
Defines the text representation of a numeric value.
|
void |
addAlias(int val,
String str)
Defines an additional text representation of a numeric value.
|
void |
addAll(Mnemonic source)
Copies all mnemonics from one table into another.
|
void |
check(int val)
Checks that a numeric value is within the range [0..max]
|
String |
getText(int val)
Gets the text mnemonic corresponding to a numeric value.
|
int |
getValue(String str)
Gets the numeric value corresponding to a text mnemonic.
|
void |
setMaximum(int max)
Sets the maximum numeric value
|
void |
setNumericAllowed(boolean numeric)
Sets whether numeric values stored in strings are acceptable.
|
void |
setPrefix(String prefix)
Sets the prefix to use when converting to and from values that don't
have mnemonics.
|
static Integer |
toInteger(int val)
Converts an int into a possibly cached Integer.
|
public static final int CASE_SENSITIVE
public static final int CASE_UPPER
public static final int CASE_LOWER
public Mnemonic(String description, int wordcase)
description - A short description of the mnemonic to use whenwordcase - Whether to convert strings into uppercase, lowercase,
or leave them unchanged.
throwing exceptions.public void setMaximum(int max)
public void setPrefix(String prefix)
public void setNumericAllowed(boolean numeric)
public static Integer toInteger(int val)
public void check(int val)
public void add(int val,
String str)
val - The numeric valuestring - The text stringpublic void addAlias(int val,
String str)
val - The numeric valuestring - The text stringpublic void addAll(Mnemonic source)
val - The numeric valuestring - The text stringIllegalArgumentException - The wordcases of the Mnemonics do not
match.public String getText(int val)
val - The numeric valuepublic int getValue(String str)
str - The text mnemonicCopyright © 2021 McEvoy Software Ltd. All rights reserved.