aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/SideChains/RealTimeGraphX-master/RealTimeGraphX/GraphDataPointHelper.cs
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-04-23 22:25:54 +0300
committerShlomo Hecht <shlomo@twine-s.com>2019-04-23 22:25:54 +0300
commitebcb9ce27131e4bbd14c96b5f897a67bc752aaeb (patch)
tree293aee8b1751ce7fce542645722c0f1a96b73097 /Software/Visual_Studio/SideChains/RealTimeGraphX-master/RealTimeGraphX/GraphDataPointHelper.cs
parent52967e858bd52621208f6360e84f4c47ec435816 (diff)
parent636ad730569dfef1a4ee04c8d716d510bcc47ee1 (diff)
downloadTango-ebcb9ce27131e4bbd14c96b5f897a67bc752aaeb.tar.gz
Tango-ebcb9ce27131e4bbd14c96b5f897a67bc752aaeb.zip
merge alarm handling from remote
Diffstat (limited to 'Software/Visual_Studio/SideChains/RealTimeGraphX-master/RealTimeGraphX/GraphDataPointHelper.cs')
-rw-r--r--Software/Visual_Studio/SideChains/RealTimeGraphX-master/RealTimeGraphX/GraphDataPointHelper.cs48
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;
+ }
+ }
+}