| Modifier and Type | Class and Description |
|---|---|
| private class | |
| private static enum |
| Modifier and Type | Field and Description |
|---|---|
| private List | |
| private static Pattern | |
| private EnumSet | |
| private Map |
| Access | Constructor and Description |
|---|---|
| public | |
| public | Calculator(String s, Map<String, String> vars)
Every integer, var name, and single-math-op-character get their own tokens here. |
| Modifier and Type | Method and Description |
|---|---|
| private long | |
| public static void | |
| public static long | |
| public long | Returns: Value that all visited atoms reduce to.If atoms[startAtomIndex] == '(', then last visited atoms will be the next top-level (un-paired) ')'. |
| public String |
| atoms | back to summary |
|---|---|
| private List<Calculator. | |
| intPattern | back to summary |
|---|---|
| private static Pattern intPattern | |
| TradOrLParen | back to summary |
|---|---|
| private EnumSet<Calculator. | |
| vars | back to summary |
|---|---|
| private Map<String, String> vars | |
| Calculator | back to summary |
|---|---|
| public Calculator(String[] sa, Map<String, String> vars) | |
| Calculator | back to summary |
|---|---|
| public Calculator(String s, Map<String, String> vars) Every integer, var name, and single-math-op-character get their own tokens here. Special processesing is needed afterwards because negative signs get separated into separate tokens. | |
| deref | back to summary |
|---|---|
| private long deref(String varName) | |
| main | back to summary |
|---|---|
| public static void main(String[] sa) | |
| reassignValue | back to summary |
|---|---|
| public static long reassignValue(String assignee, Map<String, String> valMap, String opStr, String expr) Does not actually do the assigment, but validates the input variable and returns the value ready to be assigned to it. | |
| reduce | back to summary |
|---|---|
| public long reduce(int startAtomIndex, boolean stopAtParenClose) If atoms[startAtomIndex] == '(', then last visited atoms will be the next top-level (un-paired) ')'. Otherwise, all remainign atoms will be visited. Every visited atom will be removed from 'atoms'.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| Modifier and Type | Field and Description |
|---|---|
| public Calculator. | |
| public long |
| Access | Constructor and Description |
|---|---|
| private | |
| private | |
| private |
| Modifier and Type | Method and Description |
|---|---|
| public String |
| Atom | back to summary |
|---|---|
| private Atom(String token) | |
| Atom | back to summary |
|---|---|
| private Atom(Calculator. | |
| Atom | back to summary |
|---|---|
| private Atom(long val) | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| Modifier and Type | Field and Description |
|---|---|
| public static final Calculator. | |
| private char | |
| public static final Calculator. | |
| public static final Calculator. | |
| public static final Calculator. | |
| public static final Calculator. | |
| public static final Calculator. | |
| public static final Calculator. | |
| public static final Calculator. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public String | toString()
Overrides java. Returns the name of this enum constant, as contained in the declaration. |
| public static Calculator. | |
| public static Calculator. | |
| public static Calculator. |
| ADD | back to summary |
|---|---|
| public static final Calculator. | |
| c | back to summary |
|---|---|
| private char c | |
| DIVIDE | back to summary |
|---|---|
| public static final Calculator. | |
| LPAREN | back to summary |
|---|---|
| public static final Calculator. | |
| MULTIPLY | back to summary |
|---|---|
| public static final Calculator. | |
| POWER | back to summary |
|---|---|
| public static final Calculator. | |
| REM | back to summary |
|---|---|
| public static final Calculator. | |
| RPAREN | back to summary |
|---|---|
| public static final Calculator. | |
| SUBTRACT | back to summary |
|---|---|
| public static final Calculator. | |
| MathOp | back to summary |
|---|---|
| private MathOp(char c) | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns the name of this enum constant, as contained in the declaration. This method may be overridden, though it typically isn't necessary or desirable. An enum class should override this method when a more "programmer-friendly" string form exists. | |
| valueOf | back to summary |
|---|---|
| public static Calculator. | |
| valueOf | back to summary |
|---|---|
| public static Calculator. | |
| values | back to summary |
|---|---|
| public static Calculator. | |