Expression4j Expression4J

Sample > Prédefine function

About
Documentation
Sample
    Simple expression
    Agregated expression
    Predefined function
    User define function
    Custom element
    Custom operator
    External configuration
Download

Create an expression using a predefined function

Expression4j predefine a set of function:
  • abs(x)
  • acos(x)
  • asin(x)
  • atan(x)
  • ceil(x)
  • cos(x)
  • cosh(x)
  • exp(x)
  • floor(x)
  • log(x)
  • random()
  • sin(x)
  • sinh(x)
  • sqrt(x)
  • tan(x)
theses function are the same as functions define in Math class.

My first function expression with expression4j


public static void main(String[] args) {
try {
Expression expression = ExpressionFactory
.createExpression("f()=abs(-3)");
System.out.println("Expression name: " + expression.getName());
System.out.println("Value of expression:" +
expression.evaluate(null).getRealValue());
}
catch (Exception e) {
System.out.println("Error: " + e);
}
}
SourceForge.net Logo Support This Project