public class Number extends Object implements Expression
| Constructor and Description |
|---|
Number(double numericValue,
String value,
String unit)
Creates a number with a known exact value, a string representation and a unit (might be "")
|
Number(String value)
Creates a new number based on the givens string.
|
| Modifier and Type | Method and Description |
|---|---|
Expression |
eval(Scope scope,
Generator gen)
If possible the expression is evaluated and a simplified expression is returned.
|
double |
getNumericValue()
The exact numeric value used to computations
|
String |
getUnit()
The unit of the number or "" if there is no unit.
|
String |
getValue()
Returns the string representation of the numeric value
|
boolean |
isConstant()
Determines if this expression is constant or if it depends on variables.
|
String |
toString() |
public Number(double numericValue,
String value,
String unit)
numericValue - the numeric value used for calculationsvalue - the string representation of the valueunit - the unit of the value. Use "" not null for empty units.public Number(String value)
value - the string representation of the number (and its unit).public String getValue()
public String getUnit()
public double getNumericValue()
public boolean isConstant()
ExpressionisConstant in interface Expressionpublic Expression eval(Scope scope, Generator gen)
Expressioneval in interface Expressionscope - the scope used to resolve variables.gen - the generator used to evaluate functionsCopyright © 2016. All rights reserved.