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 Waher.Script;
5
7{
12 {
21 {
22 }
23
32 : base(new ScriptNode[] { NodeId }, argumentTypes1Scalar, Start, Length, Expression)
33 {
34 }
35
45 : base(new ScriptNode[] { NodeId, SourceId }, argumentTypes2Scalar, Start, Length, Expression)
46 {
47 }
48
58 public ThingReference(ScriptNode NodeId, ScriptNode SourceId, ScriptNode Partition, int Start, int Length, Expression Expression)
59 : base(new ScriptNode[] { NodeId, SourceId, Partition }, argumentTypes3Scalar, Start, Length, Expression)
60 {
61 }
62
66 public override string FunctionName => nameof(ThingReference);
67
71 public override string[] DefaultArgumentNames => new string[] { "NodeId", "SourceId", "Partition" };
72
80 {
81 switch (Arguments.Length)
82 {
83 case 0:
84 return new ObjectValue(Things.ThingReference.Empty);
85
86 case 1:
87 return new ObjectValue(new Things.ThingReference(Arguments[0].AssociatedObjectValue?.ToString() ?? string.Empty));
88
89 case 2:
90 return new ObjectValue(new Things.ThingReference(
91 Arguments[0].AssociatedObjectValue?.ToString() ?? string.Empty,
92 Arguments[1].AssociatedObjectValue?.ToString() ?? string.Empty));
93
94 case 3:
95 default:
96 return new ObjectValue(new Things.ThingReference(
97 Arguments[0].AssociatedObjectValue?.ToString() ?? string.Empty,
98 Arguments[1].AssociatedObjectValue?.ToString() ?? string.Empty,
99 Arguments[2].AssociatedObjectValue?.ToString() ?? string.Empty));
100
101 }
102 }
103 }
104}
Class managing a script expression.
Definition: Expression.cs:39
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:20