Show / Hide Table of Contents

Class JSCompiler

Implements a DecisionModel compiler for expressions in the JavaScript language for processing by a JSProcessor instance.

Inheritance
object
JSCompiler
Implements
ICompiler
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Quantellia.WMServer.Execution.JS
Assembly: WMServer.dll
Syntax
public class JSCompiler : ICompiler
Remarks

The following keywords may not be used as element names:

abstractbreakchardebuggerdoubleexportfinally
inletnullpublicsuperthrowtry
volatileargumentsbyteclassdefaultelseextends
floatifinstanceoflongpackagereturnswitch
throwstypeofwhileawaitcaseconstdelete
enumFALSEforimplementsintnativeprivate
shortsynchronizedtransientvarwithbooleancatch
continuedoevalfinalfunctionimportinterface
newprotectedstaticthisTRUEvoidyield

JavaScript Math Library Support

All static functions and values defined in the JavaScript Math library may be used. Note that the World Modeler parser does not resolve dot-separated namespaces in qualified names. Calls to Math library functions must be made without any spaces.
Math.exp(x) will work but Math . exp(x), although it is legal JavaScript, will not be recognized by the World Modeler Parser and "Symbol not found" errors will be genrerated.

Supported Math library functions are:

Math.EMath.LN10Math.LN2Math.LOG10EMath.LOG2EMath.PIMath.SQRT1_2Math.SQRT2
Math.absMath.acosMath.acoshMath.asinMath.asinhMath.atanMath.atan2Math.atanh
Math.cbrtMath.ceilMath.clz32Math.cosMath.coshMath.expMath.expm1Math.floor
Math.froundMath.hypotMath.imulMath.logMath.log10Math.log1pMath.log2Math.max
Math.minMath.powMath.randomMath.roundMath.signMath.sinMath.sinhMath.sqrt
Math.tanMath.tanhMath.trunc

Fields

ConstraintsFunction

Name of the function used to evaluate constraint conditions in a simulation. This is a reserved name and should not be used by user-defined functions.

Declaration
public const string ConstraintsFunction = "__WM_constraints"
Field Value
Type Description
string

SelectArgsFunction

Name of the function used to evaluate simulation arguments. This is a reserved name and should not be used by user-defined functions.

Declaration
public const string SelectArgsFunction = "__WM_selectArgs"
Field Value
Type Description
string

StopFunction

Name of the function used to evaluate the simulation stop condition. This is a reserved name and should not be used by user-defined functions.

Declaration
public const string StopFunction = "__WM_stop"
Field Value
Type Description
string

Methods

Compile(string)

Declaration
public object Compile(string sourceCode)
Parameters
Type Name Description
string sourceCode
Returns
Type Description
object

GenerateSourceCode(DecisionModel, SimulationParams?)

This function compiles a decision model into a JS source code to be executed in Jurassic

Declaration
public string GenerateSourceCode(DecisionModel model, SimulationParams? simulationParams = null)
Parameters
Type Name Description
DecisionModel model
SimulationParams simulationParams
Returns
Type Description
string

Implements

ICompiler
In this article
Back to top Copyright © 2025 Quantellia LLC.    Version 2.0.0 Revision 399     Last Updated 11/16/2025    DRAFT DOCUMENTATION. SUBJECT TO CHANGE