![]() |
Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
|
Class managing a script expression. More...
Public Member Functions | |
Expression (string Script, string Source) | |
Class managing a script expression. More... | |
Expression (string Script) | |
Class managing a script expression. More... | |
object | Evaluate (Variables Variables) |
Evaluates the expression, using the variables provided in the Variables collection. This method should be used for evaluating expressions in a synchronous (blocking) context. More... | |
async Task< object > | EvaluateAsync (Variables Variables) |
Evaluates the expression, using the variables provided in the Variables collection. This method should be used for evaluating expressions in an asynchronous (non-blocking) context. More... | |
override bool | Equals (object obj) |
override int | GetHashCode () |
bool | ReferencesImplicitPrint (Variables Variables) |
If the expression, or any function call references, contain implicit print operations. More... | |
bool | ForAll (ScriptNodeEventHandler Callback, object State, bool DepthFirst) |
Calls the callback method for all script nodes defined for the expression. More... | |
bool | ForAll (ScriptNodeEventHandler Callback, object State, SearchMethod Order) |
Calls the callback method for all script nodes defined for the expression. More... | |
Static Public Member Functions | |
static bool | TryGetConstant (string Name, Variables Variables, out IElement ValueElement) |
Tries to get a constant value, given its name. More... | |
static string | Transform (string s, string StartDelimiter, string StopDelimiter, Variables Variables) |
Transforms a string by executing embedded script. More... | |
static string | Transform (string s, string StartDelimiter, string StopDelimiter, Variables Variables, string Source) |
Transforms a string by executing embedded script. More... | |
static Task< string > | TransformAsync (string s, string StartDelimiter, string StopDelimiter, Variables Variables) |
Transforms a string by executing embedded script. More... | |
static async Task< string > | TransformAsync (string s, string StartDelimiter, string StopDelimiter, Variables Variables, string Source) |
Transforms a string by executing embedded script. More... | |
static string | ToString (double Value) |
Converts a value to a string, that can be parsed as part of an expression. More... | |
static string | ToString (decimal Value) |
Converts a value to a string, that can be parsed as part of an expression. More... | |
static bool | TryParse (string s, out double Value) |
Tries to parse a double-precision floating-point value. More... | |
static bool | TryParse (string s, out float Value) |
Tries to parse a single-precision floating-point value. More... | |
static bool | TryParse (string s, out decimal Value) |
Tries to parse a decimal-precision floating-point value. More... | |
static string | ToString (Complex Value) |
Converts a value to a string, that can be parsed as part of an expression. More... | |
static string | ToString (BigInteger Value) |
Converts a value to a string, that can be parsed as part of an expression. More... | |
static string | ToString (bool Value) |
Converts a value to a string, that can be parsed as part of an expression. More... | |
static string | ToString (double[] Value) |
Converts a value to a string, that can be parsed as part of an expression. More... | |
static string | ToString (Complex[] Value) |
Converts a value to a string, that can be parsed as part of an expression. More... | |
static string | ToString (DateTime Value) |
Converts a value to a string, that can be parsed as part of an expression. More... | |
static string | ToString (TimeSpan Value) |
Converts a value to a string, that can be parsed as part of an expression. More... | |
static string | ToString (Enum Value) |
Converts a value to a string, that can be parsed as part of an expression. More... | |
static string | ToString (string s) |
Converts a string value to a parsable expression string. More... | |
static string | ToString (object Value) |
Converts an object to a string. More... | |
static double | ToDouble (object Object) |
Converts an object to a double value. More... | |
static decimal | ToDecimal (object Object) |
Converts an object to a double value. More... | |
static Complex | ToComplex (object Object) |
Converts an object to a complex value. More... | |
static IElement | Encapsulate (object Value) |
Encapsulates an object. More... | |
static bool | UpgradeSemiGroup (ref IElement E1, ref ISet Set1, ref IElement E2, ref ISet Set2) |
Upgrades elements if necessary, to a common semi-field, trying to make them compatible. More... | |
static bool | UpgradeField (ref IElement E1, ref ISet Set1, ref IElement E2, ref ISet Set2) |
Upgrades elements if necessary, to a common field extension, trying to make them compatible. More... | |
static object | ConvertTo (IElement Value, Type DesiredType, ScriptNode Node) |
Tries to conevert an element value to a desired type. More... | |
static object | ConvertTo (object Obj, Type DesiredType, ScriptNode Node) |
Tries to conevert an object to a desired type. More... | |
static bool | TryConvert< T > (object Value, out T Result) |
Tries to convert an object Value to an object of type T . More... | |
static bool | TryConvert (object Value, Type DesiredType, out object Result) |
Tries to convert an object Value to an object of type DesiredType . More... | |
static bool | TryConvert (IElement Value, Type DesiredType, out IElement Result) |
Tries to convert an element Value to an element whose associated object is of type DesiredType . More... | |
static bool | TryGetTypeConverter (Type From, Type To, out ITypeConverter Converter) |
Tries to get a type converter, converting objects from type From to objects of type To . More... | |
static object | Eval (string Script) |
Evaluates script, in string format. More... | |
static object | Eval (string Script, Variables Variables) |
Evaluates script, in string format. More... | |
static Task< object > | EvalAsync (string Script) |
Evaluates script, in string format. More... | |
static Task< object > | EvalAsync (string Script, Variables Variables) |
Evaluates script, in string format. More... | |
Properties | |
string | Script [get] |
Original script string. More... | |
string | Source [get] |
Source of script, or null if not defined. More... | |
bool | IsAsynchronous [get] |
If the node (or its decendants) include asynchronous evaluation. Asynchronous nodes should be evaluated using EvaluateAsync(Variables). More... | |
ScriptNode | Root [get] |
Root script node. More... | |
bool | ContainsImplicitPrint [get] |
If the expression contains implicit print operations. More... | |
object | Tag [get, set] |
This property allows the caller to tag the expression with an arbitrary object. More... | |
Class managing a script expression.
Definition at line 38 of file Expression.cs.
Waher.Script.Expression.Expression | ( | string | Script, |
string | Source | ||
) |
Class managing a script expression.
Definition at line 62 of file Expression.cs.
Waher.Script.Expression.Expression | ( | string | Script | ) |
Class managing a script expression.
Definition at line 72 of file Expression.cs.
|
static |
Tries to conevert an element value to a desired type.
Value | Element value. |
DesiredType | Desired type. |
Node | Script node making the request. |
Definition at line 5127 of file Expression.cs.
|
static |
Tries to conevert an object to a desired type.
Obj | Object to convert. |
DesiredType | Desired type. |
Node | Script node making the request. |
Definition at line 5139 of file Expression.cs.
|
static |
Encapsulates an object.
Value | Object |
Definition at line 4955 of file Expression.cs.
override bool Waher.Script.Expression.Equals | ( | object | obj | ) |
Definition at line 4302 of file Expression.cs.
|
static |
|
static |
|
static |
|
static |
object Waher.Script.Expression.Evaluate | ( | Variables | Variables | ) |
Evaluates the expression, using the variables provided in the Variables collection. This method should be used for evaluating expressions in a synchronous (blocking) context.
Definition at line 4248 of file Expression.cs.
async Task< object > Waher.Script.Expression.EvaluateAsync | ( | Variables | Variables | ) |
Evaluates the expression, using the variables provided in the Variables collection. This method should be used for evaluating expressions in an asynchronous (non-blocking) context.
Definition at line 4275 of file Expression.cs.
bool Waher.Script.Expression.ForAll | ( | ScriptNodeEventHandler | Callback, |
object | State, | ||
bool | DepthFirst | ||
) |
Calls the callback method for all script nodes defined for the expression.
Callback | Callback method to call. |
State | State object to pass on to the callback method. |
DepthFirst | If calls are made depth first (true) or on each node and then its leaves (false). |
Definition at line 5196 of file Expression.cs.
bool Waher.Script.Expression.ForAll | ( | ScriptNodeEventHandler | Callback, |
object | State, | ||
SearchMethod | Order | ||
) |
Calls the callback method for all script nodes defined for the expression.
Callback | Callback method to call. |
State | State object to pass on to the callback method. |
Order | Order to traverse the nodes. |
Definition at line 5208 of file Expression.cs.
override int Waher.Script.Expression.GetHashCode | ( | ) |
Definition at line 4311 of file Expression.cs.
bool Waher.Script.Expression.ReferencesImplicitPrint | ( | Variables | Variables | ) |
If the expression, or any function call references, contain implicit print operations.
Definition at line 4326 of file Expression.cs.
|
static |
Converts an object to a complex value.
Object | Object. |
Definition at line 4942 of file Expression.cs.
|
static |
Converts an object to a double value.
Object | Object. |
Definition at line 4883 of file Expression.cs.
|
static |
Converts an object to a double value.
Object | Object. |
Definition at line 4824 of file Expression.cs.
|
static |
Converts a value to a string, that can be parsed as part of an expression.
Value | Value |
Definition at line 4559 of file Expression.cs.
|
static |
Converts a value to a string, that can be parsed as part of an expression.
Value | Value |
Definition at line 4569 of file Expression.cs.
|
static |
Converts a value to a string, that can be parsed as part of an expression.
Value | Value |
Definition at line 4549 of file Expression.cs.
|
static |
Converts a value to a string, that can be parsed as part of an expression.
Value | Value |
Definition at line 4607 of file Expression.cs.
|
static |
Converts a value to a string, that can be parsed as part of an expression.
Value | Value |
Definition at line 4635 of file Expression.cs.
|
static |
Converts a value to a string, that can be parsed as part of an expression.
Value | Value |
Definition at line 4506 of file Expression.cs.
|
static |
Converts a value to a string, that can be parsed as part of an expression.
Value | Value |
Definition at line 4496 of file Expression.cs.
|
static |
Converts a value to a string, that can be parsed as part of an expression.
Value | Value |
Definition at line 4579 of file Expression.cs.
|
static |
Converts a value to a string, that can be parsed as part of an expression.
Value | Value |
Definition at line 4706 of file Expression.cs.
|
static |
Converts an object to a string.
Value | Value |
Definition at line 4766 of file Expression.cs.
|
static |
Converts a string value to a parsable expression string.
s | Value |
Definition at line 4722 of file Expression.cs.
|
static |
Converts a value to a string, that can be parsed as part of an expression.
Value | Value |
Definition at line 4677 of file Expression.cs.
|
static |
Transforms a string by executing embedded script.
s | String to transform. |
StartDelimiter | Start delimiter. |
StopDelimiter | Stop delimiter. |
Variables | Collection of variables. |
Definition at line 4383 of file Expression.cs.
|
static |
Transforms a string by executing embedded script.
s | String to transform. |
StartDelimiter | Start delimiter. |
StopDelimiter | Stop delimiter. |
Variables | Collection of variables. |
Source | Optional source of s . |
Definition at line 4398 of file Expression.cs.
|
static |
Transforms a string by executing embedded script.
s | String to transform. |
StartDelimiter | Start delimiter. |
StopDelimiter | Stop delimiter. |
Variables | Collection of variables. |
Definition at line 4441 of file Expression.cs.
|
static |
Transforms a string by executing embedded script.
s | String to transform. |
StartDelimiter | Start delimiter. |
StopDelimiter | Stop delimiter. |
Variables | Collection of variables. |
Source | Optional source of s . |
Definition at line 4455 of file Expression.cs.
|
static |
Tries to convert an element Value to an element whose associated object is of type DesiredType .
Value | Element to convert. |
DesiredType | Desired type of associated object. |
Result | Conversion result. |
Definition at line 5305 of file Expression.cs.
|
static |
Tries to convert an object Value to an object of type DesiredType .
Value | Value to convert. |
DesiredType | Desired type. |
Result | Conversion result. |
Definition at line 5268 of file Expression.cs.
|
static |
Tries to convert an object Value to an object of type T .
T | Desired type. |
Value | Value to convert. |
Result | Conversion result. |
Definition at line 5241 of file Expression.cs.
|
static |
Tries to get a constant value, given its name.
Name | Name |
Variables | Current set of variables. Can be null. |
ValueElement | If found, constant value will be placed here. |
Definition at line 3307 of file Expression.cs.
|
static |
Tries to get a type converter, converting objects from type From to objects of type To .
From | Start type. |
To | Desired type. |
Converter | Type Converter found, or null if not found. |
Definition at line 5336 of file Expression.cs.
|
static |
Tries to parse a decimal-precision floating-point value.
s | String-representation |
Value | Parsed value. |
Definition at line 4539 of file Expression.cs.
|
static |
Tries to parse a double-precision floating-point value.
s | String-representation |
Value | Parsed value. |
Definition at line 4517 of file Expression.cs.
|
static |
Tries to parse a single-precision floating-point value.
s | String-representation |
Value | Parsed value. |
Definition at line 4528 of file Expression.cs.
|
static |
Upgrades elements if necessary, to a common field extension, trying to make them compatible.
E1 | Element 1. |
Set1 | Set containing element 1. |
E2 | Element 2. |
Set2 | Set containing element 2. |
Definition at line 5070 of file Expression.cs.
|
static |
Upgrades elements if necessary, to a common semi-field, trying to make them compatible.
E1 | Element 1. |
Set1 | Set containing element 1. |
E2 | Element 2. |
Set2 | Set containing element 2. |
Definition at line 5040 of file Expression.cs.
|
get |
If the expression contains implicit print operations.
Definition at line 4319 of file Expression.cs.
|
get |
If the node (or its decendants) include asynchronous evaluation. Asynchronous nodes should be evaluated using EvaluateAsync(Variables).
Definition at line 4239 of file Expression.cs.
|
get |
Root script node.
Definition at line 4299 of file Expression.cs.
|
get |
Original script string.
Definition at line 181 of file Expression.cs.
|
get |
Source of script, or null if not defined.
Definition at line 186 of file Expression.cs.
|
getset |
This property allows the caller to tag the expression with an arbitrary object.
Definition at line 5182 of file Expression.cs.