Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ThingReference.cs
1using System;
2using Waher.Script;
6
8{
13 {
21 : base(Array.Empty<ScriptNode>(), argumentTypes0, Start, Length, Expression)
22 {
23 }
24
33 : base(new ScriptNode[] { NodeId }, argumentTypes1Scalar, Start, Length, Expression)
34 {
35 }
36
46 : base(new ScriptNode[] { NodeId, SourceId }, argumentTypes2Scalar, Start, Length, Expression)
47 {
48 }
49
59 public ThingReference(ScriptNode NodeId, ScriptNode SourceId, ScriptNode Partition, int Start, int Length, Expression Expression)
60 : base(new ScriptNode[] { NodeId, SourceId, Partition }, argumentTypes3Scalar, Start, Length, Expression)
61 {
62 }
63
67 public override string FunctionName => nameof(ThingReference);
68
72 public override string[] DefaultArgumentNames => new string[] { "NodeId", "SourceId", "Partition" };
73
81 {
82 switch (Arguments.Length)
83 {
84 case 0:
85 return new ObjectValue(Things.ThingReference.Empty);
86
87 case 1:
88 return new ObjectValue(new Things.ThingReference(ToString(Arguments[0]) ?? string.Empty));
89
90 case 2:
91 return new ObjectValue(new Things.ThingReference(
92 ToString(Arguments[0]) ?? string.Empty,
93 ToString(Arguments[1]) ?? string.Empty));
94
95 case 3:
96 default:
97 return new ObjectValue(new Things.ThingReference(
98 ToString(Arguments[0]) ?? string.Empty,
99 ToString(Arguments[1]) ?? string.Empty,
100 ToString(Arguments[2]) ?? string.Empty));
101
102 }
103 }
104 }
105}
Class managing a script expression.
Definition: Expression.cs:41
Base class for multivariate funcions.
ScriptNode[] Arguments
Function arguments.
static readonly ArgumentType[] argumentTypes2Scalar
Two scalar parameters.
static readonly ArgumentType[] argumentTypes0
Zero parameters.
static readonly ArgumentType[] argumentTypes3Scalar
Three scalar parameters.
static readonly ArgumentType[] argumentTypes1Scalar
One scalar parameter.
Base class for all nodes in a parsed script tree.
Definition: ScriptNode.cs:69
int Length
Length of expression covered by node.
Definition: ScriptNode.cs:101
override string ToString()
Definition: ScriptNode.cs:359
Expression Expression
Expression of which the node is a part.
Definition: ScriptNode.cs:177
int Start
Start position in script expression.
Definition: ScriptNode.cs:92
Collection of variables.
Definition: Variables.cs:25
Creates a reference object to a thing.
override string FunctionName
Name of the function
override IElement Evaluate(IElement[] Arguments, Variables Variables)
Evaluates the function.
override string[] DefaultArgumentNames
Default Argument names
ThingReference(ScriptNode NodeId, ScriptNode SourceId, int Start, int Length, Expression Expression)
Creates a reference object to a thing.
ThingReference(int Start, int Length, Expression Expression)
Creates a reference object to a thing.
ThingReference(ScriptNode NodeId, ScriptNode SourceId, ScriptNode Partition, int Start, int Length, Expression Expression)
Creates a reference object to a thing.
ThingReference(ScriptNode NodeId, int Start, int Length, Expression Expression)
Creates a reference object to a thing.
Basic interface for all types of elements.
Definition: IElement.cs:21