|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpmp.AbstractMacro
pmp.macro.math.Eval
public class Eval
Evaluates given expression.
Recognized elements are integers and real numbers, operators +
,-
,*
,/
,%
(modulo), ^
(power), =
(compare for equality),
>
(compare - greater than), <
(compare -
less then) brackets (
, )
and functions.
Functions are identified by ther name (case-insensitively) and arguments
enclosed in brackets and separated by commas. See documentation of enum class
Eval.Function
for list of available functions.
Table of operator priorities:
^ | highest priority - power |
* , / , % |
multiplicative operators |
+ , - |
additive operators |
= , > , < |
comparative operators |
Whitespace characters are ignored.
Title: PMP: Macroprocessor
Description: Java macroprocessor
Copyright: Copyright (c) 2005
Nested Class Summary | |
---|---|
protected static class |
Eval.Function
This enumerated type handles function calling. |
Field Summary | |
---|---|
protected static java.lang.String |
ID_FORMAT
|
protected static java.lang.String |
NUMBER_FORMAT_BIN
|
protected static java.lang.String |
NUMBER_FORMAT_FLOAT
|
protected static java.lang.String |
NUMBER_FORMAT_HEX
|
static int |
PARAMS_REQUIRED
|
Constructor Summary | |
---|---|
Eval()
|
Method Summary | |
---|---|
(package private) java.lang.Number |
parse(java.lang.String arg)
Parses string expresion. |
java.lang.String |
run(Macroprocessor mp,
java.lang.String[] args)
Main method of macro. |
Methods inherited from class pmp.AbstractMacro |
---|
getRequiredParams, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int PARAMS_REQUIRED
protected static final java.lang.String NUMBER_FORMAT_BIN
protected static final java.lang.String NUMBER_FORMAT_HEX
protected static final java.lang.String NUMBER_FORMAT_FLOAT
protected static final java.lang.String ID_FORMAT
Constructor Detail |
---|
public Eval()
Method Detail |
---|
public java.lang.String run(Macroprocessor mp, java.lang.String[] args)
AbstractMacro
run
in class AbstractMacro
mp
- reference to Macroprocessorargs
- parameters of macro. In args[0] is stored name of macro.
Subclasses are free to modify this array.
java.lang.Number parse(java.lang.String arg) throws java.lang.IllegalArgumentException
This method is provided for other macros.
java.lang.IllegalArgumentException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |