Follow the links below to browse sample Javadoc for MJ classes and tools, including the MJ Runtime Library.

 

Package: com.arsi.mj.fml.math  previous next contents

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.

Class: DecimalFormulaResultEncapsulator   next package

Provides encapsulation that supports transformation of the result type to an appropriate floating-point result.
public class com.arsi.mj.fml.math.DecimalFormulaResultEncapsulator
  extends com.arsi.mj.fml.math.FormulaResultEncapsulator
Constructors
public DecimalFormulaResultEncapsulator()
Methods
Required implementation.
See Also:
com.arsi.mj.fml.math.FormulaResultEncapsulator#buildResult(java.lang.Number, java.util.EnumSet)
public com.arsi.mj.fml.MJFormulaResult buildResult(java.lang.Number aCalculationResult, java.util.EnumSet someOptions)

Class: FloatFormulaResultEncapsulator   previous next package

Provides encapsulation that supports transformation of the result type to an appropriate floating-point result.
public class com.arsi.mj.fml.math.FloatFormulaResultEncapsulator
  extends com.arsi.mj.fml.math.FormulaResultEncapsulator
Constructors
public FloatFormulaResultEncapsulator()
Methods
Required implementation.
See Also:
com.arsi.mj.fml.math.FormulaResultEncapsulator#buildResult(java.lang.Number, java.util.EnumSet)
public com.arsi.mj.fml.MJFormulaResult buildResult(java.lang.Number aCalculationResult, java.util.EnumSet someOptions)

Class: FormulaResultEncapsulator   previous next package

Provides a generic mechanism to convert from SpEL expression results (and raw Java types) to the corresponding formula result type.
Parameters:
<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.
Parameters:
aCalculationResult - the evaluation result from the formula
someOptions - the math options to use during calculations
aParsedFormula - the expression derived from the provided formula
Returns:
an appropriately-encapsulated result
public abstract com.arsi.mj.fml.MJFormulaResult buildResult(java.lang.Number aCalculationResult, java.util.EnumSet someOptions)
Encapsulates a decimal formula evaluation result.
Parameters:
aResultValue - the expression evaluation data
Returns:
the encapsulated result
protected com.arsi.mj.fml.MJFormulaResult getDecimalResult(java.lang.Number aResultValue)
Encapsulates a float formula evaluation result.
Parameters:
aResultValue - the expression evaluation data
Returns:
the encapsulated result
protected com.arsi.mj.fml.MJFormulaResult getFloatResult(java.lang.Number aResultValue)
Encapsulates an integer (no decimal content) formula evaluation result.
Parameters:
aResultValue - the expression evaluation data
someOptions - the math options to use during calculations
Returns:
the encapsulated result
protected com.arsi.mj.fml.MJFormulaResult getIntegerResult(java.lang.Number aResultValue, java.util.EnumSet someOptions)

Class: IntegerFormulaResultEncapsulator   previous next package

Provides encapsulation that supports transformation of the result type to an appropriate integral result.
public class com.arsi.mj.fml.math.IntegerFormulaResultEncapsulator
  extends com.arsi.mj.fml.math.FormulaResultEncapsulator
Constructors
public IntegerFormulaResultEncapsulator()
Methods
Required implementation.
See Also:
com.arsi.mj.fml.math.FormulaResultEncapsulator#buildResult(java.lang.Number, java.util.EnumSet)
public com.arsi.mj.fml.MJFormulaResult buildResult(java.lang.Number aCalculationResult, java.util.EnumSet someOptions)

Class: MJMathFormula   previous next package

Mathematical formula such as that used by the Mapper ART and CHG commands. Supported operators are: and functions:

Treat this class as "thread-hostile"; instances should be created, used and discarded by a single thread at a time.

Parameters:
<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.
Parameters:
someOptions - the options to use during calculation
encapsulator - the result encapsulation implementation to use
anApplicationContext - the current Spring application context
public MJMathFormula(java.util.EnumSet someOptions, com.arsi.mj.fml.math.FormulaResultEncapsulator encapsulator)
Methods
Required implementation.
See Also:
com.arsi.mj.fml.IFormula#evaluate(java.lang.String, com.arsi.mj.fml.MJFormulaContext)
public com.arsi.mj.fml.MJFormulaResult evaluate(java.lang.String aFormula, com.arsi.mj.fml.math.MJMathFormulaContext aContext)
    throws com.arsi.mj.MJExecuteException

Class: MJMathFormulaContext   previous next package

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.
Parameters:
aGlobalNS - global variable namespace.
aEnvNS - environmental variable namespace.
aLocalNS - local variable namespace.
aTempNS - temporary variable namespace
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.
Parameters:
aGlobalNS - global variable namespace.
aEnvNS - environmental variable namespace.
aLocalNS - local variable namespace.
aTempNS - temporary variable namespace
aTransformer - variable transformation utility
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.
Parameters:
aVariable - the variable to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand abs(com.arsi.mj.variable.MJVariable aVariable)
Determine the absolute value of the number.
Parameters:
aValue - the value to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand abs(java.lang.Number aValue)
Determine the arccosine of the variable.
Parameters:
aVariable - the variable to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand acos(com.arsi.mj.variable.MJVariable aVariable)
Determine the arccosine of the number.
Parameters:
aValue - the value to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand acos(java.lang.Number aValue)
Determine the arcsine of the variable.
Parameters:
aVariable - the variable to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand asin(com.arsi.mj.variable.MJVariable aVariable)
Determine the arcsine of the number.
Parameters:
aValue - the value to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand asin(java.lang.Number aValue)
Determine the arctangent of the variable.
Parameters:
aVariable - the variable to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand atan(com.arsi.mj.variable.MJVariable aVariable)
Determine the arctangent of the number.
Parameters:
aValue - the value to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand atan(java.lang.Number aValue)
Determine the cube root of the variable.
Parameters:
aVariable - the variable to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand cbrt(com.arsi.mj.variable.MJVariable aVariable)
Determine the cube root of the number.
Parameters:
aValue - the value to operate on
Returns:
the operation result
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.
Parameters:
someOptions - the options to encapsulate
Returns:
the array content
public static java.util.EnumSet convertToOptionArray(java.util.EnumSet someOptions)
Determine the cosine of the variable.
Parameters:
aVariable - the variable to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand cos(com.arsi.mj.variable.MJVariable aVariable)
Determine the cosine of the number.
Parameters:
aValue - the value to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand cos(java.lang.Number aValue)
Determine the cotangent of the variable.
Parameters:
aVariable - the variable to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand ctn(com.arsi.mj.variable.MJVariable aVariable)
Determine the cotangent of the number.
Parameters:
aValue - the value to operate on
Returns:
the operation result
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.
Parameters:
aParsedLiteral - the literal content extracted from the formula
Returns:
the encapsulated conversion result
public com.arsi.mj.fml.impl.NumericOperand dec(java.lang.String aParsedLiteral)
Determine the value of the variable (in radians) in degrees.
Parameters:
aVariable - the variable to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand deg(com.arsi.mj.variable.MJVariable aVariable)
Determine the value of the number (in radians) in degrees.
Parameters:
aValue - the value to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand deg(java.lang.Number aValue)
Performs integral division for the provided operands.
Parameters:
aDivisor - the value to be divided
aDividend - the value to divide by
Returns:
the result of the division
public com.arsi.mj.fml.impl.NumericOperand div(java.lang.Object aDivisor, java.lang.Object aDividend)
Determine the fractional portion of the variable.
Parameters:
aVariable - the variable to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand frac(com.arsi.mj.variable.MJVariable aVariable)
Determine the fractional portion of the number.
Parameters:
aValue - the value to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand frac(java.lang.Number aValue)
Determine the hyperbolic cosine of the variable.
Parameters:
aVariable - the variable to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand hcos(com.arsi.mj.variable.MJVariable aVariable)
Determine the hyperbolic cosine of the number.
Parameters:
aValue - the value to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand hcos(java.lang.Number aValue)
Determine the hyperbolic sine of the variable.
Parameters:
aVariable - the variable to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand hsin(com.arsi.mj.variable.MJVariable aVariable)
Determine the hyperbolic sine of the number.
Parameters:
aValue - the value to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand hsin(java.lang.Number aValue)
Determine the hyperbolic tangent of the variable.
Parameters:
aVariable - the variable to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand htan(com.arsi.mj.variable.MJVariable aVariable)
Determine the hyperbolic tangent of the number.
Parameters:
aValue - the value to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand htan(java.lang.Number aValue)
Determine the natural log of the variable.
Parameters:
aVariable - the variable to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand log(com.arsi.mj.variable.MJVariable aVariable)
Determine the natural log of the number.
Parameters:
aValue - the value to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand log(java.lang.Number aValue)
Determine the log (base 10) of the variable.
Parameters:
aVariable - the variable to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand log10(com.arsi.mj.variable.MJVariable aVariable)
Determine the log (base 10) of the number.
Parameters:
aValue - the value to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand log10(java.lang.Number aValue)
Converts a numeric literal into an MJ-supported math operand.
Parameters:
aNumericLiteral - the literal value to process
Returns:
the encapsulated result
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.
Parameters:
aStringLiteral - the text value to parse
Returns:
the encapsulated result
public com.arsi.mj.fml.impl.NumericOperand n(java.lang.String aStringLiteral)
Determine the value of the variable (in degrees) in radians.
Parameters:
aVariable - the variable to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand rad(com.arsi.mj.variable.MJVariable aVariable)
Determine the value of the number (in degrees) in radians.
Parameters:
aValue - the value to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand rad(java.lang.Number aValue)
Allows injection of the current formula options for calculation.
Parameters:
options - the options to set
public void setOptions(java.util.EnumSet options)
Determine the sine of the variable.
Parameters:
aVariable - the variable to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand sin(com.arsi.mj.variable.MJVariable aVariable)
Determine the sine of the number.
Parameters:
aValue - the value to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand sin(java.lang.Number aValue)
Determine the square root of the variable.
Parameters:
aVariable - the variable to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand sqrt(com.arsi.mj.variable.MJVariable aVariable)
Determine the square root of the number.
Parameters:
aValue - the value to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand sqrt(java.lang.Number aValue)
Determine the tangent of the variable.
Parameters:
aVariable - the variable to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand tan(com.arsi.mj.variable.MJVariable aVariable)
Determine the tangent of the number.
Parameters:
aValue - the value to operate on
Returns:
the operation result
public com.arsi.mj.fml.impl.NumericOperand tan(java.lang.Number aValue)

Class: MJMathFormulaFactory   previous next package

Factory that creates mathematical formulas. Treat this class as "thread-safe".
public class com.arsi.mj.fml.math.MJMathFormulaFactory
  extends com.arsi.mj.fml.MJFormulaFactory
Constructors
Initializes the instance with the data provided.
Parameters:
anApplicationContext - the current application context
public MJMathFormulaFactory()
Methods
Required implementation.
See Also:
com.arsi.mj.fml.MJFormulaFactory#createDecimalFormula(java.util.EnumSet)
public com.arsi.mj.fml.IFormula createDecimalFormula(java.util.EnumSet someOptions)
Required implementation.
See Also:
com.arsi.mj.fml.MJFormulaFactory#createFloatFormula(java.util.EnumSet)
public com.arsi.mj.fml.IFormula createFloatFormula(java.util.EnumSet someOptions)
Required implementation.
See Also:
com.arsi.mj.fml.MJFormulaFactory#createFormula(java.util.EnumSet)
public com.arsi.mj.fml.math.MJMathFormula createFormula(java.util.EnumSet someOptions)
Required implementation.
See Also:
com.arsi.mj.fml.MJFormulaFactory#createIntegerFormula(java.util.EnumSet)
public com.arsi.mj.fml.math.MJMathFormula createIntegerFormula(java.util.EnumSet someOptions)

Class: NumberFormulaResultEncapsulator   previous package

Provides encapsulation that supports transformation of the result type to an appropriate numeric result.
public class com.arsi.mj.fml.math.NumberFormulaResultEncapsulator
  extends com.arsi.mj.fml.math.FormulaResultEncapsulator
Constructors
public NumberFormulaResultEncapsulator()
Methods
Required implementation.
See Also:
com.arsi.mj.fml.math.FormulaResultEncapsulator#buildResult(java.lang.Number, java.util.EnumSet)
public com.arsi.mj.fml.MJFormulaResult buildResult(java.lang.Number aCalculationResult, java.util.EnumSet someOptions)