[chronojump] Updated processMultiDatabases code
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Updated processMultiDatabases code
- Date: Fri, 17 Jan 2020 14:55:35 +0000 (UTC)
commit 41ff377703e470a5a2fa58d1adf22c2ca1c51fd0
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Jan 17 15:55:27 2020 +0100
Updated processMultiDatabases code
processMultiDatabases/computerDB.cs | 1 -
processMultiDatabases/exercise.cs | 71 ++++++++++++++++++++++++++
processMultiDatabases/howto_compile.txt | 2 +-
processMultiDatabases/processMultiDatabases.cs | 25 ++++-----
4 files changed, 82 insertions(+), 17 deletions(-)
---
diff --git a/processMultiDatabases/computerDB.cs b/processMultiDatabases/computerDB.cs
index cb81e15a..1f089fb4 100644
--- a/processMultiDatabases/computerDB.cs
+++ b/processMultiDatabases/computerDB.cs
@@ -60,7 +60,6 @@ class ComputerDB
public string moment12Name;
public string moment18Name;
- public enum ExerciseString { BICEPSCURL, JUMP, SITTOSTAND };
public ComputerDB(
string city,
string computer,
diff --git a/processMultiDatabases/exercise.cs b/processMultiDatabases/exercise.cs
new file mode 100644
index 00000000..2dc7227b
--- /dev/null
+++ b/processMultiDatabases/exercise.cs
@@ -0,0 +1,71 @@
+/*
+ * This file is part of ChronoJump
+ *
+ * ChronoJump is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * ChronoJump is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Copyright (C) 2019 Xavier de Blas <xaviblas gmail com>
+ */
+
+
+using System;
+using System.Collections.Generic; //List<T>
+
+class Exercise
+{
+ public enum Names { BICEPSCURL, JUMP, SITTOSTAND }
+ public enum Contractions { c, ec, ecS }
+
+ public Names name;
+ public int distMin;
+ public Contractions contraction;
+
+ public Exercise (Names name, int distMin, Contractions contraction)
+ {
+ this.name = name;
+ this.distMin = distMin;
+ this.contraction = contraction;
+ }
+}
+
+class ExerciseManage
+{
+ public List<Exercise> list;
+ public ExerciseManage()
+ {
+ list = new List<Exercise>();
+ list.Add(new Exercise(
+ Exercise.Names.BICEPSCURL,
+ 10,
+ Exercise.Contractions.c));
+
+ list.Add(new Exercise(Exercise.Names.JUMP,
+ 5,
+ Exercise.Contractions.c));
+
+ list.Add(new Exercise(Exercise.Names.SITTOSTAND,
+ 10,
+ Exercise.Contractions.c)); //better value c as there's no control on
ecc execution
+ }
+
+ public Exercise GetExercise(Exercise.Names name)
+ {
+ foreach(Exercise ex in list)
+ if(ex.name == name)
+ return ex;
+
+ //default if strange error
+ return list[0];
+ }
+}
diff --git a/processMultiDatabases/howto_compile.txt b/processMultiDatabases/howto_compile.txt
index 0edf622e..cc30c9d1 100644
--- a/processMultiDatabases/howto_compile.txt
+++ b/processMultiDatabases/howto_compile.txt
@@ -1 +1 @@
-mcs processMultiDatabases.cs callR.cs computerDB.cs constants.cs encoderGraphOptions.cs encoderParams.cs
encoderSQL.cs encoderStruct.cs person.cs sqlite.cs util.cs utilDate.cs utilEncoder.cs -r:Mono.Data.Sqlite
-r:System.Data
+mcs processMultiDatabases.cs callR.cs computerDB.cs constants.cs encoderGraphOptions.cs encoderParams.cs
encoderSQL.cs encoderStruct.cs exercise.cs person.cs sqlite.cs util.cs utilDate.cs utilEncoder.cs
-r:Mono.Data.Sqlite -r:System.Data
diff --git a/processMultiDatabases/processMultiDatabases.cs b/processMultiDatabases/processMultiDatabases.cs
index 9a90805f..71965c2f 100644
--- a/processMultiDatabases/processMultiDatabases.cs
+++ b/processMultiDatabases/processMultiDatabases.cs
@@ -118,6 +118,7 @@ class ProcessMultiDatabases
{
sqlite = new Sqlite();
ComputerDBManage compDBManage = new ComputerDBManage();
+ ExerciseManage exManage = new ExerciseManage();
writer = File.CreateText("/tmp/chronojump-processMultiEncoder.csv");
writer.WriteLine("city,computer,person,personCode,sex,exercise,moment,rep,series,exercise,massBody,massExtra,start,width,height,meanSpeed,maxSpeed,maxSpeedT,meanPower,peakPower,peakPowerT,RPD,meanForce,maxForce,maxForceT,RFD,workJ,impulse,laterality,inertiaM");
@@ -127,14 +128,16 @@ class ProcessMultiDatabases
sqlite.CreateConnection(compDB.path);
sqlite.Open();
+ /*
if(compDB.exBicepsCurlID != -1)
- processCompDBEx(compDB, ComputerDB.ExerciseString.BICEPSCURL,
compDB.exBicepsCurlID, 0);
+ processCompDBEx(compDB, exManage.GetExercise(Exercise.Names.BICEPSCURL),
compDB.exBicepsCurlID, 0);
if(compDB.exJumpID != -1)
- processCompDBEx(compDB, ComputerDB.ExerciseString.JUMP, compDB.exJumpID, 100);
+ processCompDBEx(compDB, exManage.GetExercise(Exercise.Names.JUMP),
compDB.exJumpID, 100);
+ */
if(compDB.exSitToStandID != -1)
- processCompDBEx(compDB, ComputerDB.ExerciseString.SITTOSTAND,
compDB.exSitToStandID, 100);
+ processCompDBEx(compDB, exManage.GetExercise(Exercise.Names.SITTOSTAND),
compDB.exSitToStandID, 100);
sqlite.Close();
}
@@ -144,18 +147,10 @@ class ProcessMultiDatabases
Console.WriteLine("processMultiDatabases done!");
}
- private void processCompDBEx (ComputerDB compDB, ComputerDB.ExerciseString exerciseString, int
exerciseID, int percentBodyWeight)
+ private void processCompDBEx (ComputerDB compDB, Exercise exercise, int exerciseID, int
percentBodyWeight)
{
List<EncoderSQL> list = sqlite.SelectEncoder (exerciseID);
- int distMin = 5;
- if(exerciseString == ComputerDB.ExerciseString.BICEPSCURL)
- distMin = distMinBiceps;
- else if(exerciseString == ComputerDB.ExerciseString.JUMP)
- distMin = distMinJump;
- else if(exerciseString == ComputerDB.ExerciseString.SITTOSTAND)
- distMin = distMinSittostand;
-
int count = 0;
foreach(EncoderSQL eSQL in list)
{
@@ -172,11 +167,11 @@ class ProcessMultiDatabases
double personWeight = sqlite.SelectPersonWeight(eSQL.personID);
EncoderParams ep = new EncoderParams(
- distMin,
//preferences.EncoderCaptureMinHeight(encoderConfigurationCurrent.has_inertia),
+ exercise.distMin,
//preferences.EncoderCaptureMinHeight(encoderConfigurationCurrent.has_inertia),
percentBodyWeight, //getExercisePercentBodyWeightFromComboCapture (),
Util.ConvertToPoint(personWeight), //
Util.ConvertToPoint(findMass(Constants.MassType.BODY)),
Util.ConvertToPoint(eSQL.extraWeight),
//Util.ConvertToPoint(findMass(Constants.MassType.EXTRA)),
- "c", //findEccon(true),
//force ecS (ecc-conc separated)
+ exercise.contraction.ToString(), //findEccon(true),
"curvesProcessMultiDB", //"curves" is the same than "curvesAC". was:
analysis. Note curvesProcessMultiDB is like curves but without making the graph
"none", //analysisVariables (not needed in
create curves). Cannot be blank
"p", //analysisOptions,
@@ -223,7 +218,7 @@ class ProcessMultiDatabases
firstRep = false;
else {
string repToWriter = string.Format("{0},{1},{2},{3},{4},{5},{6},",
- compDB.city, compDB.computer, person.Name,
person.FindPersonCode(compDB.city), person.Sex, exerciseString, moment) + rep;
+ compDB.city, compDB.computer, person.Name,
person.FindPersonCode(compDB.city), person.Sex, exercise.name, moment) + rep;
//note personID is not correct because persons sometimes where
evaluated on different chronojump machines
//for this reason has been changed to personName, we suppose is the
same on different machines
//person.FindPersonCode() should be the code of that person on all
the computers of a given city
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]