Class CompiledVariableElementFactory
Parses the expressions from a list of VariableElements into a dependency resolved normalized list of CompiledVariableElements.
Implements
Inherited Members
Namespace: Quantellia.WMServer.Execution.Compilation
Assembly: WMServer.dll
Syntax
public class CompiledVariableElementFactory : ICompiledElementFactory<CompiledVariableElement>
Methods
IdentifierToName(string)
Inverse of NameToIdentifier(string)
Declaration
public static string IdentifierToName(string identifier)
Parameters
| Type | Name | Description |
|---|---|---|
| string | identifier |
Returns
| Type | Description |
|---|---|
| string |
NameToIdentifier(string)
Converts provided fully qualified name to a string that is an acceptable identifier name in coding languages.
Declaration
public static string NameToIdentifier(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name |
Returns
| Type | Description |
|---|---|
| string |
Remarks
The following characters (shown as enclosed in single quote) are replaced with character \255 (0xFF):
' ' '_' '-' ':' ';' '.' '!' '@' '#' '$' '%' '&' '*' '%' '(' ')' ',' '+' '=' '/' '\\' '<' '>' '?'
NormalizeElements(IEnumerable<DecisionModelElement>, Syntax)
Given a list of VariableElements, this method will resolve dependencies and convert all valid elements to a normalized CompiledVariableElement format. It will return CompiledVariableElement in the order of dependency. I.e. If elemA is dependant on elemB, elemB will always appear before elemA in the list. If the selected syntax is JavaScript, this will ensure all expressions are code blocks.
Declaration
public static List<CompiledVariableElement> NormalizeElements(IEnumerable<DecisionModelElement> elements, CompiledElementBase.Syntax syntax = Syntax.JavaScript)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<DecisionModelElement> | elements | The list of elements to normalize against. |
| CompiledElementBase.Syntax | syntax | The syntax to normalize the element expressions against. By default this is JavaScript. |
Returns
| Type | Description |
|---|---|
| List<CompiledVariableElement> |
NormalizeSource(string, IEnumerable<DecisionModelElement>, Syntax)
Given a list of VariableElements and a provided syntax, this method will convert the provided src to a normalized format.
Declaration
public static CompiledVariableElement NormalizeSource(string src, IEnumerable<DecisionModelElement> elements, CompiledElementBase.Syntax syntax = Syntax.JavaScript)
Parameters
| Type | Name | Description |
|---|---|---|
| string | src | The source string to normalize. If JavaScript syntax is used, this is expected to be either a code block or a single line expression. |
| IEnumerable<DecisionModelElement> | elements | The elements to normalize against. |
| CompiledElementBase.Syntax | syntax | The syntax to normalize the element expressions against. By default this is JavaScript. |
Returns
| Type | Description |
|---|---|
| CompiledVariableElement |