Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
OneFloatParameter.cs
1using System;
2using SkiaSharp;
3using System.Xml;
4using System.Threading.Tasks;
5
7{
11 public abstract class OneFloatParameter : CanvasOperation
12 {
13 private float parameter;
14
19 {
20 }
21
27 {
28 this.parameter = Parameter;
29 }
30
34 public float Parameter => this.parameter;
35
37 public override bool Equals(object obj)
38 {
39 return (obj is OneFloatParameter Obj &&
40 this.parameter == Obj.parameter);
41 }
42
44 public override int GetHashCode()
45 {
46 return this.parameter.GetHashCode();
47 }
48
50 public override void ExportGraph(XmlWriter Output)
51 {
52 Output.WriteAttributeString("p", Expression.ToString(this.parameter));
53 }
54
56 public override Task ImportGraph(XmlElement Xml, Variables _)
57 {
58 foreach (XmlAttribute Attr in Xml.Attributes)
59 {
60 switch (Attr.Name)
61 {
62 case "p":
63 if (Expression.TryParse(Attr.Value, out float Value))
64 this.parameter = Value;
65 break;
66 }
67 }
68
69 return Task.CompletedTask;
70 }
71 }
72}
Class managing a script expression.
Definition: Expression.cs:39
static bool TryParse(string s, out double Value)
Tries to parse a double-precision floating-point value.
Definition: Expression.cs:4517
static string ToString(double Value)
Converts a value to a string, that can be parsed as part of an expression.
Definition: Expression.cs:4496
Abstract base class for canvas operations.
Abstract base class for operations using one floating point parameter.
override void ExportGraph(XmlWriter Output)
Exports graph specifics to XML.
OneFloatParameter(float Parameter)
Abstract base class for operations using one floating point parameter.
OneFloatParameter()
Abstract base class for operations using one floating point parameter.
override Task ImportGraph(XmlElement Xml, Variables _)
Imports graph specifics from XML.
Collection of variables.
Definition: Variables.cs:25