
com.fathzer.soft.javaluator.Constant Maven / Gradle / Ivy
package com.fathzer.soft.javaluator;
/**
* A constant in an expression.
*
Some expressions needs constants. For instance it is impossible to perform trigonometric calculus without using pi.
* A constant allows you to use mnemonic in your expressions instead of the raw value of the constant.
*
A constant for pi would be defined by :
* Constant pi = new Constant("pi");
*
With such a constant, you will be able to evaluate the expression "sin(pi/4)"
* @author Jean-Marc Astesana
* @see License information
* @see AbstractEvaluator#evaluate(Constant, Object)
*/
public class Constant {
private String name;
/** Constructor
* @param name The mnemonic of the constant.
*
The name is used in expressions to identified the constants.
*/
public Constant(String name) {
this.name = name;
}
/** Gets the mnemonic of the constant.
* @return the id
*/
public String getName() {
return name;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy