Package org.meteoinfo.data.mathparser
Class OperatorExpression
- java.lang.Object
-
- org.meteoinfo.data.mathparser.ExpressionBase
-
- org.meteoinfo.data.mathparser.OperatorExpression
-
- All Implemented Interfaces:
IExpression
public class OperatorExpression extends ExpressionBase
-
-
Constructor Summary
Constructors Constructor Description OperatorExpression(java.lang.String operator)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectadd(java.lang.Object[] numbers)Add of the specified numbersjava.lang.Objectdivide(java.lang.Object[] numbers)Divide of the specified numbersjava.lang.Objectevaluate(java.lang.Object[] numbers)Math evaluateintgetArgumentCount()Get the number of arguments this expression usesstatic booleanisSymbol(char c)Determines whether the specified char is a math symbolstatic booleanisSymbol(java.lang.String s)Determines whether the specified string is a math symboljava.lang.Objectmultiple(java.lang.Object[] numbers)Multiple of the specified numbersjava.lang.Objectpower(java.lang.Object[] numbers)Power of the specified numbersjava.lang.Objectsubtract(java.lang.Object[] numbers)Subtract of the specified numbersjava.lang.StringtoString()-
Methods inherited from class org.meteoinfo.data.mathparser.ExpressionBase
validate
-
-
-
-
Method Detail
-
getArgumentCount
public int getArgumentCount()
Description copied from interface:IExpressionGet the number of arguments this expression uses- Specified by:
getArgumentCountin interfaceIExpression- Specified by:
getArgumentCountin classExpressionBase- Returns:
- The argument count
-
evaluate
public java.lang.Object evaluate(java.lang.Object[] numbers)
Description copied from interface:IExpressionMath evaluate- Parameters:
numbers- The numbers to evaluate- Returns:
- The result of the evaluated numbers
-
add
public java.lang.Object add(java.lang.Object[] numbers)
Add of the specified numbers- Parameters:
numbers- The numbers- Returns:
- The result of the operation
-
subtract
public java.lang.Object subtract(java.lang.Object[] numbers)
Subtract of the specified numbers- Parameters:
numbers- The numbers- Returns:
- The result of the operation
-
multiple
public java.lang.Object multiple(java.lang.Object[] numbers)
Multiple of the specified numbers- Parameters:
numbers- The numbers- Returns:
- The result of the operation
-
divide
public java.lang.Object divide(java.lang.Object[] numbers)
Divide of the specified numbers- Parameters:
numbers- The numbers- Returns:
- The result of the operation
-
power
public java.lang.Object power(java.lang.Object[] numbers)
Power of the specified numbers- Parameters:
numbers- The numbers- Returns:
- The result of the operation
-
isSymbol
public static boolean isSymbol(java.lang.String s)
Determines whether the specified string is a math symbol- Parameters:
s- The string to check- Returns:
- If the string is a math symbol
-
isSymbol
public static boolean isSymbol(char c)
Determines whether the specified char is a math symbol- Parameters:
c- The char to check- Returns:
- If the char is a math symbol
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-