[chronojump] Static method for List<Jump>, List<Run> to return List<event>
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Static method for List<Jump>, List<Run> to return List<event>
- Date: Thu, 18 Jun 2020 11:24:54 +0000 (UTC)
commit caa08d451e04bae5acb3f522b88d4804737087ec
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Jun 18 13:14:59 2020 +0200
Static method for List<Jump>,List<Run> to return List<event>
src/jump.cs | 10 +++++++++-
src/run.cs | 11 ++++++++++-
2 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/src/jump.cs b/src/jump.cs
index 6305ca6b..5056ce5d 100644
--- a/src/jump.cs
+++ b/src/jump.cs
@@ -21,7 +21,7 @@
using System;
using System.Data;
using System.Text; //StringBuilder
-
+using System.Collections.Generic; //List
using Mono.Unix;
public class Jump : Event
@@ -74,6 +74,14 @@ public class Jump : Event
this.datetime = eventString[11];
}
+ public static List<Event> JumpListToEventList(List<Jump> jumps)
+ {
+ List<Event> events = new List<Event>();
+ foreach(Jump jump in jumps)
+ events.Add((Event) jump);
+
+ return events;
+ }
public override int InsertAtDB (bool dbconOpened, string tableName) {
return SqliteJump.Insert(dbconOpened, tableName,
diff --git a/src/run.cs b/src/run.cs
index 9a2424c4..8129b77b 100644
--- a/src/run.cs
+++ b/src/run.cs
@@ -20,7 +20,7 @@
using System;
using System.Data;
-
+using System.Collections.Generic; //List
using System.Threading;
using Mono.Unix;
@@ -78,6 +78,15 @@ public class Run : Event
this.initialSpeed = Util.IntToBool(Convert.ToInt32(eventString[8]));
}
+ public static List<Event> RunListToEventList(List<Run> runs)
+ {
+ List<Event> events = new List<Event>();
+ foreach(Run run in runs)
+ events.Add((Event) run);
+
+ return events;
+ }
+
public override int InsertAtDB (bool dbconOpened, string tableName) {
return SqliteRun.Insert(dbconOpened, tableName,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]