Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
PopLast.cs
1using System.Collections.Generic;
5
7{
12 {
13 private readonly VariableReference reference;
14
24 {
25 this.reference = Argument as VariableReference;
26 }
27
31 public override string FunctionName => nameof(PopLast);
32
40 {
41 int c = Argument.Dimension;
42 if (c == 0)
43 return ObjectValue.Null;
44
45 IElement Result = Argument.GetElement(c - 1);
46
47 if (!(this.reference is null))
48 {
49 ICollection<IElement> Elements = Argument.VectorElements;
50 LinkedList<IElement> Elements2 = new LinkedList<IElement>();
51
52 foreach (IElement E in Elements)
53 {
54 if (--c > 0)
55 Elements2.AddLast(E);
56 }
57
58 Variables[this.reference.VariableName] = Argument.Encapsulate(Elements2, this);
59 }
60
61 return Result;
62 }
63
64 }
65}
Class managing a script expression.
Definition: Expression.cs:39
override string FunctionName
Name of the function
Definition: PopLast.cs:31
PopLast(ScriptNode Argument, int Start, int Length, Expression Expression)
PopLast(v)
Definition: PopLast.cs:22
override IElement EvaluateVector(IVector Argument, Variables Variables)
Evaluates the function on a vector argument.
Definition: PopLast.cs:39
ScriptNode Argument
Function argument.
Base class for funcions of one vector variable.
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
int Start
Start position in script expression.
Definition: ScriptNode.cs:92
Represents a variable reference.
static readonly ObjectValue Null
Null value.
Definition: ObjectValue.cs:86
Collection of variables.
Definition: Variables.cs:25
Basic interface for all types of elements.
Definition: IElement.cs:20
Basic interface for vectors.
Definition: IVector.cs:9