Isis-fish-community-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- 52 discussions
Author: echatellier
Date: 2022-04-29 15:49:46 +0200 (Fri, 29 Apr 2022)
New Revision: 61
Url: http://forge.codelutin.com/projects/isis-fish-community/repository/revision…
Log:
Update repo url
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2022-04-29 09:07:16 UTC (rev 60)
+++ trunk/pom.xml 2022-04-29 13:49:46 UTC (rev 61)
@@ -71,7 +71,7 @@
<dependency>
<groupId>fr.ifremer</groupId>
<artifactId>isis-fish-data</artifactId>
- <version>LATEST</version>
+ <version>4.4.7</version>
<scope>compile</scope>
</dependency>
</dependencies>
@@ -93,12 +93,12 @@
<repositories>
<repository>
- <id>nuiton.release</id>
- <url>https://maven.nuiton.org/release</url>
+ <id>nuiton.public</id>
+ <url>https://nexus.nuiton.org/nexus/content/groups/public/</url>
</repository>
<repository>
<id>nuiton.snapshot</id>
- <url>https://maven.nuiton.org/snapshot</url>
+ <url>https://nexus.nuiton.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
</project>
1
0
Author: echatellier
Date: 2022-04-29 11:07:16 +0200 (Fri, 29 Apr 2022)
New Revision: 60
Url: http://forge.codelutin.com/projects/isis-fish-community/repository/revision…
Log:
Update repo url
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2020-07-23 09:32:50 UTC (rev 59)
+++ trunk/pom.xml 2022-04-29 09:07:16 UTC (rev 60)
@@ -94,11 +94,11 @@
<repositories>
<repository>
<id>nuiton.release</id>
- <url>http://maven.nuiton.org/release</url>
+ <url>https://maven.nuiton.org/release</url>
</repository>
<repository>
<id>nuiton.snapshot</id>
- <url>http://maven.nuiton.org/snapshot</url>
+ <url>https://maven.nuiton.org/snapshot</url>
</repository>
</repositories>
</project>
1
0
Author: echatellier
Date: 2020-07-23 11:32:50 +0200 (Thu, 23 Jul 2020)
New Revision: 59
Url: http://forge.codelutin.com/projects/isis-fish-community/repository/revision…
Log:
Ajout d'un fichier d'exemple de code
Added:
trunk/rules/ExampleDemoCodeRule.java
Added: trunk/rules/ExampleDemoCodeRule.java
===================================================================
--- trunk/rules/ExampleDemoCodeRule.java (rev 0)
+++ trunk/rules/ExampleDemoCodeRule.java 2020-07-23 09:32:50 UTC (rev 59)
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2020 chatellier
+ *
+ * This program 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 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ */
+package rules;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.nuiton.math.matrix.*;
+import resultinfos.*;
+
+import java.io.*;
+import fr.ifremer.isisfish.util.*;
+import java.util.*;
+import scripts.*;
+import fr.ifremer.isisfish.simulator.SimulationContext;
+import fr.ifremer.isisfish.types.TimeStep;
+import fr.ifremer.isisfish.entities.*;
+import fr.ifremer.isisfish.rule.AbstractRule;
+
+/**
+ * Fichier contenant des exemples de code couramment utilisé dans les règles.
+ */
+public class ExampleDemoCodeRule extends AbstractRule {
+
+ /** to use log facility, just put in your code: log.info("..."); */
+ private static Log log = LogFactory.getLog(ExampleDemoCodeRule.class);
+
+ @Doc("Valeur")
+ public int param_value;
+
+ protected String[] necessaryResult = {
+ MatrixBiomass.NAME, MatrixBiomass.NAME
+ };
+
+ public String[] getNecessaryResult() {
+ return this.necessaryResult;
+ }
+
+ /**
+ * Permet d'afficher a l'utilisateur une aide sur la regle.
+ * @return L'aide ou la description de la regle
+ */
+ public String getDescription() throws Exception {
+ return "TODO description rule";
+ }
+
+ /**
+ * Appelé au démarrage de la simulation, cette méthode permet d'initialiser
+ * des valeurs.
+ *
+ * @param context la simulation pour lequel on utilise cette regle
+ */
+ public void init(SimulationContext context) throws Exception {
+ }
+
+ /**
+ * La condition qui doit etre vrai pour faire les actions.
+ *
+ * @param context la simulation pour lequel on utilise cette regle
+ * @param step le pas de temps courant
+ * @param metier le metier concerné
+ * @return vrai si on souhaite que les actions soit faites
+ */
+ public boolean condition(SimulationContext context, TimeStep step, Metier metier) throws Exception {
+ return false;
+ }
+
+ /**
+ * Si la condition est vrai alors cette action est executee avant le pas
+ * de temps de la simulation.
+ *
+ * @param context la simulation pour lequel on utilise cette regle
+ * @param step le pas de temps courant
+ * @param metier le metier concerné
+ */
+ public void preAction(SimulationContext context, TimeStep step, Metier metier) throws Exception {
+
+ // récupérer une population en base de données
+ Population myPop = context.getPopulationDAO().findByName("MyPop");
+
+ // récupérer seulement les populations sélectionnées dans les paramêtres
+ SiMatrix siMatrix = SiMatrix.getSiMatrix(context);
+ List<Population> populations = siMatrix.getPopulations(step);
+
+
+ // lire le contenu d'un fichier
+ File file = new File("/path...");
+ String content = ScriptUtil.readAsString(file);
+ // ajouter une ligne à la fin d'un fichier
+ FileUtils.writeStringToFile(file, "texte", true);
+ // lecture ligne par ligne
+ List<String> lignes = FileUtils.readLines(file);
+ for (String ligne : lignes) {
+ // ...
+ }
+
+ // lecture d'un nombre dans un fichier
+ String content2 = FileUtils.readFileToString(file);
+ double value = Double.parseDouble(content2);
+
+ // Fichier de propriété
+ // key=value
+ // key2=valeur2
+ Properties props = new Properties();
+ props.load(new FileInputStream(file));
+ String value2 = props.getProperty("key");
+
+ // acceder à un resultat
+ MatrixND abundance = context.getResultManager().getMatrix(MatrixAbundance.NAME);
+ MatrixND biomassStep = context.getResultManager().getMatrix(step, MatrixBiomass.NAME);
+ // sauver un resultat après modification
+ context.getResultManager().addResult(step, biomassStep);
+
+ // l'abondance en cours est aussi dans population monitor
+ MatrixND N = context.getPopulationMonitor().getN(myPop);
+ context.getPopulationMonitor().setN(myPop, N);
+
+ // creation d'un nouveau résultat
+ MatrixND monResult = MatrixFactory.getInstance()
+ .create("MonResult", new int[]{2, 3});
+ monResult.setValue(0, 0, 42);
+ context.getResultManager().addResult(step, monResult);
+
+ }
+
+ /**
+ * Si la condition est vrai alors cette action est executée apres le pas
+ * de temps de la simulation.
+ *
+ * @param context La simulation pour lequel on utilise cette regle
+ * @param step le pas de temps courant
+ * @param metier le metier concerné
+ */
+ public void postAction(SimulationContext context, TimeStep step, Metier metier) throws Exception {
+
+ }
+}
1
0
Author: echatellier
Date: 2019-12-19 17:22:10 +0100 (Thu, 19 Dec 2019)
New Revision: 58
Url: http://forge.codelutin.com/projects/isis-fish-community/repository/revision…
Log:
Improve code
Modified:
trunk/rules/HCR_transition_MSY.java
Modified: trunk/rules/HCR_transition_MSY.java
===================================================================
--- trunk/rules/HCR_transition_MSY.java 2019-01-24 09:55:28 UTC (rev 57)
+++ trunk/rules/HCR_transition_MSY.java 2019-12-19 16:22:10 UTC (rev 58)
@@ -300,7 +300,7 @@
// List<Population> populations = Collections.singletonList(pop);
//
// MatrixND TacPopMatrix = MatrixFactory.getInstance().create(MatrixTacPerPop.NAME, new List[] { populations },
- // new String[] { n_("Populations") });
+ // new String[] { "Populations" });
//
// if (step.getMonth() == Month.JANUARY) { // Pas besoin car postAction ne s'applique que si la condition est vraie
// TacPopMatrix.setValue(param_population, TacReel);
1
0
Author: jcouteau
Date: 2019-01-24 10:55:28 +0100 (Thu, 24 Jan 2019)
New Revision: 57
Url: http://forge.codelutin.com/projects/isis-fish-community/repository/revision…
Log:
Update Mortalite exports
Modified:
trunk/exports/MortalitePecheGroupe.java
trunk/exports/MortalitePecheTotale.java
Modified: trunk/exports/MortalitePecheGroupe.java
===================================================================
--- trunk/exports/MortalitePecheGroupe.java 2018-04-05 08:47:25 UTC (rev 56)
+++ trunk/exports/MortalitePecheGroupe.java 2019-01-24 09:55:28 UTC (rev 57)
@@ -2,7 +2,7 @@
* #%L
* IsisFish data
* %%
- * Copyright (C) 2006 - 2018 Ifremer, CodeLutin
+ * Copyright (C) 2006 - 2013 Ifremer, CodeLutin
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -28,14 +28,12 @@
import org.nuiton.math.matrix.*;
-import resultinfos.MatrixAbundance;
-import resultinfos.MatrixCatchPerStrategyMetPerZonePop;
-import resultinfos.MatrixFishingMortalityPerGroup;
-
import fr.ifremer.isisfish.entities.*;
-import fr.ifremer.isisfish.export.Export;
+import fr.ifremer.isisfish.export.ExportStep;
import fr.ifremer.isisfish.types.TimeStep;
+import fr.ifremer.isisfish.types.Month;
import fr.ifremer.isisfish.datastore.SimulationStorage;
+import resultinfos.*;
/**
* FishingMortality.java
@@ -47,15 +45,13 @@
*
* Last update: $Date: 0000-00-00 00:00:00 $ by : $Author: $
*/
-public class MortalitePecheGroupe implements Export {
+public class MortalitePecheGroupe implements ExportStep{
/** to use log facility, just put in your code: log.info("..."); */
static private Log log = LogFactory.getLog(MortalitePecheGroupe.class);
- protected String[] necessaryResult = {
- MatrixFishingMortalityPerGroup.NAME,
- MatrixCatchPerStrategyMetPerZonePop.NAME,
- MatrixAbundance.NAME
+ protected String[] necessaryResult = {
+ MatrixFishingMortalityPerGroup.NAME
};
@Override
@@ -79,31 +75,28 @@
}
@Override
- public void export(SimulationStorage simulation, Writer out)
- throws Exception {
- TimeStep lastStep = simulation.getResultStorage().getLastStep();
-
- for (Population pop : simulation.getParameter().getPopulations()) {
-// for (PopulationGroup group : pop.getPopulationGroup()) { // Rajouter une boucle sur les groupes ??
- for (TimeStep step = new TimeStep(0); !step.after(lastStep); step = step.next()) {
-
- MatrixND mat = simulation.getResultStorage().getMatrix(step,
- pop, MatrixFishingMortalityPerGroup.NAME); // group
-
- if (mat != null) { // can be null if simulation is stopped before last year simulation
- for (MatrixIterator i = mat.iterator(); i.hasNext();) {
- i.next();
- Object[] sems = i.getSemanticsCoordinates();
- PopulationGroup group = (PopulationGroup)sems[1];
- double val = i.getValue();
-
- out.write(pop.getName() + ";" + step.getStep() + ";" + group.getAge() + ";" + val + "\n"); // + ";" + group.getAge()
- }
- }
- }
- //}
- }
- }
- }
-
-
+ public void exportBegin(SimulationStorage simulation, Writer out) throws Exception {
+ out.write("population;step;group;value\n");
+ }
+
+ @Override
+ public void export(SimulationStorage simulation, TimeStep step, Writer out) throws Exception {
+ if (step.getMonth()== Month.DECEMBER){ // F is calculated for a whole year in december.
+ for (Population pop : simulation.getParameter().getPopulations()) {
+ MatrixND mat = simulation.getResultStorage().getMatrix(step,pop, MatrixFishingMortalityPerGroup.NAME); // group
+ if (mat != null) { // can be null if simulation is stopped before last year simulation
+ for (MatrixIterator i = mat.iterator(); i.hasNext();) {
+ i.next();
+ Object[] sems = i.getSemanticsCoordinates();
+ double val = i.getValue();
+ PopulationGroup group = (PopulationGroup)sems[0];
+ out.write(pop.getName() + ";" + step.getStep() + ";" + group.getId() + ";" + val + "\n");
+ }
+ }
+ }
+ }
+ }
+ @Override
+ public void exportEnd(SimulationStorage simulation, Writer out) throws Exception {
+ }
+}
\ No newline at end of file
Modified: trunk/exports/MortalitePecheTotale.java
===================================================================
--- trunk/exports/MortalitePecheTotale.java 2018-04-05 08:47:25 UTC (rev 56)
+++ trunk/exports/MortalitePecheTotale.java 2019-01-24 09:55:28 UTC (rev 57)
@@ -1,107 +1,105 @@
-/*
- * #%L
- * IsisFish data
- * %%
- * Copyright (C) 2006 - 2018 Ifremer, CodeLutin
- * %%
- * This program 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.
- *
- * This program 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, see
- * <http://www.gnu.org/licenses/gpl-2.0.html>.
- * #L%
- */
-package exports;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.Writer;
-
-import org.nuiton.math.matrix.*;
-
-import resultinfos.MatrixAbundance;
-import resultinfos.MatrixCatchPerStrategyMetPerZonePop;
-import resultinfos.MatrixFishingMortalityPerGroup;
-import resultinfos.MatrixTotalFishingMortality;
-
-import fr.ifremer.isisfish.entities.*;
-import fr.ifremer.isisfish.export.Export;
-import fr.ifremer.isisfish.types.TimeStep;
-import fr.ifremer.isisfish.datastore.SimulationStorage;
-
-/**
- * FishingMortality.java
- *
- * Created: 19 Avril 2012
- *
- * @author anonymous <anonymous(a)labs.libre-entreprise.org>
- * @version $Revision: 0.1 $
- *
- * Last update: $Date: 0000-00-00 00:00:00 $ by : $Author: $
- */
-public class MortalitePecheTotale implements Export {
-
- /** to use log facility, just put in your code: log.info("..."); */
- static private Log log = LogFactory.getLog(MortalitePecheTotale.class);
-
- protected String[] necessaryResult = {
- MatrixTotalFishingMortality.NAME,
- MatrixFishingMortalityPerGroup.NAME,
- MatrixCatchPerStrategyMetPerZonePop.NAME,
- MatrixAbundance.NAME
- };
-
- @Override
- public String[] getNecessaryResult() {
- return this.necessaryResult;
- }
-
- @Override
- public String getExportFilename() {
- return "MortalitePecheTotale";
- }
-
- @Override
- public String getExtensionFilename() {
- return ".csv";
- }
-
- @Override
- public String getDescription() {
- return "Exporte la mortalite par peche totale de la simulation par population (Fpop par an calcule en decembre)";
- }
-
- @Override
- public void export(SimulationStorage simulation, Writer out)
- throws Exception {
- TimeStep lastStep = simulation.getResultStorage().getLastStep();
-
- for (Population pop : simulation.getParameter().getPopulations()) {
- for (TimeStep step = new TimeStep(0); !step.after(lastStep); step = step.next()) {
-
- MatrixND mat = simulation.getResultStorage().getMatrix(step,
- pop, MatrixTotalFishingMortality.NAME);
-
- if (mat != null) { // can be null if simulation is stopped before last year simulation
- for (MatrixIterator i = mat.iterator(); i.hasNext();) {
- i.next();
- double val = i.getValue();
-
- out.write(pop.getName() + ";" + step.getStep() + ";" + val + "\n");
- }
- }
- }
- }
- }
-}
-
-
+/*
+ * #%L
+ * IsisFish data
+ * %%
+ * Copyright (C) 2006 - 2011 Ifremer, CodeLutin
+ * %%
+ * This program 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.
+ *
+ * This program 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, see
+ * <http://www.gnu.org/licenses/gpl-2.0.html>.
+ * #L%
+ */
+package exports;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.Writer;
+
+import org.nuiton.math.matrix.*;
+
+import fr.ifremer.isisfish.entities.*;
+import fr.ifremer.isisfish.export.ExportStep;
+import fr.ifremer.isisfish.types.TimeStep;
+import fr.ifremer.isisfish.types.Month;
+import fr.ifremer.isisfish.datastore.SimulationStorage;
+
+import resultinfos.*;
+
+/**
+ * FishingMortality.java
+ *
+ * Created: 19 Avril 2012
+ *
+ * @author anonymous <anonymous(a)labs.libre-entreprise.org>
+ * @version $Revision: 0.1 $
+ *
+ * Last update: $Date: 0000-00-00 00:00:00 $ by : $Author: $
+ */
+public class MortalitePecheTotale implements ExportStep {
+
+ /** to use log facility, just put in your code: log.info("..."); */
+ static private Log log = LogFactory.getLog(MortalitePecheTotale.class);
+
+ protected String[] necessaryResult = {
+ MatrixTotalFishingMortality.NAME
+ };
+
+ @Override
+ public String[] getNecessaryResult() {
+ return this.necessaryResult;
+ }
+
+ @Override
+ public String getExportFilename() {
+ return "MortalitePecheTotale";
+ }
+
+ @Override
+ public String getExtensionFilename() {
+ return ".csv";
+ }
+
+ @Override
+ public String getDescription() {
+ return "Exporte la mortalite par peche totale de la simulation par population (Fpop par an calcule en decembre)";
+ }
+
+ @Override
+ public void exportBegin(SimulationStorage simulation, Writer out) throws Exception {
+ out.write("population;step;value\n");
+ }
+
+ @Override
+ public void export(SimulationStorage simulation,TimeStep step, Writer out) throws Exception {
+ if (step.getMonth()== Month.DECEMBER){ // F is calculated for a whole year in december.
+ TimeStep lastStep = simulation.getResultStorage().getLastStep();
+ for (Population pop : simulation.getParameter().getPopulations()){
+ MatrixND mat = simulation.getResultStorage().getMatrix(step,pop, MatrixTotalFishingMortality.NAME);
+ if (mat != null) { // can be null if simulation is stopped before last year simulation
+ for (MatrixIterator i = mat.iterator(); i.hasNext();) {
+ i.next();
+ double val = i.getValue();
+ out.write(pop.getName() + ";" + step.getStep() + ";" + val + "\n");
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public void exportEnd(SimulationStorage simulation, Writer out) throws Exception {
+ }
+}
+
+
1
0
Author: echatellier
Date: 2018-04-05 10:47:25 +0200 (Thu, 05 Apr 2018)
New Revision: 56
Url: http://forge.codelutin.com/projects/isis-fish-community/repository/revision…
Log:
Improve code
Modified:
trunk/rules/GraviteVPUE1_Ponderation.java
trunk/rules/TACpoids20012011.java
trunk/rules/TACpoids20012011OgiveTriMerlu.java
trunk/rules/TACpoids20012011TailleMin.java
trunk/rules/TACpoidsPop.java
trunk/rules/TACpoidsPop20082011.java
trunk/rules/TACpoidsPop_PourHCR.java
trunk/rules/TACpoidsTailleMin.java
Modified: trunk/rules/GraviteVPUE1_Ponderation.java
===================================================================
--- trunk/rules/GraviteVPUE1_Ponderation.java 2018-04-05 08:40:29 UTC (rev 55)
+++ trunk/rules/GraviteVPUE1_Ponderation.java 2018-04-05 08:47:25 UTC (rev 56)
@@ -64,7 +64,7 @@
/** stocke la somme des prop initiales [str x month] */
private MatrixND SommePropInitial = null;
- /** stocke par strat*met, la dernière attractivite pour chaque mois [str x met x month] */
+ /* stocke par strat*met, la dernere attractivite pour chaque mois [str x met x month] */
/** permet de stocker les CPUE nominales [str x met] */
private MatrixND valuePerUnitOfEffort = null;
@@ -151,7 +151,7 @@
}
}
- /** Setting the different scenarios parameters; */
+ /* Setting the different scenarios parameters; */
//fishers behavior: alpha varies between 0 (fully static) to 1 (fully dynamic);
//alpha = 0.5;
Modified: trunk/rules/TACpoids20012011.java
===================================================================
--- trunk/rules/TACpoids20012011.java 2018-04-05 08:40:29 UTC (rev 55)
+++ trunk/rules/TACpoids20012011.java 2018-04-05 08:47:25 UTC (rev 56)
@@ -207,8 +207,7 @@
* @param metier le metier concerne
*/
@Override
- public void preAction(SimulationContext context, TimeStep step, Metier metier)
- throws Exception {
+ public void preAction(SimulationContext context, TimeStep step, Metier metier) throws Exception {
affectation = true;
log.info("[TAC] preAction for: " + metier);
@@ -223,7 +222,7 @@
//recupere toutes les strategies pratiquant le metier et pour lesquelles la proportion !=0
SiMatrix siMatrix = SiMatrix.getSiMatrix(context);
- Set<Strategy> strs = new HashSet<Strategy>();
+ Set<Strategy> strs = new HashSet<>();
for (Strategy str : siMatrix.getStrategies(step)) {
double prop = str.getStrategyMonthInfo(step.getMonth())
.getProportionMetier(metier);
@@ -239,14 +238,14 @@
// 1er cas de figure: l'effort est reporte sur un metier de la
// meme strategie, n'ayant pas l'espece comme capture principale
// et pechant avec le meme engin
- Set<Metier> possibleMetierCase1 = new HashSet<Metier>();
+ Set<Metier> possibleMetierCase1 = new HashSet<>();
// second cas de figure: on cherche un metier de substitution
// sans condition sur les engins, mais qui soit pratique
- Set<Metier> possibleMetierCase2 = new HashSet<Metier>();
+ Set<Metier> possibleMetierCase2 = new HashSet<>();
// 3 eme cas de figure: on cherche des metiers non vises,
// sans consideration sur les engins, et pour lesquels la
// proportion peut etre nulle
- Set<Metier> possibleMetierCase3 = new HashSet<Metier>();
+ Set<Metier> possibleMetierCase3 = new HashSet<>();
for (EffortDescription effort : str.getSetOfVessels()
.getPossibleMetiers()) {
Modified: trunk/rules/TACpoids20012011OgiveTriMerlu.java
===================================================================
--- trunk/rules/TACpoids20012011OgiveTriMerlu.java 2018-04-05 08:40:29 UTC (rev 55)
+++ trunk/rules/TACpoids20012011OgiveTriMerlu.java 2018-04-05 08:47:25 UTC (rev 56)
@@ -213,8 +213,7 @@
* @param step le pas de temps courant
* @param metier le metier concern */
@Override
- public void preAction(SimulationContext context, TimeStep step, Metier metier)
- throws Exception {
+ public void preAction(SimulationContext context, TimeStep step, Metier metier) throws Exception {
// la preaction ne tourne que si le TAC est atteint
affectation = true;
@@ -233,7 +232,7 @@
//recupere toutes les strategies pratiquant le metier et pour lesquelles la proportion !=0
SiMatrix siMatrix = SiMatrix.getSiMatrix(context);
- Set<Strategy> strs = new HashSet<Strategy>();
+ Set<Strategy> strs = new HashSet<>();
for (Strategy str : siMatrix.getStrategies(step)) {
double prop = str.getStrategyMonthInfo(step.getMonth())
.getProportionMetier(metier);
@@ -249,14 +248,14 @@
// 1er cas de figure: l'effort est reporte sur un metier de la
// meme strategie, n'ayant pas l'espece comme capture principale
// et pechant avec le meme engin
- Set<Metier> possibleMetierCase1 = new HashSet<Metier>();
+ Set<Metier> possibleMetierCase1 = new HashSet<>();
// second cas de figure: on cherche un metier de substitution
// sans condition sur les engins, mais qui soit pratique
- Set<Metier> possibleMetierCase2 = new HashSet<Metier>();
+ Set<Metier> possibleMetierCase2 = new HashSet<>();
// 3 eme cas de figure: on cherche des metiers non vises,
// sans consideration sur les engins, et pour lesquels la
// proportion peut etre nulle
- Set<Metier> possibleMetierCase3 = new HashSet<Metier>();
+ Set<Metier> possibleMetierCase3 = new HashSet<>();
for (EffortDescription effort : str.getSetOfVessels()
.getPossibleMetiers()) {
Modified: trunk/rules/TACpoids20012011TailleMin.java
===================================================================
--- trunk/rules/TACpoids20012011TailleMin.java 2018-04-05 08:40:29 UTC (rev 55)
+++ trunk/rules/TACpoids20012011TailleMin.java 2018-04-05 08:47:25 UTC (rev 56)
@@ -208,8 +208,7 @@
* @param step le pas de temps courant
* @param metier le metier concern */
@Override
- public void preAction(SimulationContext context, TimeStep step, Metier metier)
- throws Exception {
+ public void preAction(SimulationContext context, TimeStep step, Metier metier) throws Exception {
// la preaction ne tourne que si le TAC est atteint
affectation = true;
@@ -228,7 +227,7 @@
//recupere toutes les strategies pratiquant le metier et pour lesquelles la proportion !=0
SiMatrix siMatrix = SiMatrix.getSiMatrix(context);
- Set<Strategy> strs = new HashSet<Strategy>();
+ Set<Strategy> strs = new HashSet<>();
for (Strategy str : siMatrix.getStrategies(step)) {
double prop = str.getStrategyMonthInfo(step.getMonth())
.getProportionMetier(metier);
@@ -244,14 +243,14 @@
// 1er cas de figure: l'effort est reporte sur un metier de la
// meme strategie, n'ayant pas l'espece comme capture principale
// et pechant avec le meme engin
- Set<Metier> possibleMetierCase1 = new HashSet<Metier>();
+ Set<Metier> possibleMetierCase1 = new HashSet<>();
// second cas de figure: on cherche un metier de substitution
// sans condition sur les engins, mais qui soit pratique
- Set<Metier> possibleMetierCase2 = new HashSet<Metier>();
+ Set<Metier> possibleMetierCase2 = new HashSet<>();
// 3 eme cas de figure: on cherche des metiers non vises,
// sans consideration sur les engins, et pour lesquels la
// proportion peut etre nulle
- Set<Metier> possibleMetierCase3 = new HashSet<Metier>();
+ Set<Metier> possibleMetierCase3 = new HashSet<>();
for (EffortDescription effort : str.getSetOfVessels()
.getPossibleMetiers()) {
Modified: trunk/rules/TACpoidsPop.java
===================================================================
--- trunk/rules/TACpoidsPop.java 2018-04-05 08:40:29 UTC (rev 55)
+++ trunk/rules/TACpoidsPop.java 2018-04-05 08:47:25 UTC (rev 56)
@@ -179,8 +179,7 @@
* @param metier le metier concerne
*/
@Override
- public void preAction(SimulationContext context, TimeStep step, Metier metier)
- throws Exception {
+ public void preAction(SimulationContext context, TimeStep step, Metier metier) throws Exception {
affectation = false;
log.info("[TAC] preAction for: " + metier);
@@ -195,7 +194,7 @@
//recupere toutes les strategies pratiquant le metier et pour lesquelles la proportion !=0
SiMatrix siMatrix = SiMatrix.getSiMatrix(context);
- Set<Strategy> strs = new HashSet<Strategy>();
+ Set<Strategy> strs = new HashSet<>();
for (Strategy str : siMatrix.getStrategies(step)) {
double prop = str.getStrategyMonthInfo(step.getMonth())
.getProportionMetier(metier);
@@ -211,14 +210,14 @@
// 1er cas de figure: l'effort est reporte sur un metier de la
// meme strategie, n'ayant pas l'espece comme capture principale
// et pechant avec le meme engin
- Set<Metier> possibleMetierCase1 = new HashSet<Metier>();
+ Set<Metier> possibleMetierCase1 = new HashSet<>();
// second cas de figure: on cherche un metier de substitution
// sans condition sur les engins, mais qui soit pratique
- Set<Metier> possibleMetierCase2 = new HashSet<Metier>();
+ Set<Metier> possibleMetierCase2 = new HashSet<>();
// 3 eme cas de figure: on cherche des metiers non vises,
// sans consideration sur les engins, et pour lesquels la
// proportion peut etre nulle
- Set<Metier> possibleMetierCase3 = new HashSet<Metier>();
+ Set<Metier> possibleMetierCase3 = new HashSet<>();
for (EffortDescription effort : str.getSetOfVessels()
.getPossibleMetiers()) {
Modified: trunk/rules/TACpoidsPop20082011.java
===================================================================
--- trunk/rules/TACpoidsPop20082011.java 2018-04-05 08:40:29 UTC (rev 55)
+++ trunk/rules/TACpoidsPop20082011.java 2018-04-05 08:47:25 UTC (rev 56)
@@ -178,8 +178,7 @@
* @param metier le metier concerne
*/
@Override
- public void preAction(SimulationContext context, TimeStep step, Metier metier)
- throws Exception {
+ public void preAction(SimulationContext context, TimeStep step, Metier metier) throws Exception {
//context.setValue("tacInTons2010", param_tacInTons2010);
@@ -197,7 +196,7 @@
//recupere toutes les strategies pratiquant le metier et pour lesquelles la proportion !=0
SiMatrix siMatrix = SiMatrix.getSiMatrix(context);
- Set<Strategy> strs = new HashSet<Strategy>();
+ Set<Strategy> strs = new HashSet<>();
for (Strategy str : siMatrix.getStrategies(step)) {
double prop = str.getStrategyMonthInfo(step.getMonth())
.getProportionMetier(metier);
@@ -213,14 +212,14 @@
// 1er cas de figure: l'effort est reporte sur un metier de la
// meme strategie, n'ayant pas l'espece comme capture principale
// et pechant avec le meme engin
- Set<Metier> possibleMetierCase1 = new HashSet<Metier>();
+ Set<Metier> possibleMetierCase1 = new HashSet<>();
// second cas de figure: on cherche un metier de substitution
// sans condition sur les engins, mais qui soit pratique
- Set<Metier> possibleMetierCase2 = new HashSet<Metier>();
+ Set<Metier> possibleMetierCase2 = new HashSet<>();
// 3 eme cas de figure: on cherche des metiers non vises,
// sans consideration sur les engins, et pour lesquels la
// proportion peut etre nulle
- Set<Metier> possibleMetierCase3 = new HashSet<Metier>();
+ Set<Metier> possibleMetierCase3 = new HashSet<>();
for (EffortDescription effort : str.getSetOfVessels()
.getPossibleMetiers()) {
Modified: trunk/rules/TACpoidsPop_PourHCR.java
===================================================================
--- trunk/rules/TACpoidsPop_PourHCR.java 2018-04-05 08:40:29 UTC (rev 55)
+++ trunk/rules/TACpoidsPop_PourHCR.java 2018-04-05 08:47:25 UTC (rev 56)
@@ -122,16 +122,16 @@
public boolean condition(SimulationContext context, TimeStep step, Metier metier)
throws Exception {
- /** Population */
+ /* Population */
//population = (Population) context.getValue("Population_TAC_HCR"); // pb avec l'utilisation des getValue
- /** TAC in tonnes */
+ /* TAC in tonnes */
tacInTons = (Double) context.getValue("TAC_" + param_population.getName() + "_HCR");
- /** First step at which this particular TAC is applied */
+ /* First step at which this particular TAC is applied */
beginStep = (TimeStep) context.getValue("BeginStep_TAC_" + param_population.getName() + "_HCR");
endStep = beginStep.nextYear(); // One TAC a year
log.info("beginStep = " + beginStep);
log.info("endStep = " + endStep);
- /** Proportion of fish that survives when discarded */
+ /* Proportion of fish that survives when discarded */
propSurvie = (Double) context.getValue("PropSurvie_TAC_" + param_population.getName() + "_HCR");
@@ -175,8 +175,7 @@
* @param metier le metier concerne
*/
@Override
- public void preAction(SimulationContext context, TimeStep step, Metier metier)
- throws Exception {
+ public void preAction(SimulationContext context, TimeStep step, Metier metier) throws Exception {
log.info("Using TACpoidsPop_PourHCR");
@@ -194,7 +193,7 @@
//recupere toutes les strategies pratiquant le metier et pour lesquelles la proportion !=0
SiMatrix siMatrix = SiMatrix.getSiMatrix(context);
- Set<Strategy> strs = new HashSet<Strategy>();
+ Set<Strategy> strs = new HashSet<>();
for (Strategy str : siMatrix.getStrategies(step)) {
double prop = str.getStrategyMonthInfo(step.getMonth())
.getProportionMetier(metier);
@@ -210,14 +209,14 @@
// 1er cas de figure: l'effort est reporte sur un metier de la
// meme strategie, n'ayant pas l'espece comme capture principale
// et pechant avec le meme engin
- Set<Metier> possibleMetierCase1 = new HashSet<Metier>();
+ Set<Metier> possibleMetierCase1 = new HashSet<>();
// second cas de figure: on cherche un metier de substitution
// sans condition sur les engins, mais qui soit pratique
- Set<Metier> possibleMetierCase2 = new HashSet<Metier>();
+ Set<Metier> possibleMetierCase2 = new HashSet<>();
// 3 eme cas de figure: on cherche des metiers non vises,
// sans consideration sur les engins, et pour lesquels la
// proportion peut etre nulle
- Set<Metier> possibleMetierCase3 = new HashSet<Metier>();
+ Set<Metier> possibleMetierCase3 = new HashSet<>();
for (EffortDescription effort : str.getSetOfVessels()
.getPossibleMetiers()) {
Modified: trunk/rules/TACpoidsTailleMin.java
===================================================================
--- trunk/rules/TACpoidsTailleMin.java 2018-04-05 08:40:29 UTC (rev 55)
+++ trunk/rules/TACpoidsTailleMin.java 2018-04-05 08:47:25 UTC (rev 56)
@@ -172,8 +172,7 @@
* @param metier le metier concerné
*/
@Override
- public void preAction(SimulationContext context, TimeStep step, Metier metier)
- throws Exception {
+ public void preAction(SimulationContext context, TimeStep step, Metier metier) throws Exception {
// la preaction ne tourne que si le TAC est atteint
if (tacAtteint) {
@@ -190,7 +189,7 @@
//recupere toutes les strategies pratiquant le metier et pour lesquelles la proportion !=0
SiMatrix siMatrix = SiMatrix.getSiMatrix(context);
- Set<Strategy> strs = new HashSet<Strategy>();
+ Set<Strategy> strs = new HashSet<>();
for (Strategy str : siMatrix.getStrategies(step)) {
double prop = str.getStrategyMonthInfo(step.getMonth())
.getProportionMetier(metier);
@@ -206,14 +205,14 @@
// 1er cas de figure: l'effort est reporte sur un metier de la
// meme strategie, n'ayant pas l'espece comme capture principale
// et pechant avec le meme engin
- Set<Metier> possibleMetierCase1 = new HashSet<Metier>();
+ Set<Metier> possibleMetierCase1 = new HashSet<>();
// second cas de figure: on cherche un metier de substitution
// sans condition sur les engins, mais qui soit pratique
- Set<Metier> possibleMetierCase2 = new HashSet<Metier>();
+ Set<Metier> possibleMetierCase2 = new HashSet<>();
// 3 eme cas de figure: on cherche des metiers non vises,
// sans consideration sur les engins, et pour lesquels la
// proportion peut etre nulle
- Set<Metier> possibleMetierCase3 = new HashSet<Metier>();
+ Set<Metier> possibleMetierCase3 = new HashSet<>();
for (EffortDescription effort : str.getSetOfVessels()
.getPossibleMetiers()) {
1
0
r55 - in trunk: . exports rules sensitivityexports
by echatellier@users.forge.codelutin.com 05 Apr '18
by echatellier@users.forge.codelutin.com 05 Apr '18
05 Apr '18
Author: echatellier
Date: 2018-04-05 10:40:29 +0200 (Thu, 05 Apr 2018)
New Revision: 55
Url: http://forge.codelutin.com/projects/isis-fish-community/repository/revision…
Log:
Remove use of deprecated ResultName.
Modified:
trunk/exports/BiomasseFeconde.java
trunk/exports/MortalitePecheGroupe.java
trunk/exports/MortalitePecheTotale.java
trunk/pom.xml
trunk/rules/GraviteVPUE1_Ponderation.java
trunk/rules/HCR_transition_MSY.java
trunk/rules/Ogive_de_Tri_Merlu.java
trunk/rules/TACpoids20012011.java
trunk/rules/TACpoids20012011OgiveTriMerlu.java
trunk/rules/TACpoids20012011TailleMin.java
trunk/rules/TACpoidsPop.java
trunk/rules/TACpoidsPop20082011.java
trunk/rules/TACpoidsPop_PourHCR.java
trunk/rules/TACpoidsTailleMin.java
trunk/sensitivityexports/SensitivityBiomassJanvierY3.java
trunk/sensitivityexports/SensitivityBiomassRelativeJanvierY6.java
trunk/sensitivityexports/SensitivitySpawningBiomassJanvierY2.java
trunk/sensitivityexports/SensitivitySpawningBiomassRelativeJanvierY5.java
trunk/sensitivityexports/SensitivityTotalFishingMortalityY1.java
trunk/sensitivityexports/SensitivityTotalFishingMortalityY2.java
Modified: trunk/exports/BiomasseFeconde.java
===================================================================
--- trunk/exports/BiomasseFeconde.java 2017-05-09 07:54:30 UTC (rev 54)
+++ trunk/exports/BiomasseFeconde.java 2018-04-05 08:40:29 UTC (rev 55)
@@ -2,7 +2,7 @@
* #%L
* IsisFish data
* %%
- * Copyright (C) 2006 - 2011 Ifremer, CodeLutin
+ * Copyright (C) 2006 - 2018 Ifremer, CodeLutin
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -28,7 +28,7 @@
import org.nuiton.math.matrix.*;
-import scripts.ResultName;
+import resultinfos.MatrixBiomass;
import fr.ifremer.isisfish.entities.*;
import fr.ifremer.isisfish.export.Export;
@@ -52,7 +52,7 @@
static private Log log = LogFactory.getLog(BiomasseFeconde.class);
protected String [] necessaryResult = {
- ResultName.MATRIX_BIOMASS
+ MatrixBiomass.NAME
};
@Override
@@ -78,7 +78,7 @@
@Override
public void export(SimulationStorage simulation, Writer out) throws Exception {
for (Population pop : simulation.getParameter().getPopulations()) {
- MatrixND mat = simulation.getResultStorage().getMatrix(pop, ResultName.MATRIX_BIOMASS);
+ MatrixND mat = simulation.getResultStorage().getMatrix(pop, MatrixBiomass.NAME);
for (MatrixIterator i=mat.iterator(); i.hasNext();) {
i.next();
Object [] sems = i.getSemanticsCoordinates();
Modified: trunk/exports/MortalitePecheGroupe.java
===================================================================
--- trunk/exports/MortalitePecheGroupe.java 2017-05-09 07:54:30 UTC (rev 54)
+++ trunk/exports/MortalitePecheGroupe.java 2018-04-05 08:40:29 UTC (rev 55)
@@ -2,7 +2,7 @@
* #%L
* IsisFish data
* %%
- * Copyright (C) 2006 - 2013 Ifremer, CodeLutin
+ * Copyright (C) 2006 - 2018 Ifremer, CodeLutin
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -28,7 +28,9 @@
import org.nuiton.math.matrix.*;
-import scripts.ResultName;
+import resultinfos.MatrixAbundance;
+import resultinfos.MatrixCatchPerStrategyMetPerZonePop;
+import resultinfos.MatrixFishingMortalityPerGroup;
import fr.ifremer.isisfish.entities.*;
import fr.ifremer.isisfish.export.Export;
@@ -50,10 +52,11 @@
/** to use log facility, just put in your code: log.info("..."); */
static private Log log = LogFactory.getLog(MortalitePecheGroupe.class);
- protected String[] necessaryResult = { ResultName.MATRIX_FISHING_MORTALITY_PER_GROUP,
- ResultName.MATRIX_CATCH_PER_STRATEGY_MET_PER_ZONE_POP,
- ResultName.MATRIX_ABUNDANCE,
- };
+ protected String[] necessaryResult = {
+ MatrixFishingMortalityPerGroup.NAME,
+ MatrixCatchPerStrategyMetPerZonePop.NAME,
+ MatrixAbundance.NAME
+ };
@Override
public String[] getNecessaryResult() {
@@ -85,7 +88,7 @@
for (TimeStep step = new TimeStep(0); !step.after(lastStep); step = step.next()) {
MatrixND mat = simulation.getResultStorage().getMatrix(step,
- pop, ResultName.MATRIX_FISHING_MORTALITY_PER_GROUP); // group
+ pop, MatrixFishingMortalityPerGroup.NAME); // group
if (mat != null) { // can be null if simulation is stopped before last year simulation
for (MatrixIterator i = mat.iterator(); i.hasNext();) {
Modified: trunk/exports/MortalitePecheTotale.java
===================================================================
--- trunk/exports/MortalitePecheTotale.java 2017-05-09 07:54:30 UTC (rev 54)
+++ trunk/exports/MortalitePecheTotale.java 2018-04-05 08:40:29 UTC (rev 55)
@@ -2,7 +2,7 @@
* #%L
* IsisFish data
* %%
- * Copyright (C) 2006 - 2011 Ifremer, CodeLutin
+ * Copyright (C) 2006 - 2018 Ifremer, CodeLutin
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -28,7 +28,10 @@
import org.nuiton.math.matrix.*;
-import scripts.ResultName;
+import resultinfos.MatrixAbundance;
+import resultinfos.MatrixCatchPerStrategyMetPerZonePop;
+import resultinfos.MatrixFishingMortalityPerGroup;
+import resultinfos.MatrixTotalFishingMortality;
import fr.ifremer.isisfish.entities.*;
import fr.ifremer.isisfish.export.Export;
@@ -50,10 +53,12 @@
/** to use log facility, just put in your code: log.info("..."); */
static private Log log = LogFactory.getLog(MortalitePecheTotale.class);
- protected String[] necessaryResult = { ResultName.MATRIX_TOTAL_FISHING_MORTALITY,
- ResultName.MATRIX_FISHING_MORTALITY_PER_GROUP,
- ResultName.MATRIX_CATCH_PER_STRATEGY_MET_PER_ZONE_POP,
- ResultName.MATRIX_ABUNDANCE };
+ protected String[] necessaryResult = {
+ MatrixTotalFishingMortality.NAME,
+ MatrixFishingMortalityPerGroup.NAME,
+ MatrixCatchPerStrategyMetPerZonePop.NAME,
+ MatrixAbundance.NAME
+ };
@Override
public String[] getNecessaryResult() {
@@ -81,24 +86,22 @@
TimeStep lastStep = simulation.getResultStorage().getLastStep();
for (Population pop : simulation.getParameter().getPopulations()) {
- for (TimeStep step = new TimeStep(0); !step.after(lastStep); step = step
- .next()) {
+ for (TimeStep step = new TimeStep(0); !step.after(lastStep); step = step.next()) {
MatrixND mat = simulation.getResultStorage().getMatrix(step,
- pop, ResultName.MATRIX_TOTAL_FISHING_MORTALITY);
+ pop, MatrixTotalFishingMortality.NAME);
if (mat != null) { // can be null if simulation is stopped before last year simulation
for (MatrixIterator i = mat.iterator(); i.hasNext();) {
i.next();
- Object[] sems = i.getSemanticsCoordinates();
double val = i.getValue();
out.write(pop.getName() + ";" + step.getStep() + ";" + val + "\n");
- }
- }
- }
- }
- }
- }
+ }
+ }
+ }
+ }
+ }
+}
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2017-05-09 07:54:30 UTC (rev 54)
+++ trunk/pom.xml 2018-04-05 08:40:29 UTC (rev 55)
@@ -24,6 +24,9 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputDirectory>UTF-8</project.reporting.outputDirectory>
<maven.test.skip>true</maven.test.skip>
+ <maven.compiler.showDeprecation>true</maven.compiler.showDeprecation>
+ <maven.compiler.source>1.8</maven.compiler.source>
+ <maven.compiler.target>1.8</maven.compiler.target>
</properties>
<organization>
@@ -35,21 +38,9 @@
<sourceDirectory>${basedir}</sourceDirectory>
<plugins>
<plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.5.1</version>
- <configuration>
- <source>1.7</source>
- <target>1.7</target>
- <excludes>
- <exclude>**/simulations/**</exclude>
- <exclude>**/formules/**</exclude>
- </excludes>
- </configuration>
- </plugin>
- <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
- <version>1.4.0</version>
+ <version>1.6.0</version>
<executions>
<execution>
<goals>
Modified: trunk/rules/GraviteVPUE1_Ponderation.java
===================================================================
--- trunk/rules/GraviteVPUE1_Ponderation.java 2017-05-09 07:54:30 UTC (rev 54)
+++ trunk/rules/GraviteVPUE1_Ponderation.java 2018-04-05 08:40:29 UTC (rev 55)
@@ -2,7 +2,7 @@
* #%L
* IsisFish data
* %%
- * Copyright (C) 2006 - 2011 Ifremer, CodeLutin
+ * Copyright (C) 2006 - 2018 Ifremer, CodeLutin
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -24,7 +24,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import scripts.ResultName;
+import resultinfos.MatrixEffortNominalPerStrategyMet;
+import resultinfos.MatrixGrossValueOfLandingsPerStrategyMet;
import scripts.SiMatrix;
import java.util.Arrays;
@@ -73,12 +74,9 @@
public String[] necessaryResult = {
// put here all necessary result for this rule
- // example:
- // ResultName.MATRIX_BIOMASS,
- // ResultName.MATRIX_NET_VALUE_OF_LANDINGS_PER_STRATEGY_MET,
- ResultName.MATRIX_GROSS_VALUE_OF_LANDINGS_PER_STRATEGY_MET,
- //ResultName.MATRIX_EFFORT_PER_STRATEGY_MET,
- ResultName.MATRIX_EFFORT_NOMINAL_PER_STRATEGY_MET, // garder la ,
+ // example:
+ MatrixGrossValueOfLandingsPerStrategyMet.NAME,
+ MatrixEffortNominalPerStrategyMet.NAME
};
@@ -204,21 +202,17 @@
////////Initialisation des matrices qui resultent de la simulation////////////////////////////////////////////////////////////
- //Calcul de l effort nominal par strategy met
- MatrixND EffortNominalPerStrMet = null;
- EffortNominalPerStrMet = resultmanager.getMatrix(step.previousYear(),
- ResultName.MATRIX_EFFORT_NOMINAL_PER_STRATEGY_MET);
+ //Calcul de l effort nominal par strategy met
+ MatrixND EffortNominalPerStrMet = resultmanager.getMatrix(step.previousYear(), MatrixEffortNominalPerStrategyMet.NAME);
//System.out.println("EffortNominalPerStrMet calculee "
// + EffortNominalPerStrMet);
//on commence par creer une matrice de valeurs (somme sur ttes les especes capturees) par strategie met
- MatrixND GrossValuePerStrMet = null;
- GrossValuePerStrMet = resultmanager.getMatrix(step.previousYear(),
- ResultName.MATRIX_GROSS_VALUE_OF_LANDINGS_PER_STRATEGY_MET);
+ MatrixND GrossValuePerStrMet = resultmanager.getMatrix(step.previousYear(), MatrixGrossValueOfLandingsPerStrategyMet.NAME);
//System.out.println("GrossValuePerStrMet calculee " + GrossValuePerStrMet);
- //ajouter pour tous les metiers les valeurs liees aux autres espèces calculees par modele lineaire
+ //ajouter pour tous les metiers les valeurs liees aux autres especes calculees par modele lineaire
//////////////////////////////////////////////////////////////////////////////////////////////////////////
valuePerUnitOfEffort.map(nanFunction); //reinitialisation avant calcul pour date
Modified: trunk/rules/HCR_transition_MSY.java
===================================================================
--- trunk/rules/HCR_transition_MSY.java 2017-05-09 07:54:30 UTC (rev 54)
+++ trunk/rules/HCR_transition_MSY.java 2018-04-05 08:40:29 UTC (rev 55)
@@ -2,7 +2,7 @@
* #%L
* IsisFish data
* %%
- * Copyright (C) 2006 - 2011 Ifremer, CodeLutin
+ * Copyright (C) 2006 - 2018 Ifremer, CodeLutin
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -26,9 +26,8 @@
import org.nuiton.math.matrix.MatrixIterator;
import org.nuiton.math.matrix.MatrixND;
-import scripts.ResultName;
-import scripts.RuleUtil;
-import scripts.SiMatrix;
+import resultinfos.MatrixBiomass;
+import resultinfos.MatrixTotalFishingMortality;
import fr.ifremer.isisfish.datastore.ResultStorage;
import fr.ifremer.isisfish.entities.Metier;
import fr.ifremer.isisfish.entities.Population;
@@ -87,13 +86,10 @@
boolean affectation = false;
protected String[] necessaryResult = {
- // put here all necessary result for this rule
- // example:
- // ResultName.MATRIX_BIOMASS,
- // ResultName.MATRIX_NET_VALUE_OF_LANDINGS_PER_STRATEGY_MET,
- ResultName.MATRIX_BIOMASS,
- ResultName.MATRIX_TOTAL_FISHING_MORTALITY,
-
+ // put here all necessary result for this rule
+ // example:
+ MatrixBiomass.NAME,
+ MatrixTotalFishingMortality.NAME
};
/**
@@ -166,12 +162,12 @@
ResultStorage matResult = context.getSimulationStorage().getResultStorage();
// Import de la mortalite par peche de 2010
- MatrixND MatF2010 = matResult.getMatrix(param_beginStep.previous(), param_populationHCR, ResultName.MATRIX_TOTAL_FISHING_MORTALITY); // Ne marche que si param_beginStep est Janvier 2011
+ MatrixND MatF2010 = matResult.getMatrix(param_beginStep.previous(), param_populationHCR, MatrixTotalFishingMortality.NAME); // Ne marche que si param_beginStep est Janvier 2011
double F2010 = MatF2010.sumAll();
log.info("F2010 = " + F2010);
// Import de la biomasse de l'annee en cours
- MatrixND MatBiom = matResult.getMatrix(step.previous(), param_populationHCR, ResultName.MATRIX_BIOMASS); // step,
+ MatrixND MatBiom = matResult.getMatrix(step.previous(), param_populationHCR, MatrixBiomass.NAME); // step,
MatBiom = MatBiom.reduce();
log.info("MatBiom = " + MatBiom);
@@ -303,8 +299,7 @@
//
// List<Population> populations = Collections.singletonList(pop);
//
- // MatrixND TacPopMatrix = MatrixFactory.getInstance().create(
- // ResultName.MATRIX_TAC_PER_POP, new List[] { populations },
+ // MatrixND TacPopMatrix = MatrixFactory.getInstance().create(MatrixTacPerPop.NAME, new List[] { populations },
// new String[] { n_("Populations") });
//
// if (step.getMonth() == Month.JANUARY) { // Pas besoin car postAction ne s'applique que si la condition est vraie
Modified: trunk/rules/Ogive_de_Tri_Merlu.java
===================================================================
--- trunk/rules/Ogive_de_Tri_Merlu.java 2017-05-09 07:54:30 UTC (rev 54)
+++ trunk/rules/Ogive_de_Tri_Merlu.java 2018-04-05 08:40:29 UTC (rev 55)
@@ -1,33 +1,40 @@
+/*
+ * #%L
+ * IsisFish data
+ * %%
+ * Copyright (C) 2017 - 2018 Ifremer, CodeLutin
+ * %%
+ * This program 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.
+ *
+ * This program 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, see
+ * <http://www.gnu.org/licenses/gpl-2.0.html>.
+ * #L%
+ */
package rules;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Iterator;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.math.matrix.MatrixIterator;
-import org.nuiton.math.matrix.MatrixND;
-import org.nuiton.math.matrix.*;
-import scripts.ResultName;
-import scripts.SiMatrix;
-
-import fr.ifremer.isisfish.simulator.MetierMonitor;
-import fr.ifremer.isisfish.simulator.SimulationContext;
-import fr.ifremer.isisfish.types.TimeStep;
-import fr.ifremer.isisfish.types.Month;
-import fr.ifremer.isisfish.entities.*;
-import fr.ifremer.isisfish.rule.AbstractRule;
-import scripts.ResultName;
-import scripts.SiMatrix;
import fr.ifremer.isisfish.entities.Metier;
import fr.ifremer.isisfish.entities.Population;
import fr.ifremer.isisfish.entities.PopulationGroup;
import fr.ifremer.isisfish.entities.Species;
-import fr.ifremer.isisfish.entities.TargetSpecies;
+import fr.ifremer.isisfish.rule.AbstractRule;
import fr.ifremer.isisfish.simulator.PopulationMonitor;
import fr.ifremer.isisfish.simulator.SimulationContext;
-import fr.ifremer.isisfish.simulator.ResultManager;
+import fr.ifremer.isisfish.types.TimeStep;
import fr.ifremer.isisfish.util.Doc;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.math.matrix.MatrixIterator;
+import org.nuiton.math.matrix.MatrixND;
+import resultinfos.MatrixDiscardsPerStrMetPerZonePop;
/**
* Cette methode remplace aussi TailleMin pour le Merlu dans PecherieGdG
@@ -45,7 +52,7 @@
/** to use log facility, just put in your code: log.info("..."); */
static private Log log = LogFactory.getLog(Ogive_de_Tri_Merlu.class);
- @Doc(value = "Begin step")
+ @Doc(value = "Begin step")
public TimeStep param_beginStep = new TimeStep(0);
@Doc(value = "End step")
@@ -69,10 +76,10 @@
boolean affectation = true;
public String[] necessaryResult = {
- // put here all necessary result for this rule
- // example:
- // ResultName.MATRIX_BIOMASS,
- // ResultName.MATRIX_NET_VALUE_OF_LANDINGS_PER_STRATEGY_MET,
+ // put here all necessary result for this rule
+ // example:
+ // MatrixBiomass.NAME,
+ // MatrixNetValueOfLandingsPerStrategyMet.NAME
};
@Override
@@ -165,7 +172,12 @@
Object[] coordonnees = i.getSemanticsCoordinates();
PopulationGroup group = (PopulationGroup) coordonnees[2];
Metier met = (Metier) coordonnees[1];
- if (met.getName().equals("metier lang simp Sud")||met.getName().equals("metier lang simp Nord")||met.getName().equals("metier lang simple")||met.getName().equals("metier lang jum Nord")||met.getName().equals("metier lang jum Sud")||met.getName().equals("metier lang jum")) {
+ if (met.getName().equals("metier lang simp Sud") ||
+ met.getName().equals("metier lang simp Nord") ||
+ met.getName().equals("metier lang simple") ||
+ met.getName().equals("metier lang jum Nord") ||
+ met.getName().equals("metier lang jum Sud") ||
+ met.getName().equals("metier lang jum")) {
double propTrie = 1 / (1 + Math.exp(-(group.getLength() - param_Retention_L50)/ param_Retention_slope));
double propRejet = 1 - propTrie;
@@ -193,7 +205,7 @@
}
}
}
- discard.setName(ResultName.MATRIX_DISCARDS_PER_STR_MET_PER_ZONE_POP);
+ discard.setName(MatrixDiscardsPerStrMetPerZonePop.NAME);
popMon.addDiscard(step, pop, discard);
}
affectation = true; // pour ne pas refaire l'affectation au prochain metier
Modified: trunk/rules/TACpoids20012011.java
===================================================================
--- trunk/rules/TACpoids20012011.java 2017-05-09 07:54:30 UTC (rev 54)
+++ trunk/rules/TACpoids20012011.java 2018-04-05 08:40:29 UTC (rev 55)
@@ -2,7 +2,7 @@
* #%L
* IsisFish data
* %%
- * Copyright (C) 2006 - 2011 Ifremer, CodeLutin
+ * Copyright (C) 2006 - 2018 Ifremer, CodeLutin
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -21,18 +21,6 @@
*/
package rules;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.math.matrix.MatrixIterator;
-import org.nuiton.math.matrix.MatrixND;
-
-import scripts.ResultName;
-import scripts.RuleUtil;
-import scripts.SiMatrix;
-import fr.ifremer.isisfish.datastore.ResultStorage;
import fr.ifremer.isisfish.entities.EffortDescription;
import fr.ifremer.isisfish.entities.Metier;
import fr.ifremer.isisfish.entities.Population;
@@ -45,9 +33,19 @@
import fr.ifremer.isisfish.simulator.PopulationMonitor;
import fr.ifremer.isisfish.simulator.SimulationContext;
import fr.ifremer.isisfish.types.TimeStep;
-import fr.ifremer.isisfish.types.Month;
import fr.ifremer.isisfish.util.Doc;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.math.matrix.MatrixIterator;
+import org.nuiton.math.matrix.MatrixND;
+import resultinfos.MatrixDiscardsPerStrMetPerZonePop;
+import resultinfos.MatrixNoActivity;
+import scripts.RuleUtil;
+import scripts.SiMatrix;
+import java.util.HashSet;
+import java.util.Set;
+
/**
* TAC peut-etre utilise pour les differents TAC, en proportion des effectifs
* et/ou avec survie ou non.
@@ -106,10 +104,10 @@
protected String[] necessaryResult = {
- // put here all necessary result for this rule
- // example:
- // ResultName.MATRIX_BIOMASS,
- // ResultName.MATRIX_NET_VALUE_OF_LANDINGS_PER_STRATEGY_MET,
+ // put here all necessary result for this rule
+ // example:
+ // MatrixBiomass.NAME,
+ // MatrixNetValueOfLandingsPerStrategyMet.NAME
};
/**
@@ -309,7 +307,7 @@
// sinon on met tout dans le metier nonActivite
MetierMonitor metierMon = context.getMetierMonitor();
MatrixND mat = metierMon.getOrCreateNoActivity(step,
- ResultName.MATRIX_NO_ACTIVITY, siMatrix
+ MatrixNoActivity.NAME, siMatrix
.getStrategies(step), siMatrix
.getMetiers(step));
mat.setValue(str, metier, smi.getProportionMetier(metier));
@@ -362,7 +360,7 @@
log.info("catch = " + popMon.getCatch(pop));
MatrixND discardRegle = popMon.getCatch(pop).copy(); //nouvelle instance pour le calcul dans la regle
// ca ne doit pas pouvoir marcher car MATRIX_DISCARDS_PER_STR_MET est de dimension pop groupe str met - et discard n'a plus la dimension pop
- discardRegle.setName(ResultName.MATRIX_DISCARDS_PER_STR_MET_PER_ZONE_POP);
+ discardRegle.setName(MatrixDiscardsPerStrMetPerZonePop.NAME);
popMon.addDiscard(step, pop, discardRegle);
log.info("[TAC] add discard for " + pop + ": "
+ discardRegle);
Modified: trunk/rules/TACpoids20012011OgiveTriMerlu.java
===================================================================
--- trunk/rules/TACpoids20012011OgiveTriMerlu.java 2017-05-09 07:54:30 UTC (rev 54)
+++ trunk/rules/TACpoids20012011OgiveTriMerlu.java 2018-04-05 08:40:29 UTC (rev 55)
@@ -2,7 +2,7 @@
* #%L
* IsisFish data
* %%
- * Copyright (C) 2006 - 2016 Ifremer, CodeLutin
+ * Copyright (C) 2006 - 2018 Ifremer, CodeLutin
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -29,7 +29,8 @@
import org.nuiton.math.matrix.MatrixIterator;
import org.nuiton.math.matrix.MatrixND;
-import scripts.ResultName;
+import resultinfos.MatrixDiscardsPerStrMetPerZonePop;
+import resultinfos.MatrixNoActivity;
import scripts.RuleUtil;
import scripts.SiMatrix;
import fr.ifremer.isisfish.entities.*;
@@ -105,10 +106,10 @@
protected String[] necessaryResult = {
- // put here all necessary result for this rule
- // example:
- // ResultName.MATRIX_BIOMASS,
- // ResultName.MATRIX_NET_VALUE_OF_LANDINGS_PER_STRATEGY_MET,
+ // put here all necessary result for this rule
+ // example:
+ // MatrixBiomass.NAME,
+ // MatrixNetValueOfLandingsPerStrategyMet.NAME
};
/**
@@ -305,7 +306,7 @@
double newProportion;
if (somme == 0) {
// cas ou aucun autre metier n'est pratique
- // on répartit quand meme l'effort equitablement
+ // on repartit quand meme l'effort equitablement
// sur tous les autres metier
newProportion = smi.getProportionMetier(metier) / possibleMetier.size();
} else {
@@ -325,7 +326,7 @@
// sinon on met tout dans le metier nonActivite
MetierMonitor metierMon = context.getMetierMonitor();
MatrixND mat = metierMon.getOrCreateNoActivity(step,
- ResultName.MATRIX_NO_ACTIVITY, siMatrix
+ MatrixNoActivity.NAME, siMatrix
.getStrategies(step), siMatrix
.getMetiers(step));
mat.setValue(str, metier, smi.getProportionMetier(metier));
@@ -381,7 +382,7 @@
log.info("catch = " + popMon.getCatch(pop));
MatrixND discardRegle = popMon.getCatch(pop).copy(); //nouvelle instance pour le calcul dans la regle
// ca ne doit pas pouvoir marcher car MATRIX_DISCARDS_PER_STR_MET est de dimension pop groupe str met - et discard n'a plus la dimension pop
- discardRegle.setName(ResultName.MATRIX_DISCARDS_PER_STR_MET_PER_ZONE_POP);
+ discardRegle.setName(MatrixDiscardsPerStrMetPerZonePop.NAME);
popMon.addDiscard(step, pop, discardRegle);
log.info("[TAC] add discard for " + pop + ": "
+ discardRegle);
@@ -439,7 +440,7 @@
}
}
- discard.setName(ResultName.MATRIX_DISCARDS_PER_STR_MET_PER_ZONE_POP);
+ discard.setName(MatrixDiscardsPerStrMetPerZonePop.NAME);
popMon.addDiscard(step, pop, discard);
}
Modified: trunk/rules/TACpoids20012011TailleMin.java
===================================================================
--- trunk/rules/TACpoids20012011TailleMin.java 2017-05-09 07:54:30 UTC (rev 54)
+++ trunk/rules/TACpoids20012011TailleMin.java 2018-04-05 08:40:29 UTC (rev 55)
@@ -2,7 +2,7 @@
* #%L
* IsisFish data
* %%
- * Copyright (C) 2006 - 2016 Ifremer, CodeLutin
+ * Copyright (C) 2006 - 2018 Ifremer, CodeLutin
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -29,7 +29,8 @@
import org.nuiton.math.matrix.MatrixIterator;
import org.nuiton.math.matrix.MatrixND;
-import scripts.ResultName;
+import resultinfos.MatrixDiscardsPerStrMetPerZonePop;
+import resultinfos.MatrixNoActivity;
import scripts.RuleUtil;
import scripts.SiMatrix;
import fr.ifremer.isisfish.entities.*;
@@ -95,19 +96,15 @@
@Doc(value = "param_TailleMin")
public double param_TailleMin = 85.0;
-
-
boolean affectation = true; // pour ne passer qu'une seule fois dans afterSimulation (pour le premier metier)
boolean tacAtteint = false; // pour ne passer dans beforeSimulation que si le tac est atteint
-
-
protected String[] necessaryResult = {
- // put here all necessary result for this rule
- // example:
- // ResultName.MATRIX_BIOMASS,
- // ResultName.MATRIX_NET_VALUE_OF_LANDINGS_PER_STRATEGY_MET,
+ // put here all necessary result for this rule
+ // example:
+ // MatrixBiomass.NAME,
+ // MatrixNetValueOfLandingsPerStrategyMet.NAME
};
/**
@@ -322,7 +319,7 @@
// sinon on met tout dans le metier nonActivite
MetierMonitor metierMon = context.getMetierMonitor();
MatrixND mat = metierMon.getOrCreateNoActivity(step,
- ResultName.MATRIX_NO_ACTIVITY, siMatrix
+ MatrixNoActivity.NAME, siMatrix
.getStrategies(step), siMatrix
.getMetiers(step));
mat.setValue(str, metier, smi.getProportionMetier(metier));
@@ -378,7 +375,7 @@
log.info("catch = " + popMon.getCatch(pop));
MatrixND discardRegle = popMon.getCatch(pop).copy(); //nouvelle instance pour le calcul dans la regle
// ca ne doit pas pouvoir marcher car MATRIX_DISCARDS_PER_STR_MET est de dimension pop groupe str met - et discard n'a plus la dimension pop
- discardRegle.setName(ResultName.MATRIX_DISCARDS_PER_STR_MET_PER_ZONE_POP);
+ discardRegle.setName(MatrixDiscardsPerStrMetPerZonePop.NAME);
popMon.addDiscard(step, pop, discardRegle);
log.info("[TAC] add discard for " + pop + ": "
+ discardRegle);
@@ -421,8 +418,7 @@
param_propSurvie);
}
}
- discard.setName(
- ResultName.MATRIX_DISCARDS_PER_STR_MET_PER_ZONE_POP);
+ discard.setName(MatrixDiscardsPerStrMetPerZonePop.NAME);
popMon.addDiscard(step, pop, discard);
//}
}
Modified: trunk/rules/TACpoidsPop.java
===================================================================
--- trunk/rules/TACpoidsPop.java 2017-05-09 07:54:30 UTC (rev 54)
+++ trunk/rules/TACpoidsPop.java 2018-04-05 08:40:29 UTC (rev 55)
@@ -2,7 +2,7 @@
* #%L
* IsisFish data
* %%
- * Copyright (C) 2006 - 2016 Ifremer, CodeLutin
+ * Copyright (C) 2006 - 2018 Ifremer, CodeLutin
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -29,7 +29,8 @@
import org.nuiton.math.matrix.MatrixIterator;
import org.nuiton.math.matrix.MatrixND;
-import scripts.ResultName;
+import resultinfos.MatrixDiscardsPerStrMetPerZonePop;
+import resultinfos.MatrixNoActivity;
import scripts.RuleUtil;
import scripts.SiMatrix;
import fr.ifremer.isisfish.datastore.ResultStorage;
@@ -59,7 +60,7 @@
* Last update: $Date: 010812 $
* by : $Author: Loic $
*/
-public class TACpoidsPop extends AbstractRule {
+public class TACpoidsPop extends AbstractRule {
/** to use log facility, just put in your code: log.info("..."); */
static private Log log = LogFactory.getLog( TACpoidsPop.class);
@@ -84,10 +85,10 @@
boolean affectation = false;
protected String[] necessaryResult = {
- // put here all necessary result for this rule
- // example:
- // ResultName.MATRIX_BIOMASS,
- // ResultName.MATRIX_NET_VALUE_OF_LANDINGS_PER_STRATEGY_MET,
+ // put here all necessary result for this rule
+ // example:
+ // MatrixBiomass.NAME,
+ // MatrixNetValueOfLandingsPerStrategyMet.NAME
};
/**
@@ -278,7 +279,7 @@
// sinon on met tout dans le metier nonActivite
MetierMonitor metierMon = context.getMetierMonitor();
MatrixND mat = metierMon.getOrCreateNoActivity(step,
- ResultName.MATRIX_NO_ACTIVITY, siMatrix
+ MatrixNoActivity.NAME, siMatrix
.getStrategies(step), siMatrix
.getMetiers(step));
mat.setValue(str, metier, smi.getProportionMetier(metier));
@@ -334,7 +335,7 @@
log.info("catch = " + popMon.getCatch(param_population));
discard = popMon.getCatch(param_population).copy();
// ca ne doit pas pouvoir marcher car MATRIX_DISCARDS_PER_STR_MET est de dimension pop groupe str met - et discard n'a plus la dimension pop
- discard.setName(ResultName.MATRIX_DISCARDS_PER_STR_MET_PER_ZONE_POP);
+ discard.setName(MatrixDiscardsPerStrMetPerZonePop.NAME);
popMon.addDiscard(step, param_population, discard);
log.info("[TAC] add discard for " + param_population + ": "
+ discard);
Modified: trunk/rules/TACpoidsPop20082011.java
===================================================================
--- trunk/rules/TACpoidsPop20082011.java 2017-05-09 07:54:30 UTC (rev 54)
+++ trunk/rules/TACpoidsPop20082011.java 2018-04-05 08:40:29 UTC (rev 55)
@@ -2,7 +2,7 @@
* #%L
* IsisFish data
* %%
- * Copyright (C) 2006 - 2011 Ifremer, CodeLutin
+ * Copyright (C) 2006 - 2018 Ifremer, CodeLutin
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -29,7 +29,8 @@
import org.nuiton.math.matrix.MatrixIterator;
import org.nuiton.math.matrix.MatrixND;
-import scripts.ResultName;
+import resultinfos.MatrixDiscardsPerStrMetPerZonePop;
+import resultinfos.MatrixNoActivity;
import scripts.RuleUtil;
import scripts.SiMatrix;
import fr.ifremer.isisfish.entities.EffortDescription;
@@ -86,10 +87,10 @@
boolean affectation = true;
protected String[] necessaryResult = {
- // put here all necessary result for this rule
- // example:
- // ResultName.MATRIX_BIOMASS,
- // ResultName.MATRIX_NET_VALUE_OF_LANDINGS_PER_STRATEGY_MET,
+ // put here all necessary result for this rule
+ // example:
+ // MatrixBiomass.NAME,
+ // MatrixNetValueOfLandingsPerStrategyMet.NAME
};
/**
@@ -280,7 +281,7 @@
// sinon on met tout dans le metier nonActivite
MetierMonitor metierMon = context.getMetierMonitor();
MatrixND mat = metierMon.getOrCreateNoActivity(step,
- ResultName.MATRIX_NO_ACTIVITY, siMatrix
+ MatrixNoActivity.NAME, siMatrix
.getStrategies(step), siMatrix
.getMetiers(step));
mat.setValue(str, metier, smi.getProportionMetier(metier));
@@ -333,7 +334,7 @@
log.info("catch = " + popMon.getCatch(param_population));
MatrixND discardRegle = popMon.getCatch(param_population).copy(); //nouvelle instance pour le calcul dans la regle
// ca ne doit pas pouvoir marcher car MATRIX_DISCARDS_PER_STR_MET est de dimension pop groupe str met - et discard n'a plus la dimension pop
- discardRegle.setName(ResultName.MATRIX_DISCARDS_PER_STR_MET_PER_ZONE_POP);
+ discardRegle.setName(MatrixDiscardsPerStrMetPerZonePop.NAME);
popMon.addDiscard(step, param_population, discardRegle);
log.info("[TAC] add discard for " + param_population + ": "
+ discardRegle);
Modified: trunk/rules/TACpoidsPop_PourHCR.java
===================================================================
--- trunk/rules/TACpoidsPop_PourHCR.java 2017-05-09 07:54:30 UTC (rev 54)
+++ trunk/rules/TACpoidsPop_PourHCR.java 2018-04-05 08:40:29 UTC (rev 55)
@@ -2,7 +2,7 @@
* #%L
* IsisFish data
* %%
- * Copyright (C) 2006 - 2011 Ifremer, CodeLutin
+ * Copyright (C) 2006 - 2018 Ifremer, CodeLutin
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -29,7 +29,8 @@
import org.nuiton.math.matrix.MatrixIterator;
import org.nuiton.math.matrix.MatrixND;
-import scripts.ResultName;
+import resultinfos.MatrixDiscardsPerStrMetPerZonePop;
+import resultinfos.MatrixNoActivity;
import scripts.RuleUtil;
import scripts.SiMatrix;
import fr.ifremer.isisfish.datastore.ResultStorage;
@@ -75,10 +76,10 @@
boolean affectation = false;
protected String[] necessaryResult = {
- // put here all necessary result for this rule
- // example:
- // ResultName.MATRIX_BIOMASS,
- // ResultName.MATRIX_NET_VALUE_OF_LANDINGS_PER_STRATEGY_MET,
+ // put here all necessary result for this rule
+ // example:
+ // MatrixBiomass.NAME,
+ // MatrixNetValueOfLandingsPerStrategyMet.NAME
};
/**
@@ -277,7 +278,7 @@
// sinon on met tout dans le metier nonActivite
MetierMonitor metierMon = context.getMetierMonitor();
MatrixND mat = metierMon.getOrCreateNoActivity(step,
- ResultName.MATRIX_NO_ACTIVITY, siMatrix
+ MatrixNoActivity.NAME, siMatrix
.getStrategies(step), siMatrix
.getMetiers(step));
mat.setValue(str, metier, smi.getProportionMetier(metier));
@@ -333,7 +334,7 @@
log.info("catch = " + popMon.getCatch(param_population));
discard = popMon.getCatch(param_population).copy();
// ca ne doit pas pouvoir marcher car MATRIX_DISCARDS_PER_STR_MET est de dimension pop groupe str met - et discard n'a plus la dimension pop
- discard.setName(ResultName.MATRIX_DISCARDS_PER_STR_MET_PER_ZONE_POP);
+ discard.setName(MatrixDiscardsPerStrMetPerZonePop.NAME);
popMon.addDiscard(step, param_population, discard);
log.info("[TAC] add discard for " + param_population + ": "
+ discard);
Modified: trunk/rules/TACpoidsTailleMin.java
===================================================================
--- trunk/rules/TACpoidsTailleMin.java 2017-05-09 07:54:30 UTC (rev 54)
+++ trunk/rules/TACpoidsTailleMin.java 2018-04-05 08:40:29 UTC (rev 55)
@@ -2,7 +2,7 @@
* #%L
* IsisFish data
* %%
- * Copyright (C) 2006 - 2011 Ifremer, CodeLutin
+ * Copyright (C) 2006 - 2018 Ifremer, CodeLutin
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -29,7 +29,8 @@
import org.nuiton.math.matrix.MatrixIterator;
import org.nuiton.math.matrix.MatrixND;
-import scripts.ResultName;
+import resultinfos.MatrixDiscardsPerStrMetPerZonePop;
+import resultinfos.MatrixNoActivity;
import scripts.RuleUtil;
import scripts.SiMatrix;
import fr.ifremer.isisfish.entities.*;
@@ -86,10 +87,10 @@
boolean tacAtteint = false;
protected String[] necessaryResult = {
- // put here all necessary result for this rule
- // example:
- // ResultName.MATRIX_BIOMASS,
- // ResultName.MATRIX_NET_VALUE_OF_LANDINGS_PER_STRATEGY_MET,
+ // put here all necessary result for this rule
+ // example:
+ // MatrixBiomass.NAME,
+ // MatrixNetValueOfLandingsPerStrategyMet.NAME
};
/**
@@ -273,7 +274,7 @@
// sinon on met tout dans le metier nonActivite
MetierMonitor metierMon = context.getMetierMonitor();
MatrixND mat = metierMon.getOrCreateNoActivity(step,
- ResultName.MATRIX_NO_ACTIVITY, siMatrix
+ MatrixNoActivity.NAME, siMatrix
.getStrategies(step), siMatrix
.getMetiers(step));
mat.setValue(str, metier, smi.getProportionMetier(metier));
@@ -316,7 +317,7 @@
MatrixND discard = popMon.getCatch(pop).copy(); //on cree une matrice de rejet identique aux captures
log.info("catch = " + popMon.getCatch(pop));
// ca ne doit pas pouvoir marcher car MATRIX_DISCARDS_PER_STR_MET est de dimension pop groupe str met - et discard n'a plus la dimension pop
- discard.setName(ResultName.MATRIX_DISCARDS_PER_STR_MET_PER_ZONE_POP);
+ discard.setName(MatrixDiscardsPerStrMetPerZonePop.NAME);
popMon.addDiscard(step, pop, discard);
log.info("[TAC] add discard for " + pop + ": "+ discard);
if (param_propSurvie > 0) {
@@ -359,8 +360,7 @@
param_propSurvie);
}
}
- discard.setName(
- ResultName.MATRIX_DISCARDS_PER_STR_MET_PER_ZONE_POP);
+ discard.setName(MatrixDiscardsPerStrMetPerZonePop.NAME);
popMon.addDiscard(step, pop, discard);
}
}
Modified: trunk/sensitivityexports/SensitivityBiomassJanvierY3.java
===================================================================
--- trunk/sensitivityexports/SensitivityBiomassJanvierY3.java 2017-05-09 07:54:30 UTC (rev 54)
+++ trunk/sensitivityexports/SensitivityBiomassJanvierY3.java 2018-04-05 08:40:29 UTC (rev 55)
@@ -2,7 +2,7 @@
* #%L
* IsisFish data
* %%
- * Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Jean Couteau
+ * Copyright (C) 2009 - 2018 Ifremer, Code Lutin, Jean Couteau
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -27,7 +27,7 @@
import org.apache.commons.logging.LogFactory;
import org.nuiton.math.matrix.MatrixND;
-import scripts.ResultName;
+import resultinfos.MatrixBiomass;
import fr.ifremer.isisfish.datastore.ResultStorage;
import fr.ifremer.isisfish.datastore.SimulationStorage;
import fr.ifremer.isisfish.entities.Population;
@@ -40,7 +40,9 @@
/** to use log facility, just put in your code: log.info("..."); */
static private Log log = LogFactory.getLog(SensitivityBiomassJanvierY3.class);
- protected String[] necessaryResult = { ResultName.MATRIX_BIOMASS };
+ protected String[] necessaryResult = {
+ MatrixBiomass.NAME
+ };
@Doc("Population")
public Population param_pop;
@@ -56,8 +58,7 @@
if (pop.getName().equals(param_pop.getName())) {
//Get the biomass of the last time step
- MatrixND matlastJan = resultStorage.getMatrix(janvierLastYear, pop,
- ResultName.MATRIX_BIOMASS);
+ MatrixND matlastJan = resultStorage.getMatrix(janvierLastYear, pop, MatrixBiomass.NAME);
biomass = matlastJan.sumAll();
}
}
Modified: trunk/sensitivityexports/SensitivityBiomassRelativeJanvierY6.java
===================================================================
--- trunk/sensitivityexports/SensitivityBiomassRelativeJanvierY6.java 2017-05-09 07:54:30 UTC (rev 54)
+++ trunk/sensitivityexports/SensitivityBiomassRelativeJanvierY6.java 2018-04-05 08:40:29 UTC (rev 55)
@@ -27,7 +27,7 @@
import org.apache.commons.logging.LogFactory;
import org.nuiton.math.matrix.MatrixND;
-import scripts.ResultName;
+import resultinfos.MatrixBiomass;
import fr.ifremer.isisfish.datastore.ResultStorage;
import fr.ifremer.isisfish.datastore.SimulationStorage;
import fr.ifremer.isisfish.entities.Population;
@@ -41,7 +41,9 @@
static private Log log = LogFactory
.getLog(SensitivityBiomassRelativeJanvierY6.class);
- protected String[] necessaryResult = { ResultName.MATRIX_BIOMASS };
+ protected String[] necessaryResult = {
+ MatrixBiomass.NAME
+ };
@Doc("Population")
public Population param_pop;
@@ -60,13 +62,11 @@
if (pop.getName().equals(param_pop.getName())) {
//Get the biomass on december of the first year
- MatrixND matfirstdate = resultStorage.getMatrix(firstStep, pop,
- ResultName.MATRIX_BIOMASS);
+ MatrixND matfirstdate = resultStorage.getMatrix(firstStep, pop, MatrixBiomass.NAME);
firstbiomass = matfirstdate.sumAll();
//Get the biomass on the month of January of the last time step
- MatrixND matlastJan = resultStorage.getMatrix(janvierLastYear, pop,
- ResultName.MATRIX_BIOMASS);
+ MatrixND matlastJan = resultStorage.getMatrix(janvierLastYear, pop, MatrixBiomass.NAME);
biomass = matlastJan.sumAll();
}
Modified: trunk/sensitivityexports/SensitivitySpawningBiomassJanvierY2.java
===================================================================
--- trunk/sensitivityexports/SensitivitySpawningBiomassJanvierY2.java 2017-05-09 07:54:30 UTC (rev 54)
+++ trunk/sensitivityexports/SensitivitySpawningBiomassJanvierY2.java 2018-04-05 08:40:29 UTC (rev 55)
@@ -2,7 +2,7 @@
* #%L
* IsisFish data
* %%
- * Copyright (C) 2009 - 2012 Ifremer, Code Lutin, Jean Couteau, Chatellier Eric
+ * Copyright (C) 2009 - 2018 Ifremer, Code Lutin, Jean Couteau, Chatellier Eric
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -33,7 +33,7 @@
import org.nuiton.math.matrix.MatrixIterator;
import org.nuiton.math.matrix.MatrixND;
-import scripts.ResultName;
+import resultinfos.MatrixBiomass;
import java.io.Writer;
@@ -40,10 +40,11 @@
public class SensitivitySpawningBiomassJanvierY2 implements SensitivityExport {
/** to use log facility, just put in your code: log.info("..."); */
- static private Log log = LogFactory
- .getLog(SensitivitySpawningBiomassJanvierY2.class);
+ static private Log log = LogFactory.getLog(SensitivitySpawningBiomassJanvierY2.class);
- protected String[] necessaryResult = { ResultName.MATRIX_BIOMASS };
+ protected String[] necessaryResult = {
+ MatrixBiomass.NAME
+ };
@Doc("Population")
public Population param_pop;
@@ -60,8 +61,7 @@
ResultStorage resultStorage = simulation.getResultStorage();
//Get the biomass of the last time step
- MatrixND matlastJan = resultStorage.getMatrix(pop,
- ResultName.MATRIX_BIOMASS);
+ MatrixND matlastJan = resultStorage.getMatrix(pop, MatrixBiomass.NAME);
for (MatrixIterator i = matlastJan.iterator(); i.hasNext();) {
i.next();
Object[] sems = i.getSemanticsCoordinates();
Modified: trunk/sensitivityexports/SensitivitySpawningBiomassRelativeJanvierY5.java
===================================================================
--- trunk/sensitivityexports/SensitivitySpawningBiomassRelativeJanvierY5.java 2017-05-09 07:54:30 UTC (rev 54)
+++ trunk/sensitivityexports/SensitivitySpawningBiomassRelativeJanvierY5.java 2018-04-05 08:40:29 UTC (rev 55)
@@ -2,7 +2,7 @@
* #%L
* IsisFish data
* %%
- * Copyright (C) 2009 - 2012 Ifremer, Code Lutin, Jean Couteau, Chatellier Eric
+ * Copyright (C) 2009 - 2018 Ifremer, Code Lutin, Jean Couteau, Chatellier Eric
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -33,7 +33,7 @@
import org.nuiton.math.matrix.MatrixIterator;
import org.nuiton.math.matrix.MatrixND;
-import scripts.ResultName;
+import resultinfos.MatrixBiomass;
import java.io.Writer;
@@ -40,10 +40,11 @@
public class SensitivitySpawningBiomassRelativeJanvierY5 implements SensitivityExport {
/** to use log facility, just put in your code: log.info("..."); */
- static private Log log = LogFactory
- .getLog(SensitivitySpawningBiomassRelativeJanvierY5.class);
+ static private Log log = LogFactory.getLog(SensitivitySpawningBiomassRelativeJanvierY5.class);
- protected String[] necessaryResult = { ResultName.MATRIX_BIOMASS };
+ protected String[] necessaryResult = {
+ MatrixBiomass.NAME
+ };
@Doc("Population")
public Population param_pop;
@@ -62,8 +63,7 @@
ResultStorage resultStorage = simulation.getResultStorage();
//Get the biomass of the first time step
- MatrixND matfirstdate = resultStorage.getMatrix(pop,
- ResultName.MATRIX_BIOMASS);
+ MatrixND matfirstdate = resultStorage.getMatrix(pop, MatrixBiomass.NAME);
for (MatrixIterator i = matfirstdate.iterator(); i.hasNext();) {
i.next();
Object[] sems = i.getSemanticsCoordinates();
@@ -76,8 +76,7 @@
}
//Get the biomass of the last time step
- MatrixND matlastJan = resultStorage.getMatrix(pop,
- ResultName.MATRIX_BIOMASS);
+ MatrixND matlastJan = resultStorage.getMatrix(pop, MatrixBiomass.NAME);
for (MatrixIterator i = matlastJan.iterator(); i.hasNext();) {
i.next();
Object[] sems = i.getSemanticsCoordinates();
Modified: trunk/sensitivityexports/SensitivityTotalFishingMortalityY1.java
===================================================================
--- trunk/sensitivityexports/SensitivityTotalFishingMortalityY1.java 2017-05-09 07:54:30 UTC (rev 54)
+++ trunk/sensitivityexports/SensitivityTotalFishingMortalityY1.java 2018-04-05 08:40:29 UTC (rev 55)
@@ -2,7 +2,7 @@
* #%L
* IsisFish data
* %%
- * Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Jean Couteau
+ * Copyright (C) 2009 - 2018 Ifremer, Code Lutin, Jean Couteau
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -28,7 +28,7 @@
import org.nuiton.math.matrix.*;
-import scripts.ResultName;
+import resultinfos.MatrixTotalFishingMortality;
import fr.ifremer.isisfish.datastore.ResultStorage;
import fr.ifremer.isisfish.datastore.SimulationStorage;
@@ -44,10 +44,11 @@
public class SensitivityTotalFishingMortalityY1 implements SensitivityExport {
/** to use log facility, just put in your code: log.info("..."); */
- static private Log log = LogFactory
- .getLog(SensitivityTotalFishingMortalityY1.class);
+ static private Log log = LogFactory.getLog(SensitivityTotalFishingMortalityY1.class);
- protected String[] necessaryResult = { ResultName.MATRIX_TOTAL_FISHING_MORTALITY };
+ protected String[] necessaryResult = {
+ MatrixTotalFishingMortality.NAME
+ };
@Doc("Population")
public Population param_pop;
@@ -61,12 +62,9 @@
for (Population pop : simulation.getParameter().getPopulations()) {
if (pop.getName().equals(param_pop.getName())) {
-
- //Get the fishing mortality of the (last step of) the last year.
- MatrixND matlastdate = resultStorage.getMatrix(lastStep, pop,
- ResultName.MATRIX_TOTAL_FISHING_MORTALITY);
- totalFishingMortality = matlastdate.sumAll();
-
+ //Get the fishing mortality of the (last step of) the last year.
+ MatrixND matlastdate = resultStorage.getMatrix(lastStep, pop, MatrixTotalFishingMortality.NAME);
+ totalFishingMortality = matlastdate.sumAll();
}
}
Modified: trunk/sensitivityexports/SensitivityTotalFishingMortalityY2.java
===================================================================
--- trunk/sensitivityexports/SensitivityTotalFishingMortalityY2.java 2017-05-09 07:54:30 UTC (rev 54)
+++ trunk/sensitivityexports/SensitivityTotalFishingMortalityY2.java 2018-04-05 08:40:29 UTC (rev 55)
@@ -2,7 +2,7 @@
* #%L
* IsisFish data
* %%
- * Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Jean Couteau
+ * Copyright (C) 2009 - 2018 Ifremer, Code Lutin, Jean Couteau
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -28,7 +28,7 @@
import org.nuiton.math.matrix.*;
-import scripts.ResultName;
+import resultinfos.MatrixTotalFishingMortality;
import fr.ifremer.isisfish.datastore.ResultStorage;
import fr.ifremer.isisfish.datastore.SimulationStorage;
@@ -44,17 +44,15 @@
public class SensitivityTotalFishingMortalityY2 implements SensitivityExport {
/** to use log facility, just put in your code: log.info("..."); */
- static private Log log = LogFactory
- .getLog(SensitivityTotalFishingMortalityY2.class);
+ static private Log log = LogFactory.getLog(SensitivityTotalFishingMortalityY2.class);
- protected String[] necessaryResult = { ResultName.MATRIX_TOTAL_FISHING_MORTALITY };
+ protected String[] necessaryResult = {MatrixTotalFishingMortality.NAME};
@Doc("Population")
public Population param_pop;
@Override
- public void export(SimulationStorage simulation, Writer out)
- throws Exception {
+ public void export(SimulationStorage simulation, Writer out) throws Exception {
ResultStorage resultStorage = simulation.getResultStorage();
TimeStep lastStep = resultStorage.getLastStep();
TimeStep firstStep = new TimeStep(11);
@@ -63,17 +61,13 @@
for (Population pop : simulation.getParameter().getPopulations()) {
if (pop.getName().equals(param_pop.getName())) {
+ //Get the fishing mortality on december of the first year
+ MatrixND matfirstdate = resultStorage.getMatrix(firstStep, pop, MatrixTotalFishingMortality.NAME);
+ firsttotalFishingMortality = matfirstdate.sumAll();
- //Get the fishing mortality on december of the first year
- MatrixND matfirstdate = resultStorage.getMatrix(firstStep, pop,
- ResultName.MATRIX_TOTAL_FISHING_MORTALITY);
- firsttotalFishingMortality = matfirstdate.sumAll();
-
- //Get the fishing mortality of the (last step of) the last year.
- MatrixND matlastdate = resultStorage.getMatrix(lastStep, pop,
- ResultName.MATRIX_TOTAL_FISHING_MORTALITY);
- totalFishingMortality = matlastdate.sumAll();
-
+ //Get the fishing mortality of the (last step of) the last year.
+ MatrixND matlastdate = resultStorage.getMatrix(lastStep, pop, MatrixTotalFishingMortality.NAME);
+ totalFishingMortality = matlastdate.sumAll();
}
}
1
0
Author: echatellier
Date: 2017-05-09 09:54:30 +0200 (Tue, 09 May 2017)
New Revision: 54
Url: http://forge.codelutin.com/projects/isis-fish-community/repository/revision…
Log:
Fix compilation
Modified:
trunk/scripts/RunExportOnManySimulationResult.java
Modified: trunk/scripts/RunExportOnManySimulationResult.java
===================================================================
--- trunk/scripts/RunExportOnManySimulationResult.java 2016-08-01 09:10:37 UTC (rev 53)
+++ trunk/scripts/RunExportOnManySimulationResult.java 2017-05-09 07:54:30 UTC (rev 54)
@@ -32,7 +32,8 @@
import exports.Biomasses;
import fr.ifremer.isisfish.datastore.SimulationStorage;
import fr.ifremer.isisfish.simulator.*;
-import fr.ifremer.isisfish.export.Export;
+import fr.ifremer.isisfish.export.ExportInfo;
+import fr.ifremer.isisfish.export.ExportStep;
import fr.ifremer.isisfish.export.ExportHelper;
/**
@@ -46,12 +47,12 @@
public class RunExportOnManySimulationResult {
// nom des exports a rejouer (à modifier selon le besoin)
- protected List<Export> exports = Arrays.asList(
+ protected List<? extends ExportInfo> exports = Arrays.asList(
new Abundances(),
new Biomasses()
);
- public void doAllExports() throws TopiaException {
+ public void doAllExports() throws Exception {
// prefix des noms de simulations (à configurer)
String simulationPrefix = "as_test_";
int simulationCount = 2000;
@@ -67,9 +68,7 @@
SimulationContext.get().setSimulationStorage(currentSimulation);
// run each export for this simulation
- File rootDirectory = currentSimulation.getDirectory();
- File exportDir = SimulationStorage.getResultExportDirectory(rootDirectory);
- ExportHelper.doExport(currentSimulation, exportDir, exports, rootDirectory);
+ runExports(currentSimulation, exports);
System.out.println("Exports done on simulation " + currentSimulationName);
// close all
@@ -77,7 +76,32 @@
}
}
- public static void main(String[] args) throws TopiaException {
+ protected void runExports(SimulationStorage currentSimulation, List<? extends ExportInfo> exports) throws Exception {
+ File rootDirectory = currentSimulation.getDirectory();
+ File exportDir = SimulationStorage.getResultExportDirectory(rootDirectory);
+
+ for (ExportInfo export : exports) {
+ File file = getExport(exportDir, export);
+ ExportHelper.exportToFile(currentSimulation, export.getClass().getSimpleName(), file);
+ }
+ }
+
+ protected File getExport(File destdir, ExportInfo exportInfo) {
+ String filename = exportInfo.getExportFilename();
+ String extension = exportInfo.getExtensionFilename();
+
+ File file = new File(destdir, filename + extension);
+ // prevent two export with same name
+ // name MyExport.csv become MyExport_1.csv
+ int val = 0;
+ while (file.exists()) {
+ val++;
+ file = new File(destdir, filename + extension + "_" + val);
+ }
+ return file;
+ }
+
+ public static void main(String[] args) throws Exception {
RunExportOnManySimulationResult runExportJob = new RunExportOnManySimulationResult();
runExportJob.doAllExports();
}
1
0
Author: echatellier
Date: 2016-08-01 11:10:37 +0200 (Mon, 01 Aug 2016)
New Revision: 53
Url: http://forge.codelutin.com/projects/isis-fish-community/repository/revision…
Log:
Add objectives optimizations directory
Added:
trunk/objectives/
trunk/optimizations/
1
0
Author: echatellier
Date: 2016-03-10 16:48:10 +0100 (Thu, 10 Mar 2016)
New Revision: 52
Url: http://forge.codelutin.com/projects/isis-fish-community/repository/revision…
Log:
Add script example to update a region
Added:
trunk/scripts/RegionBatchScript.java
Added: trunk/scripts/RegionBatchScript.java
===================================================================
--- trunk/scripts/RegionBatchScript.java (rev 0)
+++ trunk/scripts/RegionBatchScript.java 2016-03-10 15:48:10 UTC (rev 52)
@@ -0,0 +1,132 @@
+/*
+ * #%L
+ * IsisFish data
+ * %%
+ * Copyright (C) 2016 Ifremer, Code Lutin, Chatellier Eric
+ * %%
+ * This program 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.
+ *
+ * This program 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, see
+ * <http://www.gnu.org/licenses/gpl-2.0.html>.
+ * #L%
+ */
+package scripts;
+
+import java.util.*;
+
+import org.nuiton.topia.TopiaContext;
+
+import fr.ifremer.isisfish.IsisFishDAOHelper;
+import fr.ifremer.isisfish.datastore.RegionStorage;
+import fr.ifremer.isisfish.entities.*;
+
+/**
+ * Ce script sert à modifier une region de facon informatique car il peut être très
+ * couteux en temps de cliquer à de nombreuses reprises dans l'interface graphique.
+ *
+ * @author Eric Chatellier
+ */
+public class RegionBatchScript {
+
+ public void run() {
+ // ouverture d'une region par son nom
+ RegionStorage region = RegionStorage.getRegion("gdg2");
+
+ // ouverture d'une transaction pour effectuer toutes les modifications
+ TopiaContext tx = region.getStorage().beginTransaction();
+
+ // utilisation du contexte dans d'autre methodes
+ createRegionCells(tx);
+ updateAllZones(tx);
+ updateMetier(tx);
+
+ // commit : valide les transactions en base de données
+ // roolback : annule les modifications en base de données (permet de tester le script)
+ //tx.commitTransaction();
+ tx.rollbackTransaction();
+
+ // close region
+ tx.closeContext();
+ }
+
+ /**
+ * Exemple de creation de nombreuses cellules.
+ *
+ * @param tx transaction
+ */
+ protected void createRegionCells(TopiaContext tx) {
+ CellDAO cellDAO = IsisFishDAOHelper.getCellDAO(tx);
+
+ // creer 50 cellules
+ for (int i = 1; i < 50; i++) {
+ Cell cell = new CellImpl();
+ cell.setName("test cells " + i);
+ cell.setLatitude(5.4f);
+ cell.setLongitude(2.4f);
+ cellDAO.create(cell);
+ }
+ }
+
+ /**
+ * Mise à jour d'un paramètre de toutes les zones.
+ *
+ * @param tx transaction
+ */
+ protected void updateAllZones(TopiaContext tx) {
+ ZoneDAO zoneDAO = IsisFishDAOHelper.getZoneDAO(tx);
+ CellDAO cellDAO = IsisFishDAOHelper.getCellDAO(tx);
+
+ // modifie les zones par les cellules crées précédemment.
+ for (Zone zone : zoneDAO.findAll()) {
+
+ List<Cell> cells = Arrays.asList(
+ cellDAO.findByName("test cell 1"),
+ cellDAO.findByName("test cell 2"),
+ cellDAO.findByName("test cell 3"),
+ cellDAO.findByName("test cell 4"),
+ cellDAO.findByName("test cell 5")
+ );
+
+ zone.setCell(cells);
+ }
+ }
+
+ /**
+ * Modifie les metiers utilisé, les equations des TargetSpecies
+ *
+ * @param tx transaction
+ */
+ protected void updateMetier(TopiaContext tx) {
+ MetierDAO metierDAO = IsisFishDAOHelper.getMetierDAO(tx);
+
+ List<Metier> metiers = metierDAO.findAll();
+ for (Metier metier : metiers) {
+ List<MetierSeasonInfo> msis = metier.getMetierSeasonInfo();
+ for (MetierSeasonInfo msi : msis) {
+ Collection<TargetSpecies> stsList = msi.getSpeciesTargetSpecies();
+
+ for (TargetSpecies ts : stsList) {
+ ts.getTargetFactorEquation().setContent("return 1;");
+ }
+ }
+ }
+ }
+
+ /**
+ * Point d'entrée du script.
+ */
+ public static void main(String[] args) {
+ RegionBatchScript script = new RegionBatchScript();
+ script.run();
+ System.out.println("Done: " + new Date());
+ }
+}
Property changes on: trunk/scripts/RegionBatchScript.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision HeadURL
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
1
0