diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-04-15 12:06:30 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-04-15 12:06:30 +0300 |
| commit | 3c5f32456c72b26497c05bb35fd64e3c77c6b0f5 (patch) | |
| tree | 4d6b489f02e147e89c23871011512a51daa478fa /Software/Visual_Studio/SideChains/RealTimeGraphX-master/RealTimeGraphX/GraphDataPointHelper.cs | |
| parent | 85a6112d2e1eac554cc4cbdfa31cca91d87e6ded (diff) | |
| download | Tango-3c5f32456c72b26497c05bb35fd64e3c77c6b0f5.tar.gz Tango-3c5f32456c72b26497c05bb35fd64e3c77c6b0f5.zip | |
Now using the latest RealTimeGraphX library! + infinity check!
Diffstat (limited to 'Software/Visual_Studio/SideChains/RealTimeGraphX-master/RealTimeGraphX/GraphDataPointHelper.cs')
| -rw-r--r-- | Software/Visual_Studio/SideChains/RealTimeGraphX-master/RealTimeGraphX/GraphDataPointHelper.cs | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/Software/Visual_Studio/SideChains/RealTimeGraphX-master/RealTimeGraphX/GraphDataPointHelper.cs b/Software/Visual_Studio/SideChains/RealTimeGraphX-master/RealTimeGraphX/GraphDataPointHelper.cs new file mode 100644 index 000000000..b28d7a501 --- /dev/null +++ b/Software/Visual_Studio/SideChains/RealTimeGraphX-master/RealTimeGraphX/GraphDataPointHelper.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace RealTimeGraphX +{ + /// <summary> + /// Represents an <see cref="IGraphDataPoint"/> helper class. + /// </summary> + public static class GraphDataPointHelper + { + /// <summary> + /// Returns the absolute value of the specified percentage value between the specified minimum and maximum values. + /// </summary> + /// <param name="min">The minimum.</param> + /// <param name="max">The maximum.</param> + /// <param name="percentage">The percentage.</param> + /// <returns></returns> + public static T ComputeAbsolutePosition<T>(T min, T max, double percentage) where T : class, IGraphDataPoint + { + return (Activator.CreateInstance(min.GetType()) as T).ComputeAbsolutePosition(min, max, percentage) as T; + } + + /// <summary> + /// Creates a range of values from the specified minimum and maximum. + /// </summary> + /// <param name="min">The minimum.</param> + /// <param name="max">The maximum.</param> + /// <param name="count">The count.</param> + /// <returns></returns> + public static IEnumerable<T> CreateRange<T>(IGraphDataPoint min, IGraphDataPoint max, int count) where T : class, IGraphDataPoint + { + return (Activator.CreateInstance(min.GetType()) as T).CreateRange(min, max, count) as IEnumerable<T>; + } + + /// <summary> + /// Initializes a new instance of the specified <see cref="IGraphDataPoint"/> type. + /// </summary> + /// <typeparam name="T"></typeparam> + /// <returns></returns> + public static T Init<T>() where T : class, IGraphDataPoint + { + return Activator.CreateInstance(typeof(T)) as T; + } + } +} |
