Follow the links below to browse sample Javadoc for MJ classes and tools, including the MJ Runtime Library.
The formula math
package contains the concrete MJ math formula classes
that evaluate expressions similar to those used in @CHG
and @ART
.
Classes and Interfaces | |
DecimalFormulaResultEncapsulator | Provides encapsulation that supports transformation of the result type to an appropriate floating-point result. |
FloatFormulaResultEncapsulator | Provides encapsulation that supports transformation of the result type to an appropriate floating-point result. |
FormulaResultEncapsulator | Provides a generic mechanism to convert from SpEL expression results (and raw Java types) to the corresponding formula result type. |
IntegerFormulaResultEncapsulator | Provides encapsulation that supports transformation of the result type to an appropriate integral result. |
MJMathFormula | Mathematical formula such as that used by the Mapper ART and CHG
commands. |
MJMathFormulaContext | Context for mathematical formulas. |
MJMathFormulaFactory | Factory that creates mathematical formulas. |
NumberFormulaResultEncapsulator | Provides encapsulation that supports transformation of the result type to an appropriate numeric result. |
public class com.arsi.mj.fml.math.DecimalFormulaResultEncapsulator
extends com.arsi.mj.fml.math.FormulaResultEncapsulator
Constructors |
public DecimalFormulaResultEncapsulator()
|
Methods |
Required implementation.
public com.arsi.mj.fml.MJFormulaResult buildResult(java.lang.Number aCalculationResult, java.util.EnumSet someOptions)
|
public class com.arsi.mj.fml.math.FloatFormulaResultEncapsulator
extends com.arsi.mj.fml.math.FormulaResultEncapsulator
Constructors |
public FloatFormulaResultEncapsulator()
|
Methods |
Required implementation.
public com.arsi.mj.fml.MJFormulaResult buildResult(java.lang.Number aCalculationResult, java.util.EnumSet someOptions)
|
<R>
- the result type
public abstract class com.arsi.mj.fml.math.FormulaResultEncapsulator
extends java.lang.Object
Constructors |
public FormulaResultEncapsulator()
|
Methods |
Determines the value of the SpEL formula expression when given a context.
public abstract com.arsi.mj.fml.MJFormulaResult buildResult(java.lang.Number aCalculationResult, java.util.EnumSet someOptions)
|
Encapsulates a decimal formula evaluation result.
protected com.arsi.mj.fml.MJFormulaResult getDecimalResult(java.lang.Number aResultValue)
|
Encapsulates a float formula evaluation result.
protected com.arsi.mj.fml.MJFormulaResult getFloatResult(java.lang.Number aResultValue)
|
Encapsulates an integer (no decimal content) formula evaluation result.
protected com.arsi.mj.fml.MJFormulaResult getIntegerResult(java.lang.Number aResultValue, java.util.EnumSet someOptions)
|
public class com.arsi.mj.fml.math.IntegerFormulaResultEncapsulator
extends com.arsi.mj.fml.math.FormulaResultEncapsulator
Constructors |
public IntegerFormulaResultEncapsulator()
|
Methods |
Required implementation.
public com.arsi.mj.fml.MJFormulaResult buildResult(java.lang.Number aCalculationResult, java.util.EnumSet someOptions)
|
ART
and CHG
commands. Supported operators are:
+
addition
-
subtraction
*
multiplication
/
division
%
modulus
^
power
SQRT(x)
take square root of argument x
Treat this class as "thread-hostile"; instances should be created, used and discarded by a single thread at a time.
<T>
- the expected return type of the formula upon evaluation (e.g., BigDecimal
).<C>
- type of formula context expected by formula.
public class com.arsi.mj.fml.math.MJMathFormula
extends java.lang.Object
implements com.arsi.mj.fml.IFormula
Constructors |
Restricted ctor for initializing an instance of this class.
public MJMathFormula(java.util.EnumSet someOptions, com.arsi.mj.fml.math.FormulaResultEncapsulator encapsulator)
|
Methods |
Required implementation.
public com.arsi.mj.fml.MJFormulaResult evaluate(java.lang.String aFormula, com.arsi.mj.fml.math.MJMathFormulaContext aContext)
|
Context for mathematical formulas.
Treat this class as "thread-hostile"; instances should be created, used and discarded by a single thread at a time.
public class com.arsi.mj.fml.math.MJMathFormulaContext
extends com.arsi.mj.fml.MJFormulaContext
Constructors |
Public ctor for creating an instance of this class with a NULL variable transformer
for unit testing.
public MJMathFormulaContext(com.arsi.mj.variable.MJVariableNamespace aGlobalNS, com.arsi.mj.variable.MJVariableNamespace aEnvNS, com.arsi.mj.variable.MJVariableNamespace aLocalNS, com.arsi.mj.variable.MJVariableNamespace aTempNS)
|
Public ctor for creating an instance of this class.
public MJMathFormulaContext(com.arsi.mj.variable.MJVariableNamespace aGlobalNS, com.arsi.mj.variable.MJVariableNamespace aEnvNS, com.arsi.mj.variable.MJVariableNamespace aLocalNS, com.arsi.mj.variable.MJVariableNamespace aTempNS, com.arsi.mj.maprpt.vidxform.MJVariableIdentifierTransformer aTransformer)
|
Methods |
Determine the absolute value of the variable.
public com.arsi.mj.fml.impl.NumericOperand abs(com.arsi.mj.variable.MJVariable aVariable)
|
Determine the absolute value of the number.
public com.arsi.mj.fml.impl.NumericOperand abs(java.lang.Number aValue)
|
Determine the arccosine of the variable.
public com.arsi.mj.fml.impl.NumericOperand acos(com.arsi.mj.variable.MJVariable aVariable)
|
Determine the arccosine of the number.
public com.arsi.mj.fml.impl.NumericOperand acos(java.lang.Number aValue)
|
Determine the arcsine of the variable.
public com.arsi.mj.fml.impl.NumericOperand asin(com.arsi.mj.variable.MJVariable aVariable)
|
Determine the arcsine of the number.
public com.arsi.mj.fml.impl.NumericOperand asin(java.lang.Number aValue)
|
Determine the arctangent of the variable.
public com.arsi.mj.fml.impl.NumericOperand atan(com.arsi.mj.variable.MJVariable aVariable)
|
Determine the arctangent of the number.
public com.arsi.mj.fml.impl.NumericOperand atan(java.lang.Number aValue)
|
Determine the cube root of the variable.
public com.arsi.mj.fml.impl.NumericOperand cbrt(com.arsi.mj.variable.MJVariable aVariable)
|
Determine the cube root of the number.
public com.arsi.mj.fml.impl.NumericOperand cbrt(java.lang.Number aValue)
|
Centralizes conversion of a single option set to an array of sets. Unchecked conversion is
needed due to the nature of Java generics.
public static java.util.EnumSet convertToOptionArray(java.util.EnumSet someOptions)
|
Determine the cosine of the variable.
public com.arsi.mj.fml.impl.NumericOperand cos(com.arsi.mj.variable.MJVariable aVariable)
|
Determine the cosine of the number.
public com.arsi.mj.fml.impl.NumericOperand cos(java.lang.Number aValue)
|
Determine the cotangent of the variable.
public com.arsi.mj.fml.impl.NumericOperand ctn(com.arsi.mj.variable.MJVariable aVariable)
|
Determine the cotangent of the number.
public com.arsi.mj.fml.impl.NumericOperand ctn(java.lang.Number aValue)
|
Converts the provided content to a numeric representation suitable for decimal math. It is
assumed the input can be parsed.
public com.arsi.mj.fml.impl.NumericOperand dec(java.lang.String aParsedLiteral)
|
Determine the value of the variable (in radians) in degrees.
public com.arsi.mj.fml.impl.NumericOperand deg(com.arsi.mj.variable.MJVariable aVariable)
|
Determine the value of the number (in radians) in degrees.
public com.arsi.mj.fml.impl.NumericOperand deg(java.lang.Number aValue)
|
Performs integral division for the provided operands.
public com.arsi.mj.fml.impl.NumericOperand div(java.lang.Object aDivisor, java.lang.Object aDividend)
|
Determine the fractional portion of the variable.
public com.arsi.mj.fml.impl.NumericOperand frac(com.arsi.mj.variable.MJVariable aVariable)
|
Determine the fractional portion of the number.
public com.arsi.mj.fml.impl.NumericOperand frac(java.lang.Number aValue)
|
Determine the hyperbolic cosine of the variable.
public com.arsi.mj.fml.impl.NumericOperand hcos(com.arsi.mj.variable.MJVariable aVariable)
|
Determine the hyperbolic cosine of the number.
public com.arsi.mj.fml.impl.NumericOperand hcos(java.lang.Number aValue)
|
Determine the hyperbolic sine of the variable.
public com.arsi.mj.fml.impl.NumericOperand hsin(com.arsi.mj.variable.MJVariable aVariable)
|
Determine the hyperbolic sine of the number.
public com.arsi.mj.fml.impl.NumericOperand hsin(java.lang.Number aValue)
|
Determine the hyperbolic tangent of the variable.
public com.arsi.mj.fml.impl.NumericOperand htan(com.arsi.mj.variable.MJVariable aVariable)
|
Determine the hyperbolic tangent of the number.
public com.arsi.mj.fml.impl.NumericOperand htan(java.lang.Number aValue)
|
Determine the natural log of the variable.
public com.arsi.mj.fml.impl.NumericOperand log(com.arsi.mj.variable.MJVariable aVariable)
|
Determine the natural log of the number.
public com.arsi.mj.fml.impl.NumericOperand log(java.lang.Number aValue)
|
Determine the log (base 10) of the variable.
public com.arsi.mj.fml.impl.NumericOperand log10(com.arsi.mj.variable.MJVariable aVariable)
|
Determine the log (base 10) of the number.
public com.arsi.mj.fml.impl.NumericOperand log10(java.lang.Number aValue)
|
Converts a numeric literal into an MJ-supported math operand.
public com.arsi.mj.fml.impl.NumericOperand n(java.lang.Number aNumericLiteral)
|
Converts a string literal with numeric content into an MJ-supported math operand.
public com.arsi.mj.fml.impl.NumericOperand n(java.lang.String aStringLiteral)
|
Determine the value of the variable (in degrees) in radians.
public com.arsi.mj.fml.impl.NumericOperand rad(com.arsi.mj.variable.MJVariable aVariable)
|
Determine the value of the number (in degrees) in radians.
public com.arsi.mj.fml.impl.NumericOperand rad(java.lang.Number aValue)
|
Allows injection of the current formula options for calculation.
public void setOptions(java.util.EnumSet options)
|
Determine the sine of the variable.
public com.arsi.mj.fml.impl.NumericOperand sin(com.arsi.mj.variable.MJVariable aVariable)
|
Determine the sine of the number.
public com.arsi.mj.fml.impl.NumericOperand sin(java.lang.Number aValue)
|
Determine the square root of the variable.
public com.arsi.mj.fml.impl.NumericOperand sqrt(com.arsi.mj.variable.MJVariable aVariable)
|
Determine the square root of the number.
public com.arsi.mj.fml.impl.NumericOperand sqrt(java.lang.Number aValue)
|
Determine the tangent of the variable.
public com.arsi.mj.fml.impl.NumericOperand tan(com.arsi.mj.variable.MJVariable aVariable)
|
Determine the tangent of the number.
public com.arsi.mj.fml.impl.NumericOperand tan(java.lang.Number aValue)
|
public class com.arsi.mj.fml.math.MJMathFormulaFactory
extends com.arsi.mj.fml.MJFormulaFactory
Constructors |
Initializes the instance with the data provided.
public MJMathFormulaFactory()
|
Methods |
Required implementation.
public com.arsi.mj.fml.IFormula createDecimalFormula(java.util.EnumSet someOptions)
|
Required implementation.
public com.arsi.mj.fml.IFormula createFloatFormula(java.util.EnumSet someOptions)
|
Required implementation.
public com.arsi.mj.fml.math.MJMathFormula createFormula(java.util.EnumSet someOptions)
|
Required implementation.
public com.arsi.mj.fml.math.MJMathFormula createIntegerFormula(java.util.EnumSet someOptions)
|
public class com.arsi.mj.fml.math.NumberFormulaResultEncapsulator
extends com.arsi.mj.fml.math.FormulaResultEncapsulator
Constructors |
public NumberFormulaResultEncapsulator()
|
Methods |
Required implementation.
public com.arsi.mj.fml.MJFormulaResult buildResult(java.lang.Number aCalculationResult, java.util.EnumSet someOptions)
|