Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Plot2DHorizontalLine.cs
4
6{
16 {
17 private static readonly ArgumentType[] argumentTypes5Parameters = new ArgumentType[] { ArgumentType.Vector, ArgumentType.Vector, ArgumentType.Scalar, ArgumentType.Scalar, ArgumentType.Scalar };
18 private static readonly ArgumentType[] argumentTypes4Parameters = new ArgumentType[] { ArgumentType.Vector, ArgumentType.Vector, ArgumentType.Scalar, ArgumentType.Scalar };
19 private static readonly ArgumentType[] argumentTypes3Parameters = new ArgumentType[] { ArgumentType.Vector, ArgumentType.Vector, ArgumentType.Scalar };
20
31 : base(new ScriptNode[] { X, Y, Mode }, argumentTypes3Parameters, Start, Length, Expression)
32 {
33 }
34
46 : base(new ScriptNode[] { X, Y, Mode, Color }, argumentTypes4Parameters, Start, Length, Expression)
47 {
48 }
49
62 : base(new ScriptNode[] { X, Y, Mode, Color, Size }, argumentTypes5Parameters, Start, Length, Expression)
63 {
64 }
65
69 public override string FunctionName => nameof(Plot2DHorizontalLine);
70
74 public override string[] Aliases => new string[] { "plot2dhline" };
75
79 public override string[] DefaultArgumentNames
80 {
81 get { return new string[] { "x", "y", "color", "size" }; }
82 }
83
91 {
92 if (!(Arguments[0] is IVector X))
93 throw new ScriptRuntimeException("Expected vector for X argument.", this);
94
95 if (!(Arguments[1] is IVector Y))
96 throw new ScriptRuntimeException("Expected vector for Y argument.", this);
97
98 int Dimension = X.Dimension;
99 if (Y.Dimension != Dimension)
100 throw new ScriptRuntimeException("Vector size mismatch.", this);
101
102 IElement Mode = Arguments[2];
103 IElement Color = Arguments.Length <= 3 ? null : Arguments[3];
104 IElement Size = Arguments.Length <= 4 ? null : Arguments[4];
105
106 return new Graph2D(Variables, X, Y, new Plot2DHorizontalLinePainter(), false, false, this, Mode.AssociatedObjectValue,
108 }
109 }
110}
Class managing a script expression.
Definition: Expression.cs:39
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:26
Base class for graphs.
Definition: Graph.cs:79
static readonly SKColor DefaultColor
Default color: Red
Definition: Graph.cs:118
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:20
object AssociatedObjectValue
Associated object value.
Definition: IElement.cs:33
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