Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Plot2DHorizontalLine.cs
5
7{
17 {
18 private static readonly ArgumentType[] argumentTypes5Parameters = new ArgumentType[] { ArgumentType.Vector, ArgumentType.Vector, ArgumentType.Scalar, ArgumentType.Scalar, ArgumentType.Scalar };
19 private static readonly ArgumentType[] argumentTypes4Parameters = new ArgumentType[] { ArgumentType.Vector, ArgumentType.Vector, ArgumentType.Scalar, ArgumentType.Scalar };
20 private static readonly ArgumentType[] argumentTypes3Parameters = new ArgumentType[] { ArgumentType.Vector, ArgumentType.Vector, ArgumentType.Scalar };
21
32 : base(new ScriptNode[] { X, Y, Mode }, argumentTypes3Parameters, Start, Length, Expression)
33 {
34 }
35
47 : base(new ScriptNode[] { X, Y, Mode, Color }, argumentTypes4Parameters, Start, Length, Expression)
48 {
49 }
50
63 : base(new ScriptNode[] { X, Y, Mode, Color, Size }, argumentTypes5Parameters, Start, Length, Expression)
64 {
65 }
66
70 public override string FunctionName => nameof(Plot2DHorizontalLine);
71
75 public override string[] Aliases => new string[] { "plot2dhline" };
76
80 public override string[] DefaultArgumentNames
81 {
82 get { return new string[] { "x", "y", "color", "size" }; }
83 }
84
92 {
93 if (!(Arguments[0] is IVector X))
94 throw new ScriptRuntimeException("Expected vector for X argument.", this);
95
96 if (!(Arguments[1] is IVector Y))
97 throw new ScriptRuntimeException("Expected vector for Y argument.", this);
98
99 int Dimension = X.Dimension;
100 if (Y.Dimension != Dimension)
101 throw new VectorSizeMismatchScriptException(this);
102
103 IElement Mode = Arguments[2];
104 IElement Color = Arguments.Length <= 3 ? null : Arguments[3];
105 IElement Size = Arguments.Length <= 4 ? null : Arguments[4];
106
107 return new Graph2D(Variables, X, Y, new Plot2DHorizontalLinePainter(), false, false, this, Mode.AssociatedObjectValue,
109 }
110 }
111}
Class managing a script expression.
Definition: Expression.cs:41
Plot2DHorizontalLine(ScriptNode X, ScriptNode Y, ScriptNode Mode, ScriptNode Color, int Start, int Length, Expression Expression)
Plots a two-dimensional horizontal line.
override IElement Evaluate(IElement[] Arguments, Variables Variables)
Evaluates the function.
Plot2DHorizontalLine(ScriptNode X, ScriptNode Y, ScriptNode Mode, ScriptNode Color, ScriptNode Size, int Start, int Length, Expression Expression)
Plots a two-dimensional horizontal line.
Plot2DHorizontalLine(ScriptNode X, ScriptNode Y, ScriptNode Mode, int Start, int Length, Expression Expression)
Plots a two-dimensional horizontal line.
override string[] DefaultArgumentNames
Default Argument names
override string[] Aliases
Optional aliases. If there are no aliases for the function, null is returned.
Handles two-dimensional graphs.
Definition: Graph2D.cs:27
Base class for graphs.
Definition: Graph.cs:88
static readonly SKColor DefaultColor
Default color: Red
Definition: Graph.cs:127
Base class for multivariate funcions.
ScriptNode[] Arguments
Function arguments.
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
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
Basic interface for all types of elements.
Definition: IElement.cs:21
object AssociatedObjectValue
Associated object value.
Definition: IElement.cs:34
Basic interface for vectors.
Definition: IVector.cs:9
ArgumentType
Type of parameter used in a function definition or a lambda definition.
Definition: IFunction.cs:9