![]() | [using it] | Interface Manipulation Package v4.0 (2008-06-25) | ![]() | ©copyright | ![]() |
java.lang.Objectimp.core.Value
imp.core.Structure
imp.core.Expression
public class Expression
Implements a expression.
[a] algebraic operators |
+ - * / % for sum, subtraction, product, division and remainder, ^ for power |
[l] logical operators |
& means and, i.e. conjunction, | means or, i.e. disjunction, ! means not, i.e. negation |
[r] relational operators |
== != < > <= >= for inequalities, v @ min .. max means between min and max, v @ s means in a set |
[f] functional definitions |
pattern -> result defines a recursion equation, $variable : type defines a variable, $variable = value
defines a value, pattern ; condition defines a boolean condition in a pattern, $name denotes a variable |
[f] path definitions |
? means once or not at all, ?* means zero or more times, ?+ means zero or more times, | means either-or,
$name denotes a variable, @name denotes a field |
Symbol. | -> | = | : | := | ; | | | & | ! | == | != | >= | <= | > | < | @ | .. | + | - | * | / | % | ^ | . | - | # | $ | ? | ?* | ?+ | |
Type. | infix | infix | infix | infix | infix | infix | infix | prefix | infix | infix | infix | infix | infix | infix | infix | infix | infix | infix | infix | infix | infix | infix | infix | prefix | prefix | prefix | postfix | postfix | postfix | |
Class. | [f] | [f] | [f] | [f] | [f] | [l] | [l] | [l] | [r] | [r] | [r] | [r] | [r] | [r] | [r] | [r] | [a] | [a] | [a] | [a] | [a] | [a] | [a] | [a] | [f] | [f] | [f] | [f] | [f] |
Conditional expressions: | if condition then true-expression else false-expression |
corresponds to the term if(condition, true-expression, false-expression) | |
has also an extended form if c_1 then e_1 elif c_2 then e_2 .. else e_0 | |
Indexed iteration: | for index from begin-value by step-value to end while condition do statement |
corresponds to the term for-to(index, begin-value, step-value, end-value, condition, statement) | |
may have the: from begin-value (1 by default), by step-value (1 by default), while condition (true by default) part omitted | |
Set iteration: | for field in set while condition do statement |
corresponds to the term for-in(field, set, condition, statement) | |
may have the: while condition (true by default) part omitted | |
List: | [element_1, element_2 .. ] |
corresponds to the term list(element_1, element_2 ..) |
Field Summary |
---|
Fields inherited from class imp.core.Value |
---|
NULL |
Constructor Summary | |
---|---|
Expression(String type)
Constructs an expression of the given type. |
Method Summary | |
---|---|
static Value |
create(String value)
Creates an expression from a string definition and return it. |
static String |
toString(Value expression)
Returns the expression as a String. |
Methods inherited from class imp.core.Structure |
---|
clear, indexOf, setType, sort |
Methods inherited from class imp.core.Value |
---|
cloneThis, get, getWrapping, isCyclic, isName, load, main, save, toString, wrappedObject |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Expression(String type)
type
- [optional, default is imp:expression] Expression typeMethod Detail |
---|
public static final Value create(String value) throws IllegalArgumentException
value
- The value defined as an XML string.
IllegalArgumentException
- If the value can not be parsed.public static String toString(Value expression)