Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Paiwise.Functions.ExchangeRate Class Reference

Gets the current exchange rate between two currencies. Requires a currency converter to be configured for the system. More...

Inheritance diagram for Paiwise.Functions.ExchangeRate:
Waher.Script.Model.FunctionTwoScalarVariables Waher.Script.Model.FunctionTwoVariables Waher.Script.Model.Function Waher.Script.Model.ScriptNode Waher.Script.Model.IFunction

Public Member Functions

 ExchangeRate (ScriptNode From, ScriptNode To, int Start, int Length, Expression Expression)
 Gets the current exchange rate between two currencies. Requires a currency converter to be configured for the system. More...
 
override IElement EvaluateScalar (string Argument1, string Argument2, Variables Variables)
 Evaluates the function on two scalar arguments. More...
 
override async Task< IElementEvaluateScalarAsync (string Argument1, string Argument2, Variables Variables)
 Evaluates the function on two scalar arguments. More...
 
override IElement Evaluate (IElement Argument1, IElement Argument2, Variables Variables)
 Evaluates the function. More...
 
override IElement Evaluate (Variables Variables)
 Evaluates the node, using the variables provided in the Variables collection. More...
 
virtual IElement EvaluateScalar (IElement Argument1, IElement Argument2, Variables Variables)
 Evaluates the function on two scalar arguments. More...
 
virtual IElement EvaluateScalar (double Argument1, double Argument2, Variables Variables)
 Evaluates the function on two scalar arguments. More...
 
virtual IElement EvaluateScalar (Complex Argument1, Complex Argument2, Variables Variables)
 Evaluates the function on two scalar arguments. More...
 
virtual IElement EvaluateScalar (bool Argument1, bool Argument2, Variables Variables)
 Evaluates the function on two scalar arguments. More...
 
override async Task< IElementEvaluateAsync (IElement Argument1, IElement Argument2, Variables Variables)
 Evaluates the function. More...
 
override async Task< IElementEvaluateAsync (Variables Variables)
 Evaluates the node, using the variables provided in the Variables collection. More...
 
virtual Task< IElementEvaluateScalarAsync (IElement Argument1, IElement Argument2, Variables Variables)
 Evaluates the function on two scalar arguments. More...
 
virtual Task< IElementEvaluateScalarAsync (double Argument1, double Argument2, Variables Variables)
 Evaluates the function on two scalar arguments. More...
 
virtual Task< IElementEvaluateScalarAsync (Complex Argument1, Complex Argument2, Variables Variables)
 Evaluates the function on two scalar arguments. More...
 
virtual Task< IElementEvaluateScalarAsync (bool Argument1, bool Argument2, Variables Variables)
 Evaluates the function on two scalar arguments. More...
 
override bool ForAllChildNodes (ScriptNodeEventHandler Callback, object State, SearchMethod Order)
 Calls the callback method for all child nodes. More...
 
bool ForAllChildNodes (ScriptNodeEventHandler Callback, object State, bool DepthFirst)
 Calls the callback method for all child nodes. More...
 
override bool Equals (object obj)
 
override int GetHashCode ()
 
void SetParent (ScriptNode Parent)
 Sets the parent node. Can only be used when expression is being parsed. More...
 
virtual PatternMatchResult PatternMatch (IElement CheckAgainst, Dictionary< string, IElement > AlreadyFound)
 Performs a pattern match operation. More...
 
override string ToString ()
 

Static Public Member Functions

static int GetHashCode (ScriptNode Node)
 Calculates a hash code for the contents of an array. More...
 
static int GetHashCode (IEnumerable Set)
 Calculates a hash code for the contents of an array. More...
 
static bool AreEqual (ScriptNode S1, ScriptNode S2)
 Compares if two script nodes are equal. More...
 
static bool AreEqual (IEnumerable A1, IEnumerable A2)
 Compares if the contents of two enumerable sets are equal More...
 
static async Task< object > WaitPossibleTask (object Result)
 Waits for any asynchronous process to terminate. More...
 
static object UnnestPossibleTaskSync (object Result)
 Checks if Result is an asynchronous results. If so, blocks the current thread until the result is completed, and returns the completed result instead. More...
 

Static Public Attributes

static readonly ScriptNode EmptyNode = new ConstantElement(ObjectValue.Null, 0, 0, new Expression("null"))
 Empty Script Node More...
 

Protected Member Functions

void SetSubExpression (int Start, int Length)
 Sets the Start and Length properties of the node. More...
 
ScriptNode DifferentiationChainRule (string VariableName, Variables Variables, ScriptNode Argument, ScriptNode Differentiation)
 Implements the differentiation chain rule, by differentiating the argument and multiplying it to the differentiation of the main node. More...
 
ToEnum< T > (IElement Value)
 Tries to convert an element to an enumeration value. More...
 

Static Protected Member Functions

static ? bool ToBoolean (IElement Value)
 Tries to convert an element to a boolean value. More...
 

Properties

override string FunctionName [get]
 Name of the function More...
 
override string[] DefaultArgumentNames [get]
 Default Argument names More...
 
override bool IsAsynchronous [get]
 If the node (or its decendants) include asynchronous evaluation. Asynchronous nodes should be evaluated using FunctionTwoVariables.EvaluateAsync(Variables). More...
 
ScriptNode Argument1 [get]
 Function argument 1. More...
 
ScriptNode Argument2 [get]
 Function argument 2. More...
 
virtual string[] Aliases [get]
 Optional aliases. If there are no aliases for the function, null is returned. More...
 
virtual string DefaultVariableName [get]
 Default variable name, if any, null otherwise. More...
 
int Start [get, set]
 Start position in script expression. More...
 
int Length [get, set]
 Length of expression covered by node. More...
 
ScriptNode Parent [get]
 Parent node. More...
 
Expression Expression [get]
 Expression of which the node is a part. More...
 
string SubExpression [get]
 Sub-expression defining the node. More...
 

Detailed Description

Gets the current exchange rate between two currencies. Requires a currency converter to be configured for the system.

Definition at line 15 of file ExchangeRate.cs.

Constructor & Destructor Documentation

◆ ExchangeRate()

Paiwise.Functions.ExchangeRate.ExchangeRate ( ScriptNode  From,
ScriptNode  To,
int  Start,
int  Length,
Expression  Expression 
)

Gets the current exchange rate between two currencies. Requires a currency converter to be configured for the system.

Parameters
FromFrom Currency.
ToTo Currency.
StartStart position in script expression.
LengthLength of expression covered by node.
ExpressionExpression containing script.

Definition at line 26 of file ExchangeRate.cs.

Member Function Documentation

◆ AreEqual() [1/2]

static bool Waher.Script.Model.ScriptNode.AreEqual ( IEnumerable  A1,
IEnumerable  A2 
)
staticinherited

Compares if the contents of two enumerable sets are equal

Parameters
A1Array 1
A2Array 2
Returns
If the size and contents of the arrays are equal

Definition at line 292 of file ScriptNode.cs.

◆ AreEqual() [2/2]

static bool Waher.Script.Model.ScriptNode.AreEqual ( ScriptNode  S1,
ScriptNode  S2 
)
staticinherited

Compares if two script nodes are equal.

Parameters
S1Node 1. Can be null.
S2Node 2. Can be null.
Returns
If the size and contents of the arrays are equal

Definition at line 275 of file ScriptNode.cs.

◆ DifferentiationChainRule()

ScriptNode Waher.Script.Model.ScriptNode.DifferentiationChainRule ( string  VariableName,
Variables  Variables,
ScriptNode  Argument,
ScriptNode  Differentiation 
)
protectedinherited

Implements the differentiation chain rule, by differentiating the argument and multiplying it to the differentiation of the main node.

Parameters
VariableNameName of variable to differentiate on.
VariablesCollection of variables.
ArgumentInner argument
DifferentiationDifferentiation of main node.
Returns
Differentiation *D(Argument )

Definition at line 195 of file ScriptNode.cs.

◆ Equals()

override bool Waher.Script.Model.FunctionTwoVariables.Equals ( object  obj)
inherited

Definition at line 192 of file FunctionTwoVariables.cs.

◆ Evaluate() [1/2]

override IElement Waher.Script.Model.FunctionTwoScalarVariables.Evaluate ( IElement  Argument1,
IElement  Argument2,
Variables  Variables 
)
virtualinherited

Evaluates the function.

Parameters
Argument1Function argument 1.
Argument2Function argument 2.
VariablesVariables collection.
Returns
Function result.

Implements Waher.Script.Model.FunctionTwoVariables.

Definition at line 36 of file FunctionTwoScalarVariables.cs.

◆ Evaluate() [2/2]

override IElement Waher.Script.Model.FunctionTwoVariables.Evaluate ( Variables  Variables)
virtualinherited

Evaluates the node, using the variables provided in the Variables collection.

Parameters
VariablesVariables collection.
Returns
Result.

Implements Waher.Script.Model.ScriptNode.

Reimplemented in Waher.IoTGateway.ScriptExtensions.Functions.ScriptResource.

Definition at line 69 of file FunctionTwoVariables.cs.

◆ EvaluateAsync() [1/2]

override async Task< IElement > Waher.Script.Model.FunctionTwoScalarVariables.EvaluateAsync ( IElement  Argument1,
IElement  Argument2,
Variables  Variables 
)
virtualinherited

Evaluates the function.

Parameters
Argument1Function argument 1.
Argument2Function argument 2.
VariablesVariables collection.
Returns
Function result.

Reimplemented from Waher.Script.Model.FunctionTwoVariables.

Definition at line 238 of file FunctionTwoScalarVariables.cs.

◆ EvaluateAsync() [2/2]

override async Task< IElement > Waher.Script.Model.FunctionTwoVariables.EvaluateAsync ( Variables  Variables)
virtualinherited

Evaluates the node, using the variables provided in the Variables collection.

Parameters
VariablesVariables collection.
Returns
Result.

Reimplemented from Waher.Script.Model.ScriptNode.

Reimplemented in Waher.IoTGateway.ScriptExtensions.Functions.ScriptResource.

Definition at line 82 of file FunctionTwoVariables.cs.

◆ EvaluateScalar() [1/5]

virtual IElement Waher.Script.Model.FunctionTwoScalarVariables.EvaluateScalar ( bool  Argument1,
bool  Argument2,
Variables  Variables 
)
virtualinherited

Evaluates the function on two scalar arguments.

Parameters
Argument1Function argument 1.
Argument2Function argument 2.
VariablesVariables collection.
Returns
Function result.

Definition at line 214 of file FunctionTwoScalarVariables.cs.

◆ EvaluateScalar() [2/5]

virtual IElement Waher.Script.Model.FunctionTwoScalarVariables.EvaluateScalar ( Complex  Argument1,
Complex  Argument2,
Variables  Variables 
)
virtualinherited

Evaluates the function on two scalar arguments.

Parameters
Argument1Function argument 1.
Argument2Function argument 2.
VariablesVariables collection.
Returns
Function result.

Reimplemented in Waher.Script.Statistics.Functions.Analytic.LowerIncompleteGamma, Waher.Script.Statistics.Functions.Analytic.UpperIncompleteGamma, Waher.Script.Functions.Transforms.Scale2D, Waher.Script.Functions.Transforms.Scale2DH, and Waher.Script.Functions.Transforms.Translate2DH.

Definition at line 202 of file FunctionTwoScalarVariables.cs.

◆ EvaluateScalar() [3/5]

virtual IElement Waher.Script.Model.FunctionTwoScalarVariables.EvaluateScalar ( double  Argument1,
double  Argument2,
Variables  Variables 
)
virtualinherited

◆ EvaluateScalar() [4/5]

◆ EvaluateScalar() [5/5]

override IElement Paiwise.Functions.ExchangeRate.EvaluateScalar ( string  Argument1,
string  Argument2,
Variables  Variables 
)
virtual

Evaluates the function on two scalar arguments.

Parameters
Argument1Function argument 1.
Argument2Function argument 2.
VariablesVariables collection.
Returns
Function result.

Reimplemented from Waher.Script.Model.FunctionTwoScalarVariables.

Definition at line 54 of file ExchangeRate.cs.

◆ EvaluateScalarAsync() [1/5]

virtual Task< IElement > Waher.Script.Model.FunctionTwoScalarVariables.EvaluateScalarAsync ( bool  Argument1,
bool  Argument2,
Variables  Variables 
)
virtualinherited

Evaluates the function on two scalar arguments.

Parameters
Argument1Function argument 1.
Argument2Function argument 2.
VariablesVariables collection.
Returns
Function result.

Definition at line 416 of file FunctionTwoScalarVariables.cs.

◆ EvaluateScalarAsync() [2/5]

virtual Task< IElement > Waher.Script.Model.FunctionTwoScalarVariables.EvaluateScalarAsync ( Complex  Argument1,
Complex  Argument2,
Variables  Variables 
)
virtualinherited

Evaluates the function on two scalar arguments.

Parameters
Argument1Function argument 1.
Argument2Function argument 2.
VariablesVariables collection.
Returns
Function result.

Definition at line 404 of file FunctionTwoScalarVariables.cs.

◆ EvaluateScalarAsync() [3/5]

virtual Task< IElement > Waher.Script.Model.FunctionTwoScalarVariables.EvaluateScalarAsync ( double  Argument1,
double  Argument2,
Variables  Variables 
)
virtualinherited

Evaluates the function on two scalar arguments.

Parameters
Argument1Function argument 1.
Argument2Function argument 2.
VariablesVariables collection.
Returns
Function result.

Definition at line 392 of file FunctionTwoScalarVariables.cs.

◆ EvaluateScalarAsync() [4/5]

◆ EvaluateScalarAsync() [5/5]

override async Task< IElement > Paiwise.Functions.ExchangeRate.EvaluateScalarAsync ( string  Argument1,
string  Argument2,
Variables  Variables 
)
virtual

Evaluates the function on two scalar arguments.

Parameters
Argument1Function argument 1.
Argument2Function argument 2.
VariablesVariables collection.
Returns
Function result.

Reimplemented from Waher.Script.Model.FunctionTwoScalarVariables.

Definition at line 66 of file ExchangeRate.cs.

◆ ForAllChildNodes() [1/2]

bool Waher.Script.Model.ScriptNode.ForAllChildNodes ( ScriptNodeEventHandler  Callback,
object  State,
bool  DepthFirst 
)
inherited

Calls the callback method for all child nodes.

Parameters
CallbackCallback method to call.
StateState object to pass on to the callback method.
DepthFirstIf calls are made depth first (true) or on each node and then its leaves (false).
Returns
If the process was completed.

Definition at line 243 of file ScriptNode.cs.

◆ ForAllChildNodes() [2/2]

override bool Waher.Script.Model.FunctionTwoVariables.ForAllChildNodes ( ScriptNodeEventHandler  Callback,
object  State,
SearchMethod  Order 
)
virtualinherited

Calls the callback method for all child nodes.

Parameters
CallbackCallback method to call.
StateState object to pass on to the callback method.
OrderOrder to traverse the nodes.
Returns
If the process was completed.

Implements Waher.Script.Model.ScriptNode.

Definition at line 121 of file FunctionTwoVariables.cs.

◆ GetHashCode() [1/3]

override int Waher.Script.Model.FunctionTwoVariables.GetHashCode ( )
inherited

Definition at line 201 of file FunctionTwoVariables.cs.

◆ GetHashCode() [2/3]

static int Waher.Script.Model.ScriptNode.GetHashCode ( IEnumerable  Set)
staticinherited

Calculates a hash code for the contents of an array.

Parameters
SetEnumerable set.
Returns
Hash code

Definition at line 340 of file ScriptNode.cs.

◆ GetHashCode() [3/3]

static int Waher.Script.Model.ScriptNode.GetHashCode ( ScriptNode  Node)
staticinherited

Calculates a hash code for the contents of an array.

Parameters
NodeNode. Can be null.
Returns
Hash code

Definition at line 330 of file ScriptNode.cs.

◆ PatternMatch()

virtual PatternMatchResult Waher.Script.Model.ScriptNode.PatternMatch ( IElement  CheckAgainst,
Dictionary< string, IElement AlreadyFound 
)
virtualinherited

Performs a pattern match operation.

Parameters
CheckAgainstValue to check against.
AlreadyFoundVariables already identified.
Returns
Pattern match result

Reimplemented in Waher.Script.Content.Functions.Duration, Waher.Script.Xml.Functions.Xml, Waher.Script.Xml.Model.XmlScriptDocument, Waher.Script.Xml.Model.XmlScriptValue, Waher.Script.Functions.DateAndTime.DateTime, Waher.Script.Functions.DateAndTime.DateTimeLocal, Waher.Script.Functions.DateAndTime.DateTimeOffset, Waher.Script.Functions.DateAndTime.DateTimeUtc, Waher.Script.Functions.DateAndTime.TimeSpan, Waher.Script.Functions.Runtime.Optional, Waher.Script.Functions.Runtime.Required, Waher.Script.Functions.Scalar.Abs, Waher.Script.Functions.Scalar.Boolean, Waher.Script.Functions.Scalar.Ceiling, Waher.Script.Functions.Scalar.Double, Waher.Script.Functions.Scalar.Floor, Waher.Script.Functions.Scalar.Guid, Waher.Script.Functions.Scalar.Integer, Waher.Script.Functions.Scalar.Number, Waher.Script.Functions.Scalar.Round, Waher.Script.Functions.Scalar.Sign, Waher.Script.Functions.Scalar.String, Waher.Script.Functions.Scalar.Uri, Waher.Script.Model.ConstantElement, Waher.Script.Model.VariableReference, Waher.Script.Operators.Arithmetics.Invert, Waher.Script.Operators.Comparisons.EqualTo, Waher.Script.Operators.Comparisons.GreaterThan, Waher.Script.Operators.Comparisons.GreaterThanOrEqualTo, Waher.Script.Operators.Comparisons.LesserThan, Waher.Script.Operators.Comparisons.LesserThanOrEqualTo, Waher.Script.Operators.Comparisons.Like, Waher.Script.Operators.Comparisons.NotEqualTo, Waher.Script.Operators.Comparisons.NotLike, Waher.Script.Operators.Comparisons.Range, Waher.Script.Operators.Matrices.MatrixDefinition, Waher.Script.Operators.Matrices.ToMatrix, Waher.Script.Operators.ObjectExNihilo, Waher.Script.Operators.Sets.SetDefinition, Waher.Script.Operators.Sets.ToSet, Waher.Script.Operators.Vectors.ToVector, and Waher.Script.Operators.Vectors.VectorDefinition.

Definition at line 169 of file ScriptNode.cs.

◆ SetParent()

void Waher.Script.Model.ScriptNode.SetParent ( ScriptNode  Parent)
inherited

Sets the parent node. Can only be used when expression is being parsed.

Parameters
ParentParent Node

Definition at line 132 of file ScriptNode.cs.

◆ SetSubExpression()

void Waher.Script.Model.ScriptNode.SetSubExpression ( int  Start,
int  Length 
)
protectedinherited

Sets the Start and Length properties of the node.

Parameters
StartStart position in script expression.
LengthLength of expression covered by node.

Definition at line 111 of file ScriptNode.cs.

◆ ToBoolean()

static ? bool Waher.Script.Model.ScriptNode.ToBoolean ( IElement  Value)
staticprotectedinherited

Tries to convert an element to a boolean value.

Parameters
ValueElement value.
Returns
Boolean, if successful.

Definition at line 375 of file ScriptNode.cs.

◆ ToEnum< T >()

T Waher.Script.Model.ScriptNode.ToEnum< T > ( IElement  Value)
protectedinherited

Tries to convert an element to an enumeration value.

Parameters
ValueElement value.
Returns
Enumeration value, if successful.
Type Constraints
T :struct 

Definition at line 394 of file ScriptNode.cs.

◆ ToString()

override string Waher.Script.Model.ScriptNode.ToString ( )
inherited

Definition at line 359 of file ScriptNode.cs.

◆ UnnestPossibleTaskSync()

static object Waher.Script.Model.ScriptNode.UnnestPossibleTaskSync ( object  Result)
staticinherited

Checks if Result is an asynchronous results. If so, blocks the current thread until the result is completed, and returns the completed result instead.

Parameters
ResultResult
Returns
Finished result.

Definition at line 436 of file ScriptNode.cs.

◆ WaitPossibleTask()

static async Task< object > Waher.Script.Model.ScriptNode.WaitPossibleTask ( object  Result)
staticinherited

Waits for any asynchronous process to terminate.

Parameters
ResultResult, possibly asynchronous result.
Returns
Finished result

Definition at line 417 of file ScriptNode.cs.

Member Data Documentation

◆ EmptyNode

readonly ScriptNode Waher.Script.Model.ScriptNode.EmptyNode = new ConstantElement(ObjectValue.Null, 0, 0, new Expression("null"))
staticinherited

Empty Script Node

Definition at line 452 of file ScriptNode.cs.

Property Documentation

◆ Aliases

virtual string [] Waher.Script.Model.Function.Aliases
getinherited

Optional aliases. If there are no aliases for the function, null is returned.

Implements Waher.Script.Model.IFunction.

Definition at line 32 of file Function.cs.

◆ Argument1

ScriptNode Waher.Script.Model.FunctionTwoVariables.Argument1
getinherited

Function argument 1.

Definition at line 46 of file FunctionTwoVariables.cs.

◆ Argument2

ScriptNode Waher.Script.Model.FunctionTwoVariables.Argument2
getinherited

Function argument 2.

Definition at line 51 of file FunctionTwoVariables.cs.

◆ DefaultArgumentNames

override string [] Paiwise.Functions.ExchangeRate.DefaultArgumentNames
get

Default Argument names

Implements Waher.Script.Model.IFunction.

Definition at line 39 of file ExchangeRate.cs.

◆ DefaultVariableName

virtual string Waher.Script.Model.Function.DefaultVariableName
getinherited

Default variable name, if any, null otherwise.

Definition at line 45 of file Function.cs.

◆ Expression

Expression Waher.Script.Model.ScriptNode.Expression
getinherited

Expression of which the node is a part.

Definition at line 177 of file ScriptNode.cs.

◆ FunctionName

override string Paiwise.Functions.ExchangeRate.FunctionName
get

Name of the function

Implements Waher.Script.Model.IFunction.

Definition at line 34 of file ExchangeRate.cs.

◆ IsAsynchronous

override bool Paiwise.Functions.ExchangeRate.IsAsynchronous
get

If the node (or its decendants) include asynchronous evaluation. Asynchronous nodes should be evaluated using FunctionTwoVariables.EvaluateAsync(Variables).

Definition at line 45 of file ExchangeRate.cs.

◆ Length

int Waher.Script.Model.ScriptNode.Length
getsetinherited

Length of expression covered by node.

Definition at line 100 of file ScriptNode.cs.

◆ Parent

ScriptNode Waher.Script.Model.ScriptNode.Parent
getinherited

Parent node.

Definition at line 126 of file ScriptNode.cs.

◆ Start

int Waher.Script.Model.ScriptNode.Start
getsetinherited

Start position in script expression.

Definition at line 91 of file ScriptNode.cs.

◆ SubExpression

string Waher.Script.Model.ScriptNode.SubExpression
getinherited

Sub-expression defining the node.

Definition at line 182 of file ScriptNode.cs.


The documentation for this class was generated from the following file: