|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectvec_math.ExpressionParser
public class ExpressionParser
A class providing arithmetics for expressions. For right-hand acting operators, like sin, no brackets are required, but their use is encouraged. Note that boolean operators only act on true booleans, not on longs. All the operators supported are (sorted for precedence):
0.3Yreal2$-2$0.2for Y2,-2(0.3, 0.2).
#valueOf method, it is parsed and the result is returned as a
Double. Parsing errors result in a
ParseException to be thrown. Please note that a
ParseException is not a runtime exception, therefore it
must be caught in calling routines.
| Nested Class Summary | |
|---|---|
static class |
ExpressionParser.Test
Mainly test purpose. |
| Field Summary | |
|---|---|
private static double |
THETA0
The lower boundary on zonal harmonics. |
private static double |
THETA1
The upper boundary on zonal harmonics. |
private static List<Operator<String>> |
valid
All valid operators. |
| Constructor Summary | |
|---|---|
ExpressionParser()
|
|
| Method Summary | |
|---|---|
static Boolean |
evaluateBoolean(String expression)
Parses the node and returns the expression as a Boolean object. |
private static String |
evaluateNode(Node<String> root)
Evaluates a node. |
static Number |
evaluateNumber(String expression)
Parses the expresion into a number, if possible. |
private static String |
evaluateSingle(Operator<String> tie,
String left,
String right)
Evaluates a single boolean expression. |
protected static List<Operator<String>> |
getValid()
Returns all valid operator in this parsers context. |
private static boolean |
isFloat(Object check)
Checks if the argument is a float. |
private static boolean |
isInteger(Object check)
Checks if the argument object is an integer. |
static String |
parseExpression(String expression)
Parses the given string to obtain a single boolean value. |
private static Number |
parseNumber(String s)
Tries to parse the input string as a Number. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final List<Operator<String>> valid
private static final double THETA0
private static final double THETA1
| Constructor Detail |
|---|
public ExpressionParser()
| Method Detail |
|---|
public static String parseExpression(String expression)
throws ParseException
expression - A String combining double constants
ParseException - If the argument does not obey the specified
grammar.
public static Number evaluateNumber(String expression)
throws ParseException
ParseException
public static Boolean evaluateBoolean(String expression)
throws ParseException
ParseExceptionprotected static List<Operator<String>> getValid()
private static String evaluateNode(Node<String> root)
throws ParseException
ParseException
private static String evaluateSingle(Operator<String> tie,
String left,
String right)
throws ParseException
ParseExceptionprivate static final Number parseNumber(String s)
private static final boolean isInteger(Object check)
private static final boolean isFloat(Object check)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||