| Modifier and Type | Class and Description |
|---|---|
| private static class | Operators.
A suite is a list of overlapping operators, where some operators are prefixes of other operators. |
| private static class | Operators.
A list of suites in the reverse order of the suites. |
| Modifier and Type | Field and Description |
|---|---|
| private static final Comparator |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv static Lexicon | lexicon(final Collection<String> operatorNames)
Gets a |
| pack-priv static String[] |
| LONGER_STRING_FIRST | back to summary |
|---|---|
| private static final Comparator<String> LONGER_STRING_FIRST | |
| Operators | back to summary |
|---|---|
| pack-priv Operators() | |
| lexicon | back to summary |
|---|---|
| pack-priv static Lexicon lexicon(final Collection<String> operatorNames) Gets a Safely speaking, we can always start from the longest operator and falls back to shorter ones. Yet shorter operators are more often used than longer ones and the scanning of them is faster. However, scanning shorter operators first has the chance that a "==" is mistakenly scanned as "=" followed by another "=". In order to avoid this, we analyze the prefix relationship and make sure that prefixes are scanned after prefixes. | |
| sort | back to summary |
|---|---|
| pack-priv static String[] sort(String... names) Sorts
| |
For example ["==", "="]. Empty strings are ignored.
Upon a new string is added, We scan from the end of the list until a string is found to contain it, in which case, the new string is added right after the position.
With the critical requirement that longer strings are added before shorter ones, prefixes are always inserted later than prefixees.
| Modifier and Type | Method and Description |
|---|---|
| pack-priv boolean |
| list | back to summary |
|---|---|
| pack-priv final ArrayList<String> list | |
| Suite | back to summary |
|---|---|
| pack-priv Suite(String s) | |
| add | back to summary |
|---|---|
| pack-priv boolean add(String v) | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | |
| pack-priv String[] | toArray()
Collapses the names in each suite by traversing the suites in reverse order, so that smaller suites are collapsed first and generally shorter operators will be placed before longer ones unless it is contained by a longer operator. |
| list | back to summary |
|---|---|
| private final ArrayList<Operators. | |
| Suites | back to summary |
|---|---|
| private Suites() | |
| add | back to summary |
|---|---|
| pack-priv void add(String v) Scans the list of suites by adding | |
| toArray | back to summary |
|---|---|
| pack-priv String[] toArray() Collapses the names in each suite by traversing the suites in reverse order, so that smaller suites are collapsed first and generally shorter operators will be placed before longer ones unless it is contained by a longer operator. | |