[chronojump] Added TwoListOfInts UtilMath class
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Added TwoListOfInts UtilMath class
- Date: Tue, 25 May 2021 08:56:36 +0000 (UTC)
commit 4f46273e7418cee0a227decc36945a4e2b8b75aa
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue May 25 10:55:51 2021 +0200
Added TwoListOfInts UtilMath class
src/utilMath.cs | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
---
diff --git a/src/utilMath.cs b/src/utilMath.cs
index ca015b0ef..feddccb46 100644
--- a/src/utilMath.cs
+++ b/src/utilMath.cs
@@ -87,6 +87,54 @@ public class KeyDouble
}
}
+public class TwoListsOfInts
+{
+ private string firstIntName; //just to be able to debug
+ private string secondIntName; //same
+
+ private List<int> first_l;
+ private List<int> second_l;
+
+ public TwoListsOfInts (string firstIntName, string secondIntName)
+ {
+ this.firstIntName = firstIntName;
+ this.secondIntName = secondIntName;
+
+ Reset();
+ }
+
+ public void Reset()
+ {
+ first_l = new List<int>();
+ second_l = new List<int>();
+ }
+
+ public bool HasData()
+ {
+ return (first_l != null && first_l.Count > 0);
+ }
+
+ public int Count()
+ {
+ return first_l.Count;
+ }
+
+ public void Add (int addToFirst, int addToSecond)
+ {
+ first_l.Add(addToFirst);
+ second_l.Add(addToSecond);
+ }
+
+ public int GetFromFirst(int pos)
+ {
+ return first_l[pos];
+ }
+ public int GetFromSecond(int pos)
+ {
+ return second_l[pos];
+ }
+}
+
//like Point but for having an xStart and xEnd
public class PointStartEnd
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]