Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
PopFirst.cs
6
8{
13 {
14 private readonly VariableReference reference;
15
25 {
26 this.reference = Argument as VariableReference;
27 }
28
32 public override string FunctionName => nameof(PopFirst);
33
41 {
42 int c = Argument.Dimension;
43 if (c == 0)
44 return ObjectValue.Null;
45
46 IElement Result = Argument.GetElement(0);
47
48 if (!(this.reference is null))
49 {
50 ICollection<IElement> Elements = Argument.VectorElements;
51
52 if (!Elements.Remove(Result))
53 {
55 bool First = true;
56
57 foreach (IElement E in Elements)
58 {
59 if (First)
60 First = false;
61 else
62 Elements2.Add(E);
63 }
64
65 Variables[this.reference.VariableName] = Argument.Encapsulate(Elements2, this);
66 }
67 else
68 Variables[this.reference.VariableName] = Argument.Encapsulate(Elements, this);
69 }
70
71 return Result;
72 }
73
74 }
75}
A chunked list is a linked list of chunks of objects of type T .
Definition: ChunkedList.cs:54
Class managing a script expression.
Definition: Expression.cs:41
PopFirst(ScriptNode Argument, int Start, int Length, Expression Expression)
PopFirst(v)
Definition: PopFirst.cs:23
override string FunctionName
Name of the function
Definition: PopFirst.cs:32
override IElement EvaluateVector(IVector Argument, Variables Variables)
Evaluates the function on a vector argument.
Definition: PopFirst.cs:40
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:88
Collection of variables.
Definition: Variables.cs:25
Basic interface for all types of elements.
Definition: IElement.cs:21
Basic interface for vectors.
Definition: IVector.cs:9