Isis-fish-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
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- 3175 discussions
Author: chatellier
Date: 2011-06-28 12:27:33 +0000 (Tue, 28 Jun 2011)
New Revision: 3429
Log:
Update eugene/topia
Modified:
isis-fish/trunk/pom.xml
Modified: isis-fish/trunk/pom.xml
===================================================================
--- isis-fish/trunk/pom.xml 2011-06-22 14:47:43 UTC (rev 3428)
+++ isis-fish/trunk/pom.xml 2011-06-28 12:27:33 UTC (rev 3429)
@@ -519,8 +519,8 @@
<!-- Dependencies version -->
<jaxxVersion>2.4.2</jaxxVersion>
- <eugeneVersion>2.3.4</eugeneVersion>
- <topiaVersion>2.6-SNAPSHOT</topiaVersion>
+ <eugeneVersion>2.3.5</eugeneVersion>
+ <topiaVersion>2.6</topiaVersion>
<nuitonUtilsVersion>2.2</nuitonUtilsVersion>
<nuitonI18nVersion>2.4</nuitonI18nVersion>
<nuitonWidgetsVersion>1.1.1</nuitonWidgetsVersion>
1
0
r3428 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation
by chatellier@users.labs.libre-entreprise.org 22 Jun '11
by chatellier@users.labs.libre-entreprise.org 22 Jun '11
22 Jun '11
Author: chatellier
Date: 2011-06-22 14:47:43 +0000 (Wed, 22 Jun 2011)
New Revision: 3428
Log:
Fix equation package javadoc.
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/EmigrationEquation.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/ImmigrationEquation.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/Language.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/MigrationEquation.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationGrowth.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationGrowthReverse.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationMaturityOgiveEquation.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationMeanWeight.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationNaturalDeathRate.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationPrice.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationReproductionEquation.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationReproductionRateEquation.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/SelectivityEquation.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/SoVTechnicalEfficiencyEquation.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/StrategyInactivityEquation.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/TargetSpeciesTargetFactorEquation.java
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/EmigrationEquation.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/EmigrationEquation.java 2011-06-22 14:18:06 UTC (rev 3427)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/EmigrationEquation.java 2011-06-22 14:47:43 UTC (rev 3428)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
+ * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, 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
@@ -34,7 +34,7 @@
import fr.ifremer.isisfish.util.Args;
/**
- * EmigrationEquation.java
+ * Emigration equation.
*
* Created: 23 août 2006 12:06:02
*
@@ -47,14 +47,16 @@
public interface EmigrationEquation {
/**
+ * Compute emigration equation.
*
- * @param context
+ * @param context simulation context
* @param N effectif de la population
* @param pop la population pour lequel on souhaite le coffecient d'emigration
* @param group le group pour lequel on souhaite le coffecient d'emigration
* @param departureZone la zone de depart
* @return la proportion d'individu a emigrer de la zone de depart
* pour le groupe passé en argument
+ * @throws Exception
*/
@Args({"context", "N", "pop", "group", "departureZone"})
public double compute(SimulationContext context,
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/ImmigrationEquation.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/ImmigrationEquation.java 2011-06-22 14:18:06 UTC (rev 3427)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/ImmigrationEquation.java 2011-06-22 14:47:43 UTC (rev 3428)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
+ * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, 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
@@ -34,7 +34,7 @@
import fr.ifremer.isisfish.util.Args;
/**
- * ImmigrationEquation.java
+ * Immigration equation.
*
* Created: 23 août 2006 12:06:32
*
@@ -47,14 +47,16 @@
public interface ImmigrationEquation {
/**
+ * Compute immigration equation.
*
- * @param context
+ * @param context simulation context
* @param N effectif de la population
* @param pop la population pour lequel on souhaite le nombre d'immigration
* @param group le group pour lequel on souhaite le nombre d'immigration
* @param arrivalZone la zone d'arrivé de l'immigration
* @return le nombre d'individu a immigrer dans la zone
* d'arrivé pour le groupe passé en argument
+ * @throws Exception
*/
@Args({"context", "N", "pop", "group", "arrivalZone"})
public double compute(SimulationContext context,
@@ -62,5 +64,3 @@
Zone arrivalZone) throws Exception;
}
-
-
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/Language.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/Language.java 2011-06-22 14:18:06 UTC (rev 3427)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/Language.java 2011-06-22 14:47:43 UTC (rev 3428)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
+ * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, 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
@@ -26,7 +26,7 @@
package fr.ifremer.isisfish.equation;
/**
- * Language.java
+ * Equation languages supported by IsisFish.
*
* Created: 23 août 2006 01:18:19
*
@@ -37,8 +37,13 @@
* by : $Author$
*/
public class Language {
+
+ /** Java language. */
final static public String JAVA = "java";
+ /** Bean shell language. */
final static public String BSH = "BSH";
+ /** ECMAScript language. */
final static public String ECMASCRIPT = "ECMAScript";
+ /** GROOVY language. */
final static public String GROOVY = "Groovy";
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/MigrationEquation.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/MigrationEquation.java 2011-06-22 14:18:06 UTC (rev 3427)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/MigrationEquation.java 2011-06-22 14:47:43 UTC (rev 3428)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
+ * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, 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
@@ -34,7 +34,7 @@
import fr.ifremer.isisfish.util.Args;
/**
- * MigrationEquation.java
+ * Migration equation.
*
* Created: 23 août 2006 12:05:14
*
@@ -47,8 +47,9 @@
public interface MigrationEquation {
/**
+ * Compute migration equation.
*
- * @param context
+ * @param context simulation context
* @param N effectif de la population
* @param pop la population pour lequel on souhaite le coffecient de migration
* @param group le group pour lequel on souhaite le coffecient de migration
@@ -56,6 +57,7 @@
* @param arrivalZone la zone d'arrivé de migration
* @return la proportion d'individu a migrer de la zone de depart a la zone
* d'arrivé pour le groupe passé en argument
+ * @throws Exception
*/
@Args({"context", "N", "pop", "group", "departureZone", "arrivalZone"})
public double compute(SimulationContext context,
@@ -63,5 +65,3 @@
Zone departureZone, Zone arrivalZone) throws Exception;
}
-
-
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationGrowth.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationGrowth.java 2011-06-22 14:18:06 UTC (rev 3427)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationGrowth.java 2011-06-22 14:47:43 UTC (rev 3428)
@@ -30,7 +30,7 @@
import fr.ifremer.isisfish.util.Args;
/**
- * PopulationGrowth.java
+ * Population's growth equation.
*
* Created: 4 juil. 2006 13:03:25
*
@@ -43,15 +43,15 @@
public interface PopulationGrowth {
/**
+ * Compute groth equation.
*
- * @param context
+ * @param context simulation context
* @param age l'age du groupe en mois
* @param group le groupe dont on souhaite avoir la longueur en fonction de l'age
* @return equation result
+ * @throws Exception
*/
@Args({"context", "age", "group"})
public double compute(SimulationContext context, double age, PopulationGroup group) throws Exception;
}
-
-
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationGrowthReverse.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationGrowthReverse.java 2011-06-22 14:18:06 UTC (rev 3427)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationGrowthReverse.java 2011-06-22 14:47:43 UTC (rev 3428)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
+ * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, 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
@@ -30,7 +30,7 @@
import fr.ifremer.isisfish.util.Args;
/**
- * PopulationGrowthReverse.java
+ * Population's growth reverse equation.
*
* Created: 23 août 2006 01:26:37
*
@@ -43,15 +43,15 @@
public interface PopulationGrowthReverse {
/**
+ * Compute growth reverse equation.
*
- * @param context
+ * @param context simulation context
* @param length la longueur du groupe
* @param group le groupe dont on souhaite avoir l'age en fonction de la longueur
* @return l'age du groupe en mois
+ * @throws Exception
*/
@Args({"context", "length", "group"})
public double compute(SimulationContext context, double length, PopulationGroup group) throws Exception;
}
-
-
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationMaturityOgiveEquation.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationMaturityOgiveEquation.java 2011-06-22 14:18:06 UTC (rev 3427)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationMaturityOgiveEquation.java 2011-06-22 14:47:43 UTC (rev 3428)
@@ -46,6 +46,7 @@
* @param context simulation context
* @param group le groupe dont on souhaite avoir l'ogive de maturité
* @return l'ogive de maturite
+ * @throws Exception
*/
@Args({"context", "group"})
public double compute(SimulationContext context, PopulationGroup group) throws Exception;
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationMeanWeight.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationMeanWeight.java 2011-06-22 14:18:06 UTC (rev 3427)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationMeanWeight.java 2011-06-22 14:47:43 UTC (rev 3428)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
+ * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, 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
@@ -30,7 +30,7 @@
import fr.ifremer.isisfish.util.Args;
/**
- * PopulationMeanWeight equation.
+ * Population mean weight equation.
*
* Created: 23 août 2006 11:14:46
*
@@ -54,5 +54,3 @@
public double compute(SimulationContext context, PopulationGroup group) throws Exception;
}
-
-
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationNaturalDeathRate.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationNaturalDeathRate.java 2011-06-22 14:18:06 UTC (rev 3427)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationNaturalDeathRate.java 2011-06-22 14:47:43 UTC (rev 3428)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
+ * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, 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
@@ -32,7 +32,7 @@
import fr.ifremer.isisfish.util.Args;
/**
- * PopulationNaturalDeathRate.java
+ * Population natural death rate.java
*
* Created: 23 août 2006 11:13:57
*
@@ -45,8 +45,9 @@
public interface PopulationNaturalDeathRate {
/**
+ * Compute natural death rate.
*
- * @param context
+ * @param context simulation context
* @param pop la population pour lequel il faut calculer la mortalité naturelle
* @param group le groupe pour lequel il faut calculer la mortalité naturelle
* null, si on souhaite la mortalité naturelle du group des naissances
@@ -54,11 +55,10 @@
* seulement utilisé pour la mortalité naturelle du group des naissances,
* sinon null
* @return eqaution result
+ * @throws Exception
*/
@Args({"context", "pop", "group", "zone"})
public double compute(SimulationContext context,
Population pop, PopulationGroup group, Zone zone) throws Exception;
}
-
-
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationPrice.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationPrice.java 2011-06-22 14:18:06 UTC (rev 3427)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationPrice.java 2011-06-22 14:47:43 UTC (rev 3428)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
+ * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, 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
@@ -30,7 +30,7 @@
import fr.ifremer.isisfish.util.Args;
/**
- * PopulationPrice.java
+ * Population price.
*
* Created: 23 août 2006 11:15:17
*
@@ -43,14 +43,14 @@
public interface PopulationPrice {
/**
+ * Compute price.
*
- * @param context
+ * @param context simulation context
* @param group le groupe dont on souhaite le poids moyen
* @return equation result
+ * @throws Exception
*/
@Args({"context", "group"})
public double compute(SimulationContext context, PopulationGroup group) throws Exception;
}
-
-
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationReproductionEquation.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationReproductionEquation.java 2011-06-22 14:18:06 UTC (rev 3427)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationReproductionEquation.java 2011-06-22 14:47:43 UTC (rev 3428)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
+ * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, 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
@@ -38,7 +38,7 @@
import fr.ifremer.isisfish.util.Args;
/**
- * PopulationReproductionEquation.java
+ * Population reproduction equation.
*
* Created: 23 août 2006 11:11:40
*
@@ -51,9 +51,10 @@
public interface PopulationReproductionEquation {
/**
+ * Compute reproduction equation.
*
- * @param context
- * @param N Effectif courant de la population
+ * @param context simulation context
+ * @param N effectif courant de la population
* @param pop population pour lequel on souhaite la matrice de reproduction
* @param month le mois pour lequel on souhaite la matrice de reproduction
* @param prepro le coefficient de reproduction de la population pour ce mois
@@ -64,6 +65,7 @@
* d'un vecteur avec comme semantique la liste des zones de reproduction
* @return la valeur retournée n'est pas utilisée, par exemple 'return 0;'
* convient.
+ * @throws Exception
*/
@Args({"context", "N", "pop", "month", "prepro", "zoneRepro", "groups", "zones", "result"})
@ArgTypes({
@@ -82,5 +84,3 @@
MatrixND result) throws Exception;
}
-
-
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationReproductionRateEquation.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationReproductionRateEquation.java 2011-06-22 14:18:06 UTC (rev 3427)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationReproductionRateEquation.java 2011-06-22 14:47:43 UTC (rev 3428)
@@ -45,13 +45,12 @@
/**
* Compute reproduction rate.
*
- * @param context
+ * @param context simulation context
* @param group le groupe dont on souhaite avoir le taux de reproduction
* @return le taux de reproduction pour le groupe
+ * @throws Exception
*/
@Args({"context", "group"})
public double compute(SimulationContext context, PopulationGroup group) throws Exception;
}
-
-
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/SelectivityEquation.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/SelectivityEquation.java 2011-06-22 14:18:06 UTC (rev 3427)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/SelectivityEquation.java 2011-06-22 14:47:43 UTC (rev 3428)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
+ * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, 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
@@ -32,7 +32,7 @@
import fr.ifremer.isisfish.util.Args;
/**
- * SelectivityEquation.java
+ * Selectivity equation.
*
* Created: 23 août 2006 11:39:38
*
@@ -45,17 +45,17 @@
public interface SelectivityEquation {
/**
+ * Compute selectivity.
*
- * @param context
- * @param pop La population pour lequel on souhaite la selectivite de l'engin
+ * @param context simulation context
+ * @param pop la population pour lequel on souhaite la selectivite de l'engin
* @param group le group pour lequel on souhaite la selectivite de l'engin
* @param metier le metier pour lequel on souhaite la selectivite de l'engin
- * @return eqaution result
+ * @return equation result
+ * @throws Exception
*/
@Args({"context", "pop", "group", "metier"})
public double compute(SimulationContext context,
Population pop, PopulationGroup group, Metier metier) throws Exception;
}
-
-
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/SoVTechnicalEfficiencyEquation.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/SoVTechnicalEfficiencyEquation.java 2011-06-22 14:18:06 UTC (rev 3427)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/SoVTechnicalEfficiencyEquation.java 2011-06-22 14:47:43 UTC (rev 3428)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2002 - 2010 Ifremer, Code Lutin, Benjamin Poussin
+ * Copyright (C) 2002 - 2011 Ifremer, Code Lutin, Benjamin Poussin, 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
@@ -31,7 +31,8 @@
import fr.ifremer.isisfish.util.Args;
/**
- *
+ * Set of vessel's technical efficiency equation.
+ *
* @author poussin
* @version $Revision$
*
@@ -41,10 +42,13 @@
public interface SoVTechnicalEfficiencyEquation {
/**
- * @param context
+ * Compute technical efficiency.
+ *
+ * @param context simulation context
* @param metier le metier pour lequel on demande le calcul
* @param gear l'engin utilise par le metier
* @return equation result
+ * @throws Exception
*/
@Args({"context", "metier", "gear"})
public double compute(SimulationContext context, Metier metier, Gear gear) throws Exception;
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/StrategyInactivityEquation.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/StrategyInactivityEquation.java 2011-06-22 14:18:06 UTC (rev 3427)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/StrategyInactivityEquation.java 2011-06-22 14:47:43 UTC (rev 3428)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2002 - 2010 Ifremer, Code Lutin, Benjamin Poussin
+ * Copyright (C) 2002 - 2011 Ifremer, Code Lutin, Benjamin Poussin, 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
@@ -31,7 +31,8 @@
import fr.ifremer.isisfish.util.Args;
/**
- *
+ * Strategy's inactivity equation.
+ *
* @author poussin
* @version $Revision$
*
@@ -41,11 +42,13 @@
public interface StrategyInactivityEquation {
/**
+ * Compute inactivity.
*
- * @param context
+ * @param context simulation context
* @param month le mois courant de simulation
* @param info l'objet associe a la strategie pour le mois courant
* @return equation result
+ * @throws Exception
*/
@Args({"context", "month", "info"})
public double compute(SimulationContext context, Month month, StrategyMonthInfo info) throws Exception;
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/TargetSpeciesTargetFactorEquation.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/TargetSpeciesTargetFactorEquation.java 2011-06-22 14:18:06 UTC (rev 3427)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/TargetSpeciesTargetFactorEquation.java 2011-06-22 14:47:43 UTC (rev 3428)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
+ * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, 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
@@ -32,7 +32,7 @@
import fr.ifremer.isisfish.util.Args;
/**
- * TargetSpeciesTargetFactorEquation.java
+ * Target species's target factor equation.
*
* Created: 23 août 2006 16:44:40
*
@@ -45,13 +45,15 @@
public interface TargetSpeciesTargetFactorEquation {
/**
+ * Compute target factor.
*
- * @param context
+ * @param context simulation context
* @param group le group pour lequel on recherche le facteur de ciblage
* @param species l'espece pour lequel on recherche le facteur de ciblage
* @param infoMetier
* @param primaryCatch
* @return equation result
+ * @throws Exception
*/
@Args({"context", "group", "species", "infoMetier", "primaryCatch"})
public double compute(SimulationContext context,
@@ -59,5 +61,3 @@
MetierSeasonInfo infoMetier, boolean primaryCatch) throws Exception;
}
-
-
1
0
r3427 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation
by chatellier@users.labs.libre-entreprise.org 22 Jun '11
by chatellier@users.labs.libre-entreprise.org 22 Jun '11
22 Jun '11
Author: chatellier
Date: 2011-06-22 14:18:06 +0000 (Wed, 22 Jun 2011)
New Revision: 3427
Log:
Add maturity ogive and reproduction rate equation
Added:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationMaturityOgiveEquation.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationReproductionRateEquation.java
Added: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationMaturityOgiveEquation.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationMaturityOgiveEquation.java (rev 0)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationMaturityOgiveEquation.java 2011-06-22 14:18:06 UTC (rev 3427)
@@ -0,0 +1,52 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.isisfish.equation;
+
+import fr.ifremer.isisfish.entities.PopulationGroup;
+import fr.ifremer.isisfish.simulator.SimulationContext;
+import fr.ifremer.isisfish.util.Args;
+
+/**
+ * Population's maturity ogive equation.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public interface PopulationMaturityOgiveEquation {
+
+ /**
+ * Compute maturity ogive.
+ *
+ * @param context simulation context
+ * @param group le groupe dont on souhaite avoir l'ogive de maturité
+ * @return l'ogive de maturite
+ */
+ @Args({"context", "group"})
+ public double compute(SimulationContext context, PopulationGroup group) throws Exception;
+}
Property changes on: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationMaturityOgiveEquation.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationReproductionRateEquation.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationReproductionRateEquation.java (rev 0)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationReproductionRateEquation.java 2011-06-22 14:18:06 UTC (rev 3427)
@@ -0,0 +1,57 @@
+/*
+ * #%L
+ * IsisFish
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 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 fr.ifremer.isisfish.equation;
+
+import fr.ifremer.isisfish.entities.PopulationGroup;
+import fr.ifremer.isisfish.simulator.SimulationContext;
+import fr.ifremer.isisfish.util.Args;
+
+/**
+ * Population's reproduction rate equation.
+ *
+ * Created: 23 août 2006 11:11:40
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+public interface PopulationReproductionRateEquation {
+
+ /**
+ * Compute reproduction rate.
+ *
+ * @param context
+ * @param group le groupe dont on souhaite avoir le taux de reproduction
+ * @return le taux de reproduction pour le groupe
+ */
+ @Args({"context", "group"})
+ public double compute(SimulationContext context, PopulationGroup group) throws Exception;
+
+}
+
+
Property changes on: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/equation/PopulationReproductionRateEquation.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
1
0
r3426 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator
by chatellier@users.labs.libre-entreprise.org 20 Jun '11
by chatellier@users.labs.libre-entreprise.org 20 Jun '11
20 Jun '11
Author: chatellier
Date: 2011-06-20 10:21:42 +0000 (Mon, 20 Jun 2011)
New Revision: 3426
Log:
Merge error : readd set property methods
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameter.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameterCache.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameterImpl.java
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameter.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameter.java 2011-06-17 15:04:17 UTC (rev 3425)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameter.java 2011-06-20 10:21:42 UTC (rev 3426)
@@ -531,6 +531,19 @@
public abstract boolean isLibDebugLevel();
/**
+ * Permet d'ajouter des parametres directement à partir de leur
+ * representation chaine.
+ *
+ * A ne pas utiliser normalement, sert uniquement dans les prescripts des
+ * simulation des AS.
+ *
+ * @param key key
+ * @param value value
+ * @since 3.4.0.0
+ */
+ public void setProperty(String key, String value);
+
+ /**
* A copy instance of SimulationParameter.
*
* Warning, this is not a deep copy, already instancied objects are
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameterCache.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameterCache.java 2011-06-17 15:04:17 UTC (rev 3425)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameterCache.java 2011-06-20 10:21:42 UTC (rev 3426)
@@ -846,6 +846,15 @@
}
/*
+ * @see fr.ifremer.isisfish.simulator.SimulationParameter#isLibDebugLevel()
+ */
+ @Override
+ public void setProperty(String key, String value) {
+ SimulationParameter param = getParam();
+ param.setProperty(key, value);
+ }
+
+ /*
* @see fr.ifremer.isisfish.simulator.SimulationParameter#copy()
*/
@Override
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameterImpl.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameterImpl.java 2011-06-17 15:04:17 UTC (rev 3425)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameterImpl.java 2011-06-20 10:21:42 UTC (rev 3426)
@@ -39,7 +39,6 @@
import java.util.Map;
import java.util.Properties;
-import org.apache.commons.beanutils.ConvertUtilsBean;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -70,7 +69,6 @@
import fr.ifremer.isisfish.rule.Rule;
import fr.ifremer.isisfish.rule.RuleHelper;
import fr.ifremer.isisfish.simulator.sensitivity.SensitivityCalculator;
-import fr.ifremer.isisfish.util.ConverterUtil;
/**
* Real {@link SimulationParameter} implementation.
@@ -84,7 +82,7 @@
public class SimulationParameterImpl implements SimulationParameter {
/** Logger for this class. */
- private static Log log = LogFactory.getLog(SimulationParameter.class);
+ private static Log log = LogFactory.getLog(SimulationParameterImpl.class);
/** Remember last read properties. */
protected Properties propertiesParameters;
@@ -1276,6 +1274,22 @@
return "debug".equals(getLibLogLevel());
}
+ /**
+ * Permet d'ajouter des parametres directement à partir de leur
+ * representation chaine.
+ *
+ * A ne pas utiliser normalement, sert uniquement dans les prescripts des
+ * simulation des AS.
+ *
+ * @param key key
+ * @param value value
+ * @since 3.4.0.0
+ */
+ @Override
+ public void setProperty(String key, String value) {
+ propertiesParameters.setProperty(key, value);
+ }
+
/*
* @see fr.ifremer.isisfish.simulator.SimulationParameter#copy()
*/
1
0
Author: chatellier
Date: 2011-06-17 15:04:17 +0000 (Fri, 17 Jun 2011)
New Revision: 3425
Log:
Back to previous release
Modified:
isis-fish/trunk/pom.xml
Modified: isis-fish/trunk/pom.xml
===================================================================
--- isis-fish/trunk/pom.xml 2011-06-17 14:53:50 UTC (rev 3424)
+++ isis-fish/trunk/pom.xml 2011-06-17 15:04:17 UTC (rev 3425)
@@ -523,7 +523,7 @@
<topiaVersion>2.6-SNAPSHOT</topiaVersion>
<nuitonUtilsVersion>2.2</nuitonUtilsVersion>
<nuitonI18nVersion>2.4</nuitonI18nVersion>
- <nuitonWidgetsVersion>1.1.2-SNAPSHOT</nuitonWidgetsVersion>
+ <nuitonWidgetsVersion>1.1.1</nuitonWidgetsVersion>
<aspectwerkzVersion>2.0</aspectwerkzVersion>
<!-- jnlp (disabled until retested)
1
0
r3424 - in isis-fish/trunk/src/main/java/fr/ifremer/isisfish: . util
by chatellier@users.labs.libre-entreprise.org 17 Jun '11
by chatellier@users.labs.libre-entreprise.org 17 Jun '11
17 Jun '11
Author: chatellier
Date: 2011-06-17 14:53:50 +0000 (Fri, 17 Jun 2011)
New Revision: 3424
Log:
Ajout de l'impl?\195?\169mentation du mapper de semantique utilis?\195?\169 lors de l'import des matrices ND
Added:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/IsisMatrixSemanticMapper.java
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java 2011-06-17 14:39:00 UTC (rev 3423)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java 2011-06-17 14:53:50 UTC (rev 3424)
@@ -50,6 +50,7 @@
import org.apache.commons.logging.LogFactory;
import org.nuiton.i18n.I18n;
import org.nuiton.i18n.init.ClassPathI18nInitializer;
+import org.nuiton.math.matrix.MatrixFactory;
import org.nuiton.topia.TopiaException;
import org.nuiton.util.FileUtil;
import org.nuiton.util.Version;
@@ -69,6 +70,7 @@
import fr.ifremer.isisfish.simulator.launcher.SimulationService;
import fr.ifremer.isisfish.ui.WelcomeUI;
import fr.ifremer.isisfish.ui.util.ErrorHelper;
+import fr.ifremer.isisfish.util.IsisMatrixSemanticMapper;
import fr.ifremer.isisfish.vcs.VCS;
import fr.ifremer.isisfish.vcs.VCSActionEvent;
import fr.ifremer.isisfish.vcs.VCSException;
@@ -122,7 +124,7 @@
// initVCS ask for passphrase, ui must be set before
initLookAndFeel();
-
+
// static vcs init (needed for some actions)
try {
initVCS();
@@ -131,10 +133,13 @@
log.warn(_("Error during vcs initialisation"), eee);
}
+ // nuiton matrix semantics mapper
+ MatrixFactory.setSemanticMapper(new IsisMatrixSemanticMapper());
+
if (log.isInfoEnabled()) {
log.info(_("isisfish.launching", config.getElapsedTimeAsString()));
}
-
+
// after init vcs and local data
config.doAction(IsisConfig.STEP_AFTER_INIT_VCS);
@@ -142,7 +147,7 @@
// action after ui launched
config.doAction(IsisConfig.STEP_AFTER_UI);
-
+
startCronService();
}
Added: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/IsisMatrixSemanticMapper.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/IsisMatrixSemanticMapper.java (rev 0)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/IsisMatrixSemanticMapper.java 2011-06-17 14:53:50 UTC (rev 3424)
@@ -0,0 +1,100 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.isisfish.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.math.matrix.SemanticMapper;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.persistence.TopiaDAO;
+
+import fr.ifremer.isisfish.IsisFishDAOHelper;
+import fr.ifremer.isisfish.simulator.SimulationContext;
+
+/**
+ * Implementation du mapper de semantique pour Isis pour que l'import/export
+ * des matrices en N dimensions de nuiton matrix fonctionne.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class IsisMatrixSemanticMapper extends SemanticMapper {
+
+ /** Logger for this class. */
+ private static Log log = LogFactory.getLog(IsisMatrixSemanticMapper.class);
+
+ /**
+ * Return class for type identified by typeName.
+ *
+ * For example : "Population" can return "fr.ifremer.entities.Population.class"
+ *
+ * Return {@code String} by default.
+ *
+ * @param typeName type to get class.
+ * @return type for typeId
+ */
+ public Class getType(String typeName) {
+
+ // In simulation context :
+ Class clazz = null;
+ try {
+ clazz = Class.forName("fr.ifremer.isisfish.entities." + typeName);
+ } catch (Exception ex) {
+ log.warn("Can't find class for " + typeName, ex);
+ clazz = String.class;
+ }
+ return clazz;
+ }
+
+ /**
+ * Return value identified by valueId and type {@code type}.
+ *
+ * Return {@code valueId} by default;
+ *
+ * @param type
+ * @param valueId
+ * @return value identified by {valueId}
+ */
+ public Object getValue(Class type, String valueId) {
+
+ // In simulation context :
+ Object value = null;
+ try {
+ TopiaContext context = SimulationContext.get().getDB();
+ TopiaDAO dao = IsisFishDAOHelper.getDAO(context, type);
+ value = dao.findByProperty("name", valueId);
+ } catch (Exception ex) {
+ log.warn("Can't get value for " + valueId, ex);
+ value = valueId;
+ }
+ return value;
+
+ //return valueId;
+ }
+}
\ No newline at end of file
Property changes on: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/IsisMatrixSemanticMapper.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
1
0
r3423 - in isis-fish/trunk/src/main/java/fr/ifremer/isisfish: entities ui/input ui/input/renderer
by chatellier@users.labs.libre-entreprise.org 17 Jun '11
by chatellier@users.labs.libre-entreprise.org 17 Jun '11
17 Jun '11
Author: chatellier
Date: 2011-06-17 14:39:00 +0000 (Fri, 17 Jun 2011)
New Revision: 3423
Log:
Simplification d'un toString pour que le nom de facteur soit moins ... hardcore.
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/TripTypeImpl.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/package-info.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/renderer/TripTypeListRenderer.java
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/TripTypeImpl.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/TripTypeImpl.java 2011-06-17 14:23:45 UTC (rev 3422)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/TripTypeImpl.java 2011-06-17 14:39:00 UTC (rev 3423)
@@ -66,8 +66,7 @@
*/
@Override
public String toString() {
- String result = getName() + "(" + getTripDuration() + ":"
- + getMinTimeBetweenTrip() + ")";
+ String result = getName();
return result;
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/package-info.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/package-info.java 2011-06-17 14:23:45 UTC (rev 3422)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/package-info.java 2011-06-17 14:39:00 UTC (rev 3423)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 1999 - 2010 CodeLutin
+ * Copyright (C) 1999 - 2011 Ifremer, CodeLutin, 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
@@ -24,6 +24,11 @@
*/
/**
* Entité metier d'IsisFish.
+ *
+ * Les {@code toString()} des entités doivent rester simple car ils sont
+ * utilisé comme nom par default lors de la mise en facteur.
+ *
+ * Pour le reste dans les UIs, utilisez des renderers specifiques.
*/
package fr.ifremer.isisfish.entities;
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx 2011-06-17 14:23:45 UTC (rev 3422)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx 2011-06-17 14:39:00 UTC (rev 3423)
@@ -110,6 +110,7 @@
<cell columns='2' fill='horizontal' weightx='1.0'>
<JComboBox id="fieldStrategyMonthInfoTripType"
onActionPerformed='getStrategyMonthInfo().setTripType((TripType)fieldStrategyMonthInfoTripType.getSelectedItem())'
+ renderer='{new fr.ifremer.isisfish.ui.input.renderer.TripTypeListRenderer(true)}'
enabled='{isActive()}' decorator='boxed'/>
</cell>
</row>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/renderer/TripTypeListRenderer.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/renderer/TripTypeListRenderer.java 2011-06-17 14:23:45 UTC (rev 3422)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/renderer/TripTypeListRenderer.java 2011-06-17 14:39:00 UTC (rev 3423)
@@ -47,6 +47,17 @@
/** serialVersionUID. */
private static final long serialVersionUID = 1113492654780402245L;
+ /** Append trip type details. */
+ protected boolean appendDetails;
+
+ public TripTypeListRenderer() {
+ this(false);
+ }
+
+ public TripTypeListRenderer(boolean appendDetails) {
+ this.appendDetails = appendDetails;
+ }
+
/*
* @see javax.swing.ListCellRenderer#getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean)
*/
@@ -60,7 +71,12 @@
index, isSelected, cellHasFocus);
TripType tripType = (TripType) value;
- c.setText(tripType.getName());
+ if (appendDetails) {
+ c.setText(tripType.getName() + "(" + tripType.getTripDuration() + ":"
+ + tripType.getMinTimeBetweenTrip() + ")");
+ } else {
+ c.setText(tripType.getName());
+ }
return c;
}
1
0
r3422 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity
by chatellier@users.labs.libre-entreprise.org 17 Jun '11
by chatellier@users.labs.libre-entreprise.org 17 Jun '11
17 Jun '11
Author: chatellier
Date: 2011-06-17 14:23:45 +0000 (Fri, 17 Jun 2011)
New Revision: 3422
Log:
Fix la mise en facteur des elements de type "TimeUnit"
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityInputHandler.java
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityInputHandler.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityInputHandler.java 2011-06-17 13:57:16 UTC (rev 3421)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityInputHandler.java 2011-06-17 14:23:45 UTC (rev 3422)
@@ -72,6 +72,7 @@
import fr.ifremer.isisfish.simulator.sensitivity.domain.MatrixContinuousDomain;
import fr.ifremer.isisfish.simulator.sensitivity.domain.RuleDiscreteDomain;
import fr.ifremer.isisfish.types.RangeOfValues;
+import fr.ifremer.isisfish.types.TimeUnit;
import fr.ifremer.isisfish.ui.SimulationUI;
import fr.ifremer.isisfish.ui.input.InputAction;
import fr.ifremer.isisfish.ui.input.InputContentUI;
@@ -587,6 +588,8 @@
if (rangeOfValues.getType().equals("Float")) {
result = true;
}
+ } else if (value instanceof TimeUnit) {
+ result = true;
} else if (value instanceof String) {
// todo fix string value :(
result = true;
@@ -658,6 +661,12 @@
MatrixContinuousPanelUI matrixPanel = new MatrixContinuousPanelUI();
matrixPanel.init(matrix.clone(), matrix.clone(), matrix.clone(), null);
result = matrixPanel;
+ } else if (value instanceof TimeUnit) {
+ TimeUnit timeUnit = (TimeUnit)value;
+ DefaultContinuousPanelUI ui = new DefaultContinuousPanelUI();
+ ui.init(String.valueOf(timeUnit.getTime()), String.valueOf(timeUnit.getTime()),
+ String.valueOf(timeUnit.getTime()), null);
+ result = ui;
} else {
DefaultContinuousPanelUI ui = new DefaultContinuousPanelUI();
ui.init(String.valueOf(value), String.valueOf(value), String.valueOf(value), null);
@@ -830,6 +839,10 @@
}
// TODO path with no # (normalement pas possible pour les equations)
}
+ else if (value instanceof TimeUnit) {
+ result = new JTextField();
+ ((JTextField)result).setText(String.valueOf(((TimeUnit)value).getTime()));
+ }
else if (value instanceof String) {
// valeur nom typées ???
result = new JTextField();
@@ -877,6 +890,9 @@
} else if (value instanceof RangeOfValues) {
RangeOfValues rangeOfValues = (RangeOfValues)value;
result = new JTextField(rangeOfValues.getValues());
+ } else if (value instanceof TimeUnit) {
+ TimeUnit timeUnit = (TimeUnit)value;
+ result = new JTextField(String.valueOf(timeUnit.getTime()));
} else if (value instanceof Equation) {
Equation equation = (Equation)value;
// fill component
1
0
Author: chatellier
Date: 2011-06-17 13:57:16 +0000 (Fri, 17 Jun 2011)
New Revision: 3421
Log:
Update changelog
Modified:
isis-fish/trunk/changelog.txt
Modified: isis-fish/trunk/changelog.txt
===================================================================
--- isis-fish/trunk/changelog.txt 2011-06-17 13:55:14 UTC (rev 3420)
+++ isis-fish/trunk/changelog.txt 2011-06-17 13:57:16 UTC (rev 3421)
@@ -1,5 +1,6 @@
isis-fish (3.4.0.0) test; urgency=low
+ * Sensitivity calculator parameters are not lost anymore
* Add new community repository with commit access for users
* Remove maturity group unique constraints
* Add view to test R configuration
@@ -12,8 +13,8 @@
* Modify parameters interface to prepare factorizable values (population/rule)
* Factor, DesignPlan, Scenario and Domain are no longer generics
* Use new Jaxx tree api
- * Update i18n to 2.3.1
- * Update to topia 2.5.3
+ * Update i18n to 2.4
+ * Update to topia 2.6
* Update to Jaxx 2.4
* Update to rSyntaxTextArea 1.5.0
* Update to svnkit 1.3.5
1
0
r3420 - in isis-fish/trunk/src/main/java/fr/ifremer/isisfish: datastore export rule simulator ui/sensitivity util
by chatellier@users.labs.libre-entreprise.org 17 Jun '11
by chatellier@users.labs.libre-entreprise.org 17 Jun '11
17 Jun '11
Author: chatellier
Date: 2011-06-17 13:55:14 +0000 (Fri, 17 Jun 2011)
New Revision: 3420
Log:
Storage parameters storing/reloading refactored.
SensitivityCalculator parameters are not lost anymore ;)
Added:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/StorageHelper.java
Removed:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/DocHelper.java
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/AnalysePlanStorage.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/ExportStorage.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/JavaSourceStorage.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/RuleStorage.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/ScriptStorage.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SensitivityExportStorage.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SensitivityStorage.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/export/ExportHelper.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/rule/RuleHelper.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameterImpl.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/Doc.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/Docable.java
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/AnalysePlanStorage.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/AnalysePlanStorage.java 2011-06-17 12:13:36 UTC (rev 3419)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/AnalysePlanStorage.java 2011-06-17 13:55:14 UTC (rev 3420)
@@ -25,26 +25,22 @@
package fr.ifremer.isisfish.datastore;
-import fr.ifremer.isisfish.IsisFishException;
-import fr.ifremer.isisfish.IsisFish;
-import fr.ifremer.isisfish.simulator.AnalysePlan;
-import fr.ifremer.isisfish.util.Doc;
-import fr.ifremer.isisfish.util.DocHelper;
-import fr.ifremer.isisfish.util.Docable;
-import fr.ifremer.isisfish.vcs.VCSException;
-
import static org.nuiton.i18n.I18n._;
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+
import org.apache.commons.collections.map.ReferenceMap;
-import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import java.io.File;
-import java.lang.reflect.Field;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
+import fr.ifremer.isisfish.IsisFish;
+import fr.ifremer.isisfish.IsisFishException;
+import fr.ifremer.isisfish.simulator.AnalysePlan;
+import fr.ifremer.isisfish.util.Doc;
+import fr.ifremer.isisfish.util.Docable;
+import fr.ifremer.isisfish.vcs.VCSException;
/**
* Class permettant de representer un plan d'analyse.
@@ -60,7 +56,7 @@
*
* Last update: $Date$ by : $Author$
*/
-public class AnalysePlanStorage extends JavaSourceStorage implements Docable { // AnalysePlanStorage
+public class AnalysePlanStorage extends JavaSourceStorage { // AnalysePlanStorage
/** to use log facility, just put in your code: log.info(\"...\"); */
private static Log log = LogFactory.getLog(AnalysePlanStorage.class);
@@ -163,129 +159,6 @@
return (AnalysePlan) result;
}
- /**
- * Permet de recuperer les parametres du plan.
- *
- * @return Une map contenant le nom du parametre et son type
- * @throws IsisFishException s'il est impossible de retourner une map
- * convenable
- */
- public Map<String, Class<?>> getParameterNames() throws IsisFishException {
- Map<String, Class<?>> result = null;
- // On essai de recuperer les paramètres depuis la classe compilé
- // si c possible
- try {
- if (0 == compile(false, null)) {
- AnalysePlan plan = getNewAnalysePlanInstance();
- result = AnalysePlanStorage.getParameterNames(plan);
- }
- } catch (Exception eee) {
- log.info(_("isisfish.error.plan.parameter"), eee);
- }
- // si on ne reussi pas avec la classe compilé on essai en parsant le
- // source
- if (result == null) {
- try {
- //String code = getContent();
- log.fatal("FIXME a faire recherche des parametre dans le source");
- throw new IsisFishException(_("isisfish.error.source.parameter"));
- // TODO implanter la recherche des parametres.
- // Se sont les attributs commencant par 'param_' et ils doivent
- // etre public non static, non transient.
- // ex: public Date param_Date.
- // Lorsqu'on ajoute un champs dans la map il ne faut pas mettre
- // le prefix param.
- } catch (Exception eee) {
- throw new IsisFishException(_("isisfish.error.source.parameter"), eee);
- }
- }
- return result;
- }
-
-
- /**
- * Recherche par introspection tous les parametres de la classe
- * commencant par param_
- *
- * @param plan le plan dont on souhaite les infos de parametre
- * @return retourne le nom et le type des parametres du plan
- */
- public static Map<String, Class<?>> getParameterNames(AnalysePlan plan) {
- Map<String, Class<?>> result = new LinkedHashMap<String, Class<?>>();
- for (Field field : plan.getClass().getFields()) {
- if (field.getName().startsWith(PARAM_PREFIX)) {
- result.put(field.getName().substring(PARAM_PREFIX.length()),
- field.getType());
- }
- }
- return result;
- }
-
- /**
- * Donne la valeur d'un parametre par introspection
- *
- * @param name le nom du parametre
- * @param plan le plan dont on souhaite la valeur du parametre
- * @return la valeur courante du parametre
- * @throws IsisFishException s'il y a un probleme pour recuperer la valeur
- */
- static public Object getParameterValue(AnalysePlan plan, String name) throws IsisFishException {
- if (plan == null || name == null || "".equals(name)) {
- return null;
- }
- try {
- String fieldName = PARAM_PREFIX + name;
- Field field = plan.getClass().getDeclaredField(fieldName);
- return field.get(plan);
- } catch (IllegalAccessException eee) {
- throw new IsisFishException("Can't get plan parameter: " + name, eee);
- } catch (NoSuchFieldException eee) {
- throw new IsisFishException("Can't get plan parameter: " + name, eee);
- }
- }
-
- /**
- * Modifie la valeur d'un attribut pas introspection
- *
- * @param name le nom de l'attribut
- * @param value la valeur de l'attribut
- * @param plan le plan dont on souhaite modifier la valeur de parametre
- * @throws IsisFishException s'il y a un probleme
- */
- static public void setParameterValue(AnalysePlan plan, String name, Object value) throws IsisFishException {
- try {
- String fieldName = PARAM_PREFIX + name;
- Field field = plan.getClass().getDeclaredField(fieldName);
- field.set(plan, value);
- } catch (IllegalAccessException eee) {
- throw new IsisFishException("Can't modify plan parameter: " + name + " with '" + value + "'(" + ObjectUtils.identityToString(value) + ")", eee);
- } catch (NoSuchFieldException eee) {
- throw new IsisFishException("Can't modify plan parameter: " + name + " with '" + value + "'(" + ObjectUtils.identityToString(value) + ")", eee);
- } catch (IllegalArgumentException eee) {
- throw new IsisFishException("Can't modify plan parameter: " + name + " with '" + value + "'(" + ObjectUtils.identityToString(value) + ")", eee);
- }
- }
-
- /**
- * Recupere les parametres et leur valeur pour les retourner sous forme
- * de chaine. Pour pouvoir par exemple les afficher a l'utilisateur
- *
- * @param plan le plan dont on souhaite la valeur du parametre en string
- * @return la valeur sous forme de string
- * @throws IsisFishException
- */
- public static String getParamAsString(AnalysePlan plan) throws IsisFishException {
- StringBuffer result = new StringBuffer();
-
- for (String name : getParameterNames(plan).keySet()) {
- Object value = getParameterValue(plan, name);
-
- result.append(name).append(" : ").append(value);
- result.append("\n");
- }
- return result.toString();
- }
-
static public void checkout() throws VCSException {
checkout(IsisFish.config.getDatabaseDirectory(), ANALYSE_PLAN_PATH);
}
@@ -329,51 +202,6 @@
}
/**
- * @return the @Doc of the underlied AnalysePlan class
- * @see DocHelper
- * @see Doc
- * @see Docable
- */
- public Doc getClassDoc() {
- Doc result = null;
- try {
- Class<?> klazz = getCodeClass();
- result = DocHelper.getClassDoc(klazz);
- } catch (IsisFishException e) {
- log.warn(_("isisfish.error.not.found.code", this));
- }
- return result;
- }
-
- /**
- * @param fieldName name of the field to inspect
- * @return the @Doc of the given field of the underlied AnalysePlan class
- * @see DocHelper
- * @see Doc
- * @see Docable
- */
- public Doc getFieldDoc(String fieldName) {
- Doc result = null;
- try {
- Class<?> klazz = getCodeClass();
- result = DocHelper.getFieldDoc(klazz, fieldName);
- } catch (Exception e) {
- log.warn(_("isisfish.error.not.found.field", fieldName, this));
- }
- return result;
- }
-
- /**
- * @param paramName the name of the param to inspect
- * @return the doc associated with the param,
- * (says the field PARAM_PREFIX+fieldName)
- */
- public Doc getParamDoc(String paramName) {
- Doc doc = getFieldDoc(PARAM_PREFIX + paramName);
- return doc;
- }
-
- /**
* <b>Be ware this method require to instanciate a AnalysePlan, so
* it would be better to call as often as possible.</b>
*
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/ExportStorage.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/ExportStorage.java 2011-06-17 12:13:36 UTC (rev 3419)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/ExportStorage.java 2011-06-17 13:55:14 UTC (rev 3420)
@@ -28,13 +28,10 @@
import static org.nuiton.i18n.I18n._;
import java.io.File;
-import java.lang.reflect.Field;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections.map.ReferenceMap;
-import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -42,7 +39,6 @@
import fr.ifremer.isisfish.IsisFishException;
import fr.ifremer.isisfish.export.Export;
import fr.ifremer.isisfish.util.Doc;
-import fr.ifremer.isisfish.util.DocHelper;
import fr.ifremer.isisfish.util.Docable;
import fr.ifremer.isisfish.vcs.VCSException;
@@ -58,7 +54,7 @@
* Last update: $Date$
* by : $Author$
*/
-public class ExportStorage extends JavaSourceStorage implements Docable {
+public class ExportStorage extends JavaSourceStorage {
/** Class logger. */
private static Log log = LogFactory.getLog(ExportStorage.class);
@@ -165,41 +161,6 @@
}
/**
- * @return the @Doc of the underlied rule class
- * @see DocHelper
- * @see Doc
- * @see Docable
- */
- public Doc getClassDoc() {
- Doc result = null;
- try {
- Class<?> klazz = getCodeClass();
- result = DocHelper.getClassDoc(klazz);
- } catch (IsisFishException e) {
- log.warn(_("isisfish.error.not.found.code", this));
- }
- return result;
- }
-
- /**
- * @param fieldName name of the field to inspect
- * @return the @Doc of the given field of the underlied Rule class
- * @see DocHelper
- * @see Doc
- * @see Docable
- */
- public Doc getFieldDoc(String fieldName) {
- Doc result=null;
- try {
- Class<?> klazz = getCodeClass();
- result = DocHelper.getFieldDoc(klazz,fieldName);
- } catch (Exception e) {
- log.warn(_("isisfish.error.not.found.field",fieldName,this));
- }
- return result;
- }
-
- /**
* <b>Be ware this method require to instanciate a Export, so
* it would be better to call as often as possible.</b>
*
@@ -219,124 +180,4 @@
}
return result;
}
-
- /**
- * @param paramName the name of the param to inspect
- * @return the doc associated with the param,
- * (says the field PARAM_PREFIX+fieldName)
- */
- public Doc getParamDoc(String paramName) {
- Doc doc;
- doc = getFieldDoc(PARAM_PREFIX + paramName);
- return doc;
- }
-
- /**
- * Permet de recuperer les parametres de l'export.
- *
- * @return Une map contenant le nom du parametre et son type
- * @throws IsisFishException s'il est impossible de retourner une map
- * convenable
- */
- public Map<String, Class<?>> getParameterNames() throws IsisFishException {
- Map<String, Class<?>> result = null;
- // On essai de recuperer les paramètres depuis la classe compilé
- // si c possible
- try {
- if (0 == compile(false, null)) {
- Export export = getNewExportInstance();
- result = ExportStorage.getParameterNames(export);
- }
- } catch (Exception eee) {
- log.info(_("isisfish.error.compiled.parameter"), eee);
- }
- // si on ne reussi pas avec la classe compilé on essai en parsant le
- // source
- if (result == null) {
- try {
- //String code = getContent();
- log.fatal("FIXME a faire recherche des parametre dans le source");
- throw new IsisFishException(_("isisfish.error.source.parameter"));
- // TODO implanter la recherche des parametres.
- // Se sont les attributs commencant par 'param_' et ils doivent
- // etre public non static, non transient.
- // ex: public Date param_Date.
- // Lorsqu'on ajoute un champs dans la map il ne faut pas mettre
- // le prefix param.
- } catch (Exception eee) {
- throw new IsisFishException(_("isisfish.error.source.parameter"), eee);
- }
- }
- return result;
- }
-
- /**
- * Recherche par introspection tous les parametres de la classe
- * commencant par {@link #PARAM_PREFIX}.
- *
- * @param export the export to inspect
- * @return the list of parameters for a given export
- */
- public static Map<String, Class<?>> getParameterNames(Export export) {
- Map<String, Class<?>> result = new LinkedHashMap<String, Class<?>>();
- for (Field field : export.getClass().getFields()) {
- if (field.getName().startsWith(PARAM_PREFIX)) {
- result.put(field.getName().substring(PARAM_PREFIX.length()),
- field.getType());
- }
- }
- return result;
- }
-
- /**
- * Donne la valeur d'un parametre par introspection.
- *
- * @param name le nom du parametre
- * @param export the export to inspect
- * @return la valeur courante du parametre
- * @throws IsisFishException if any exception
- */
- public static Object getParameterValue(Export export, String name) throws IsisFishException {
- if (export == null || name == null || "".equals(name)) {
- return null;
- }
- try {
- String fieldName = PARAM_PREFIX + name;
- Field field = export.getClass().getDeclaredField(fieldName);
- return field.get(export);
- } catch (IllegalAccessException eee) {
- throw new IsisFishException("Can't get rule parameter: " + name, eee);
- } catch (NoSuchFieldException eee) {
- throw new IsisFishException("Can't get rule parameter: " + name, eee);
- }
- }
-
- /**
- * Modifie la valeur d'un attribut par introspection.
- *
- * @param name le nom de l'attribut
- * @param value la valeur de l'attribut
- * @param export the export to inspect
- * @throws IsisFishException if any exception
- */
- public static void setParameterValue(Export export, String name,
- Object value) throws IsisFishException {
- try {
- String fieldName = PARAM_PREFIX + name;
- Field field = export.getClass().getDeclaredField(fieldName);
- field.set(export, value);
- } catch (IllegalAccessException eee) {
- throw new IsisFishException("Can't modify export parameter: "
- + name + " with '" + value + "'("
- + ObjectUtils.identityToString(value) + ")", eee);
- } catch (NoSuchFieldException eee) {
- throw new IsisFishException("Can't modify export parameter: "
- + name + " with '" + value + "'("
- + ObjectUtils.identityToString(value) + ")", eee);
- } catch (IllegalArgumentException eee) {
- throw new IsisFishException("Can't modify export parameter: "
- + name + " with '" + value + "'("
- + ObjectUtils.identityToString(value) + ")", eee);
- }
- }
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/JavaSourceStorage.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/JavaSourceStorage.java 2011-06-17 12:13:36 UTC (rev 3419)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/JavaSourceStorage.java 2011-06-17 13:55:14 UTC (rev 3420)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
+ * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, 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
@@ -29,14 +29,21 @@
import java.io.File;
import java.io.PrintWriter;
+import java.lang.reflect.Field;
+import java.util.LinkedHashMap;
+import java.util.Map;
import org.apache.commons.lang.ClassUtils;
+import org.apache.commons.lang.ObjectUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import fr.ifremer.isisfish.IsisFish;
import fr.ifremer.isisfish.IsisFishException;
+import fr.ifremer.isisfish.rule.Rule;
import fr.ifremer.isisfish.util.CompileHelper;
import fr.ifremer.isisfish.util.Doc;
-import fr.ifremer.isisfish.util.DocHelper;
+import fr.ifremer.isisfish.util.Docable;
import fr.ifremer.isisfish.util.JavadocHelper;
/**
@@ -56,8 +63,12 @@
*
* Last update: $Date$ by : $Author$
*/
-public abstract class JavaSourceStorage extends CodeSourceStorage {
+public abstract class JavaSourceStorage extends CodeSourceStorage implements Docable {
+ /** Class logger. */
+ private static Log log = LogFactory.getLog(ExportStorage.class);
+
+ /** Le prefix de tous les attributs java manipulable par Isis. */
protected static final String PARAM_PREFIX = "param_";
/**
@@ -171,7 +182,13 @@
}
return result;
}
-
+
+ protected static Doc getFieldDoc(Class klass, String paramName) throws SecurityException, NoSuchFieldException {
+ Field f = klass == null ? null : klass.getField(paramName);
+ Doc result = f == null ? null : f.getAnnotation(Doc.class);
+ return result;
+ }
+
/**
* Get doc of parameter.
*
@@ -180,7 +197,166 @@
* @return {@link Doc} annotation
*/
public static Doc getParameterDoc(Object object, String paramName) {
- Doc result = DocHelper.getFieldDoc(object.getClass(), PARAM_PREFIX + paramName);
+ Doc result = null;
+ try {
+ result = getFieldDoc(object.getClass(), PARAM_PREFIX + paramName);
+ } catch (Exception e) {
+ log.warn(_("isisfish.error.not.found.field", paramName, object));
+ }
return result;
}
+
+ /**
+ * @param paramName the name of the param to inspect
+ * @return the doc associated with the param,
+ * (says the field PARAM_PREFIX+fieldName)
+ */
+ public Doc getFieldDoc(String paramName) {
+ Doc result = null;
+ try {
+ Class<?> clazz = getCodeClass();
+ result = getFieldDoc(clazz, PARAM_PREFIX + paramName);
+ } catch (Exception e) {
+ log.warn(_("isisfish.error.not.found.field", paramName, this));
+ }
+ return result;
+ }
+
+ /**
+ * Get docable element description.
+ */
+ @Override
+ public String getDescription() {
+ return null;
+ }
+
+ /**
+ * Permet de recuperer les parametres de l'export.
+ *
+ * @return Une map contenant le nom du parametre et son type
+ * @throws IsisFishException s'il est impossible de retourner une map
+ * convenable
+ */
+ public Map<String, Class<?>> getParameterNames() throws IsisFishException {
+ Map<String, Class<?>> result = null;
+ // On essai de recuperer les paramètres depuis la classe compilé
+ // si c possible
+ try {
+ if (0 == compile(false, null)) {
+ Object instance = getNewInstance();
+ result = getParameterNames(instance);
+ }
+ } catch (Exception eee) {
+ log.info(_("isisfish.error.compiled.parameter"), eee);
+ }
+ // si on ne reussi pas avec la classe compilé on essai en parsant le
+ // source
+ if (result == null) {
+ try {
+ //String code = getContent();
+ log.fatal("FIXME a faire recherche des parametre dans le source");
+ throw new IsisFishException(_("isisfish.error.source.parameter"));
+ // TODO implanter la recherche des parametres.
+ // Se sont les attributs commencant par 'param_' et ils doivent
+ // etre public non static, non transient.
+ // ex: public Date param_Date.
+ // Lorsqu'on ajoute un champs dans la map il ne faut pas mettre
+ // le prefix param.
+ } catch (Exception eee) {
+ throw new IsisFishException(_("isisfish.error.source.parameter"), eee);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Recherche par introspection tous les parametres de la classe
+ * commencant par {@link #PARAM_PREFIX}.
+ *
+ * @param instance the instance to inspect
+ * @return the list of parameters for a given export
+ */
+ public static Map<String, Class<?>> getParameterNames(Object instance) {
+ Map<String, Class<?>> result = new LinkedHashMap<String, Class<?>>();
+ for (Field field : instance.getClass().getFields()) {
+ if (field.getName().startsWith(PARAM_PREFIX)) {
+ result.put(field.getName().substring(PARAM_PREFIX.length()),
+ field.getType());
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Donne la valeur d'un parametre par introspection.
+ *
+ * @param name le nom du parametre
+ * @param instance the instance to inspect
+ * @return la valeur courante du parametre
+ * @throws IsisFishException if any exception
+ */
+ public static Object getParameterValue(Object instance, String name) throws IsisFishException {
+ if (instance == null || name == null || "".equals(name)) {
+ return null;
+ }
+ try {
+ String fieldName = PARAM_PREFIX + name;
+ Field field = instance.getClass().getDeclaredField(fieldName);
+ return field.get(instance);
+ } catch (IllegalAccessException eee) {
+ throw new IsisFishException("Can't get rule parameter: " + name, eee);
+ } catch (NoSuchFieldException eee) {
+ throw new IsisFishException("Can't get rule parameter: " + name, eee);
+ }
+ }
+
+ /**
+ * Modifie la valeur d'un attribut par introspection.
+ *
+ * @param name le nom de l'attribut
+ * @param value la valeur de l'attribut
+ * @param instance the instance to inspect
+ * @throws IsisFishException if any exception
+ */
+ public static void setParameterValue(Object instance, String name,
+ Object value) throws IsisFishException {
+ try {
+ String fieldName = PARAM_PREFIX + name;
+ Field field = instance.getClass().getDeclaredField(fieldName);
+ field.set(instance, value);
+ } catch (IllegalAccessException eee) {
+ throw new IsisFishException("Can't modify export parameter: "
+ + name + " with '" + value + "'("
+ + ObjectUtils.identityToString(value) + ")", eee);
+ } catch (NoSuchFieldException eee) {
+ throw new IsisFishException("Can't modify export parameter: "
+ + name + " with '" + value + "'("
+ + ObjectUtils.identityToString(value) + ")", eee);
+ } catch (IllegalArgumentException eee) {
+ throw new IsisFishException("Can't modify export parameter: "
+ + name + " with '" + value + "'("
+ + ObjectUtils.identityToString(value) + ")", eee);
+ }
+ }
+
+ /**
+ * Recupere les parametres et leur valeur pour les retourner sous forme
+ * de chaine. Pour pouvoir par exemple les afficher a l'utilisateur.
+ *
+ * @param instance the instance to inspect
+ * @return a string representation of parameters and their values for
+ * a given rule
+ * @throws IsisFishException if any exception
+ */
+ public static String getParamAsString(Object instance) throws IsisFishException {
+ StringBuffer result = new StringBuffer();
+
+ for (String name : getParameterNames(instance).keySet()) {
+ Object value = getParameterValue(instance, name);
+
+ result.append(name).append(" : ").append(value);
+ result.append("\n");
+ }
+ return result.toString();
+ }
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/RuleStorage.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/RuleStorage.java 2011-06-17 12:13:36 UTC (rev 3419)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/RuleStorage.java 2011-06-17 13:55:14 UTC (rev 3420)
@@ -25,26 +25,22 @@
package fr.ifremer.isisfish.datastore;
-import fr.ifremer.isisfish.IsisFishException;
-import fr.ifremer.isisfish.IsisFish;
-import fr.ifremer.isisfish.util.Doc;
-import fr.ifremer.isisfish.util.DocHelper;
-import fr.ifremer.isisfish.util.Docable;
-import fr.ifremer.isisfish.rule.Rule;
-import fr.ifremer.isisfish.vcs.VCSException;
-
import static org.nuiton.i18n.I18n._;
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+
import org.apache.commons.collections.map.ReferenceMap;
-import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import java.io.File;
-import java.lang.reflect.Field;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
+import fr.ifremer.isisfish.IsisFish;
+import fr.ifremer.isisfish.IsisFishException;
+import fr.ifremer.isisfish.rule.Rule;
+import fr.ifremer.isisfish.util.Doc;
+import fr.ifremer.isisfish.util.Docable;
+import fr.ifremer.isisfish.vcs.VCSException;
/**
* Class permettant de representer une regle de gestion.
@@ -166,130 +162,6 @@
return (Rule) result;
}
- /**
- * Permet de recuperer les parametres de la regle.
- *
- * @return Une map contenant le nom du parametre et son type
- * @throws IsisFishException s'il est impossible de retourner une map
- * convenable
- */
- public Map<String, Class<?>> getParameterNames() throws IsisFishException {
- Map<String, Class<?>> result = null;
- // On essai de recuperer les paramètres depuis la classe compilé
- // si c possible
- try {
- if (0 == compile(false, null)) {
- Rule rule = getNewRuleInstance();
- result = RuleStorage.getParameterNames(rule);
- }
- } catch (Exception eee) {
- log.info(_("isisfish.error.compiled.parameter"), eee);
- }
- // si on ne reussi pas avec la classe compilé on essai en parsant le
- // source
- if (result == null) {
- try {
- //String code = getContent();
- log.fatal("FIXME a faire recherche des parametre dans le source");
- throw new IsisFishException(_("isisfish.error.source.parameter"));
- // TODO implanter la recherche des parametres.
- // Se sont les attributs commencant par 'param_' et ils doivent
- // etre public non static, non transient.
- // ex: public Date param_Date.
- // Lorsqu'on ajoute un champs dans la map il ne faut pas mettre
- // le prefix param.
- } catch (Exception eee) {
- throw new IsisFishException(_("isisfish.error.source.parameter"), eee);
- }
- }
- return result;
- }
-
-
- /**
- * Recherche par introspection tous les parametres de la classe
- * commencant par param_
- *
- * @param rule the rule to inspect
- * @return the list of parameters for a given rule
- */
- static public Map<String, Class<?>> getParameterNames(Rule rule) {
- Map<String, Class<?>> result = new LinkedHashMap<String, Class<?>>();
- for (Field field : rule.getClass().getFields()) {
- if (field.getName().startsWith(PARAM_PREFIX)) {
- result.put(field.getName().substring(PARAM_PREFIX.length()),
- field.getType());
- }
- }
- return result;
- }
-
- /**
- * Donne la valeur d'un parametre par introspection
- *
- * @param name le nom du parametre
- * @param rule the rule to inspect
- * @return la valeur courante du parametre
- * @throws IsisFishException if any exception
- */
- static public Object getParameterValue(Rule rule, String name) throws IsisFishException {
- if (rule == null || name == null || "".equals(name)) {
- return null;
- }
- try {
- String fieldName = PARAM_PREFIX + name;
- Field field = rule.getClass().getDeclaredField(fieldName);
- return field.get(rule);
- } catch (IllegalAccessException eee) {
- throw new IsisFishException("Can't get rule parameter: " + name, eee);
- } catch (NoSuchFieldException eee) {
- throw new IsisFishException("Can't get rule parameter: " + name, eee);
- }
- }
-
- /**
- * Modifie la valeur d'un attribut par introspection.
- *
- * @param name le nom de l'attribut
- * @param value la valeur de l'attribut
- * @param rule the rule to inspect
- * @throws IsisFishException if any exception
- */
- static public void setParameterValue(Rule rule, String name, Object value) throws IsisFishException {
- try {
- String fieldName = PARAM_PREFIX + name;
- Field field = rule.getClass().getDeclaredField(fieldName);
- field.set(rule, value);
- } catch (IllegalAccessException eee) {
- throw new IsisFishException("Can't modify rule parameter: " + name + " with '" + value + "'(" + ObjectUtils.identityToString(value) + ")", eee);
- } catch (NoSuchFieldException eee) {
- throw new IsisFishException("Can't modify rule parameter: " + name + " with '" + value + "'(" + ObjectUtils.identityToString(value) + ")", eee);
- } catch (IllegalArgumentException eee) {
- throw new IsisFishException("Can't modify rule parameter: " + name + " with '" + value + "'(" + ObjectUtils.identityToString(value) + ")", eee);
- }
- }
-
- /**
- * Recupere les parametres et leur valeur pour les retourner sous forme
- * de chaine. Pour pouvoir par exemple les afficher a l'utilisateur.
- *
- * @param rule the rule to inspect
- * @return a string representation of parameters and their values for
- * a given rule
- * @throws IsisFishException if any exception
- */
- public static String getParamAsString(Rule rule) throws IsisFishException {
- StringBuffer result = new StringBuffer();
-
- for (String name : getParameterNames(rule).keySet()) {
- Object value = getParameterValue(rule, name);
-
- result.append(name).append(" : ").append(value);
- result.append("\n");
- }
- return result.toString();
- }
-
static public void checkout() throws VCSException {
checkout(IsisFish.config.getDatabaseDirectory(), RULE_PATH);
}
@@ -332,52 +204,6 @@
}
/**
- * @return the @Doc of the underlied rule class
- * @see DocHelper
- * @see Doc
- * @see Docable
- */
- public Doc getClassDoc() {
- Doc result=null;
- try {
- Class klazz = getCodeClass();
- result = DocHelper.getClassDoc(klazz);
- } catch (IsisFishException e) {
- log.warn(_("isisfish.error.not.found.code",this));
- }
- return result;
- }
-
- /**
- * @param fieldName name of the field to inspect
- * @return the @Doc of the given field of the underlied Rule class
- * @see DocHelper
- * @see Doc
- * @see Docable
- */
- public Doc getFieldDoc(String fieldName) {
- Doc result=null;
- try {
- Class klazz = getCodeClass();
- result = DocHelper.getFieldDoc(klazz,fieldName);
- } catch (Exception e) {
- log.warn(_("isisfish.error.not.found.field",fieldName,this));
- }
- return result;
- }
-
- /**
- * @param paramName the name of the param to inspect
- * @return the doc associated with the param,
- * (says the field PARAM_PREFIX+fieldName)
- */
- public Doc getParamDoc(String paramName) {
- Doc doc;
- doc = getFieldDoc(PARAM_PREFIX + paramName);
- return doc;
- }
-
- /**
* <b>Be ware this method require to instanciate a Rule, so
* it would be better to call as often as possible.</b>
*
@@ -386,10 +212,10 @@
* @see Docable
*/
public String getDescription() {
- String result=null;
+ String result = null;
try {
Rule rule = getNewRuleInstance();
- result =rule == null ? null : rule.getDescription();
+ result = rule == null ? null : rule.getDescription();
} catch (Exception e) {
log.warn(_("isisfish.error.not.found.description",this));
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/ScriptStorage.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/ScriptStorage.java 2011-06-17 12:13:36 UTC (rev 3419)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/ScriptStorage.java 2011-06-17 13:55:14 UTC (rev 3420)
@@ -25,24 +25,16 @@
package fr.ifremer.isisfish.datastore;
-import fr.ifremer.isisfish.IsisFishException;
-import fr.ifremer.isisfish.IsisFishRuntimeException;
-import fr.ifremer.isisfish.IsisFish;
-import fr.ifremer.isisfish.util.DocHelper;
-import fr.ifremer.isisfish.util.Doc;
-import fr.ifremer.isisfish.util.Docable;
-import fr.ifremer.isisfish.vcs.VCSException;
-
-import static org.nuiton.i18n.I18n._;
-
-import org.apache.commons.collections.map.ReferenceMap;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import java.io.File;
import java.util.List;
import java.util.Map;
+import org.apache.commons.collections.map.ReferenceMap;
+
+import fr.ifremer.isisfish.IsisFish;
+import fr.ifremer.isisfish.IsisFishException;
+import fr.ifremer.isisfish.vcs.VCSException;
+
/**
* Gestion des fichers CVS de type scripts (appartenant au module scripts).
*
@@ -54,11 +46,8 @@
* Last update: $Date$
* by : $Author$
*/
-public class ScriptStorage extends JavaSourceStorage implements Docable {
+public class ScriptStorage extends JavaSourceStorage {
- /** to use log facility, just put in your code: log.info(\"...\"); */
- private static Log log = LogFactory.getLog(ScriptStorage.class);
-
public static final String SCRIPT_PATH = "scripts";
/** Template freemarker pour les scripts. */
@@ -197,52 +186,4 @@
result.removeAll(getScriptNames());
return result;
}
-
- /**
- * @return the @Doc of the underlied rule class
- * @see DocHelper
- * @see Doc
- * @see Docable
- */
- public Doc getClassDoc() {
- Doc result=null;
- try {
- Class<?> klazz = getCodeClass();
- result = DocHelper.getClassDoc(klazz);
- } catch (IsisFishException e) {
- log.warn(_("isisfish.error.not.found.code",this));
- }
- return result;
- }
-
- /**
- * @param fieldName name of the field to inspect
- * @return the @Doc of the given field of the underlied Rule class
- * @see DocHelper
- * @see Doc
- * @see Docable
- */
- public Doc getFieldDoc(String fieldName) {
- Doc result=null;
- try {
- Class<?> klazz = getCodeClass();
- result = DocHelper.getFieldDoc(klazz,fieldName);
- } catch (Exception e) {
- log.warn(_("isisfish.error.not.found.field",fieldName,this));
- }
- return result;
- }
-
-
- /**
- * <b>Be ware this method require to instanciate a Rule, so
- * it would be better to call as often as possible.</b>
- *
- * @return the descript of the instanciate AnalysePlan
- * @see Doc
- * @see Docable
- */
- public String getDescription() {
- throw new IsisFishRuntimeException(_("isisfish.error.not.support.class",this));
- }
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SensitivityExportStorage.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SensitivityExportStorage.java 2011-06-17 12:13:36 UTC (rev 3419)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SensitivityExportStorage.java 2011-06-17 13:55:14 UTC (rev 3420)
@@ -53,9 +53,6 @@
*/
public class SensitivityExportStorage extends ExportStorage implements Docable {
- /** Class logger. */
- private static Log log = LogFactory.getLog(SensitivityExportStorage.class);
-
public static final String SENSITIVITY_EXPORT_PATH = "sensitivityexports";
/** Template freemarker pour les scripts d'export . */
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SensitivityStorage.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SensitivityStorage.java 2011-06-17 12:13:36 UTC (rev 3419)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SensitivityStorage.java 2011-06-17 13:55:14 UTC (rev 3420)
@@ -25,26 +25,22 @@
package fr.ifremer.isisfish.datastore;
-import fr.ifremer.isisfish.IsisFishException;
-import fr.ifremer.isisfish.IsisFish;
-import fr.ifremer.isisfish.simulator.sensitivity.SensitivityCalculator;
-import fr.ifremer.isisfish.util.Doc;
-import fr.ifremer.isisfish.util.DocHelper;
-import fr.ifremer.isisfish.util.Docable;
-import fr.ifremer.isisfish.vcs.VCSException;
-
import static org.nuiton.i18n.I18n._;
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+
import org.apache.commons.collections.map.ReferenceMap;
-import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import java.io.File;
-import java.lang.reflect.Field;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
+import fr.ifremer.isisfish.IsisFish;
+import fr.ifremer.isisfish.IsisFishException;
+import fr.ifremer.isisfish.simulator.sensitivity.SensitivityCalculator;
+import fr.ifremer.isisfish.util.Doc;
+import fr.ifremer.isisfish.util.Docable;
+import fr.ifremer.isisfish.vcs.VCSException;
/**
* Cette class permet de stocker les fichiers de calculateur de sensibilité.
@@ -57,7 +53,7 @@
* @version $Revision$
* Last update: $Date$ by : $Author$
*/
-public class SensitivityStorage extends JavaSourceStorage implements Docable { // SensitivityStorage
+public class SensitivityStorage extends JavaSourceStorage { // SensitivityStorage
/** to use log facility, just put in your code: log.info(\"...\"); */
private static Log log = LogFactory.getLog(SensitivityStorage.class);
@@ -161,144 +157,6 @@
}
/**
- * Permet de recuperer les parametres du calculateur.
- *
- * @return Une map contenant le nom du parametre et son type
- * @throws IsisFishException s'il est impossible de retourner une map
- * convenable
- */
- public Map<String, Class<?>> getParameterNames() throws IsisFishException {
- Map<String, Class<?>> result = null;
- // On essai de recuperer les paramètres depuis la classe compilé
- // si c possible
- try {
- if (0 == compile(false, null)) {
- SensitivityCalculator calculator = getNewSensitivityInstance();
- result = SensitivityStorage.getParameterNames(calculator);
- }
- } catch (Exception eee) {
- if (log.isErrorEnabled()) {
- log.error(_("isisfish.error.source.parameter"), eee);
- }
- }
- // si on ne reussi pas avec la classe compilé on essai en parsant le
- // source
- if (result == null) {
- try {
- //String code = getContent();
- log.fatal("FIXME a faire recherche des parametres dans le source");
- throw new IsisFishException(
- _("isisfish.error.source.parameter"));
- // TODO implanter la recherche des parametres.
- // Se sont les attributs commencant par 'param_' et ils doivent
- // etre public non static, non transient.
- // ex: public Date param_Date.
- // Lorsqu'on ajoute un champs dans la map il ne faut pas mettre
- // le prefix param.
- } catch (Exception eee) {
- throw new IsisFishException(
- _("isisfish.error.source.parameter"), eee);
- }
- }
- return result;
- }
-
- /**
- * Recherche par introspection tous les parametres de la classe
- * commencant par {@link #PARAM_PREFIX}.
- *
- * @param calculator le calculateur dont on souhaite les infos de parametre
- * @return retourne le nom et le type des parametres du calculateur
- */
- public static Map<String, Class<?>> getParameterNames(
- SensitivityCalculator calculator) {
- Map<String, Class<?>> result = new LinkedHashMap<String, Class<?>>();
- for (Field field : calculator.getClass().getFields()) {
- if (field.getName().startsWith(PARAM_PREFIX)) {
- result.put(field.getName().substring(PARAM_PREFIX.length()),
- field.getType());
- }
- }
- return result;
- }
-
- /**
- * Donne la valeur d'un parametre par introspection.
- *
- * @param name le nom du parametre
- * @param calculator le calculateur dont on souhaite la valeur du parametre
- * @return la valeur courante du parametre
- * @throws IsisFishException s'il y a un probleme pour recuperer la valeur
- */
- public static Object getParameterValue(SensitivityCalculator calculator,
- String name) throws IsisFishException {
- if (calculator == null || name == null || "".equals(name)) {
- return null;
- }
- try {
- String fieldName = PARAM_PREFIX + name;
- Field field = calculator.getClass().getDeclaredField(fieldName);
- return field.get(calculator);
- } catch (IllegalAccessException eee) {
- throw new IsisFishException("Can't get plan parameter: " + name,
- eee);
- } catch (NoSuchFieldException eee) {
- throw new IsisFishException("Can't get plan parameter: " + name,
- eee);
- }
- }
-
- /**
- * Modifie la valeur d'un attribut pas introspection.
- *
- * @param name le nom de l'attribut
- * @param value la valeur de l'attribut
- * @param calculator le calculator dont on souhaite modifier la valeur de parametre
- * @throws IsisFishException s'il y a un probleme
- */
- public static void setParameterValue(SensitivityCalculator calculator,
- String name, Object value) throws IsisFishException {
- try {
- String fieldName = PARAM_PREFIX + name;
- Field field = calculator.getClass().getDeclaredField(fieldName);
- field.set(calculator, value);
- } catch (IllegalAccessException eee) {
- throw new IsisFishException("Can't modify plan parameter: " + name
- + " with '" + value + "'("
- + ObjectUtils.identityToString(value) + ")", eee);
- } catch (NoSuchFieldException eee) {
- throw new IsisFishException("Can't modify plan parameter: " + name
- + " with '" + value + "'("
- + ObjectUtils.identityToString(value) + ")", eee);
- } catch (IllegalArgumentException eee) {
- throw new IsisFishException("Can't modify plan parameter: " + name
- + " with '" + value + "'("
- + ObjectUtils.identityToString(value) + ")", eee);
- }
- }
-
- /**
- * Recupere les paramètres et leur valeur pour les retourner sous forme
- * de chaine. Pour pouvoir par exemple les afficher à l'utilisateur.
- *
- * @param calculator le calculateur dont on souhaite la valeur du parametre en string
- * @return la valeur sous forme de string
- * @throws IsisFishException
- */
- public static String getParamAsString(SensitivityCalculator calculator)
- throws IsisFishException {
- StringBuffer result = new StringBuffer();
-
- for (String name : getParameterNames(calculator).keySet()) {
- Object value = getParameterValue(calculator, name);
-
- result.append(name).append(" : ").append(value);
- result.append("\n");
- }
- return result.toString();
- }
-
- /**
* Effectue un chekout VCS sur le répertoire des calculateurs.
*
* @see VersionStorage#checkout(File, String)
@@ -351,54 +209,6 @@
}
/**
- * @return the @Doc of the underlied {@link SensitivityCalculator} class
- * @see DocHelper
- * @see Doc
- * @see Docable
- */
- public Doc getClassDoc() {
- Doc result = null;
- try {
- Class<?> klazz = getCodeClass();
- result = DocHelper.getClassDoc(klazz);
- } catch (IsisFishException e) {
- if (log.isWarnEnabled()) {
- log.warn(_("isisfish.error.not.found.code", this));
- }
- }
- return result;
- }
-
- /**
- * @param fieldName name of the field to inspect
- * @return the @Doc of the given field of the underlied {@link SensitivityCalculator} class
- * @see DocHelper
- * @see Doc
- * @see Docable
- */
- public Doc getFieldDoc(String fieldName) {
- Doc result = null;
- try {
- Class<?> klazz = getCodeClass();
- result = DocHelper.getFieldDoc(klazz, fieldName);
- } catch (Exception e) {
- log.warn(_("isisfish.error.not.found.field", fieldName, this));
- }
- return result;
- }
-
- /**
- * @param paramName the name of the param to inspect
- * @return the doc associated with the param,
- * (says the field {@link #PARAM_PREFIX} + fieldName)
- */
- public Doc getParamDoc(String paramName) {
- Doc doc;
- doc = getFieldDoc(PARAM_PREFIX + paramName);
- return doc;
- }
-
- /**
* <b>Be ware this method require to instanciate a AnalysePlan, so
* it would be better to call as often as possible.</b>
*
@@ -406,6 +216,7 @@
* @see Doc
* @see Docable
*/
+ @Override
public String getDescription() {
String result = null;
try {
Added: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/StorageHelper.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/StorageHelper.java (rev 0)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/StorageHelper.java 2011-06-17 13:55:14 UTC (rev 3420)
@@ -0,0 +1,137 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.isisfish.datastore;
+
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.commons.beanutils.ConvertUtilsBean;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.persistence.TopiaEntity;
+
+import fr.ifremer.isisfish.IsisFishException;
+import fr.ifremer.isisfish.rule.Rule;
+import fr.ifremer.isisfish.util.ConverterUtil;
+
+/**
+ * Helper used to populate and extract instance parameters
+ * from simulation.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class StorageHelper {
+
+ /** Class logger. */
+ private static Log log = LogFactory.getLog(StorageHelper.class);
+
+ /**
+ * Recupere dans prop les valeurs des champs specifique au export et met a
+ * jour les champs de l'export.
+ *
+ * @param instanceIndex l'index de l'instance
+ * @param instance l'instance a mettre à jour
+ * @param context le topia context dont on a besoin
+ * @param props les proprietes contenant les parametre de l'export
+ * @param propPrefix prefix des clés a prendre en compte dans {@code props}
+ */
+ public static void populateStorageParams(int instanceIndex, TopiaContext context,
+ Object instance, Properties props, String propPrefix) {
+ //ConvertUtilsBean beanUtils = ConverterUtil.getConverter(region
+ // .getStorage());
+ String exportName = JavaSourceStorage.getName(instance);
+ String paramTag = propPrefix + "." + instanceIndex + ".parameter.";
+
+ for (Map.Entry<String, Class<?>> entry : JavaSourceStorage.getParameterNames(instance).entrySet()) {
+ String propName = entry.getKey();
+ Class<?> type = entry.getValue();
+ if (TopiaEntity.class.isAssignableFrom(type)) {
+ type = TopiaEntity.class;
+ }
+ String valueString = "not initialized";
+ try {
+ valueString = props.getProperty(paramTag + propName);
+
+ // ATTENTION il semblerait que notre intance de beanUtils
+ // soit ecrasé par celle du MatrixType ...
+ // a ne pas deplacer avant la boucle
+ ConvertUtilsBean beanUtils = ConverterUtil.getConverter(context);
+
+ Object value = beanUtils.convert(valueString, type);
+ if (log.isDebugEnabled()) {
+ log.debug("Set instance param: " + paramTag +
+ propName + " = " + value + "(" + valueString + ")");
+ }
+
+ JavaSourceStorage.setParameterValue(instance, propName, value);
+ } catch (Exception eee) {
+ if (log.isWarnEnabled()) {
+ log.info("Properties: " + props);
+ log.warn("Can't reload field " + propName + " for export "
+ + exportName + " with value " + valueString, eee);
+ }
+ }
+ }
+ }
+
+ /**
+ * Permet de mettre les parametres d'un object Isis sous une forme String pour
+ * pouvoir les relire ensuite.
+ *
+ * @param instanceIndex l'index de la rule
+ * @param context le context
+ * @param instance La regle dont on souhaite mettre les parametres dans l'objet
+ * Properties retourne
+ * @param propPrefix prefix des clés a prendre en compte dans {@code props}
+ * @return L'objet Properties contenant les valeurs des parametres de l'instance
+ */
+ public static Properties getParamsAsProperties(int instanceIndex, TopiaContext context,
+ Object instance, String propPrefix) {
+ Properties result = new Properties();
+ ConvertUtilsBean beanUtils = ConverterUtil.getConverter(context);
+ for (String paramName : RuleStorage.getParameterNames(instance).keySet()) {
+ String paramValueString;
+ try {
+ Object value = RuleStorage.getParameterValue(instance, paramName);
+ paramValueString = beanUtils.convert(value);
+ if (paramValueString != null) {
+ result.setProperty(propPrefix + "." + instanceIndex + ".parameter." + paramName, paramValueString);
+ }
+ } catch (IsisFishException eee) {
+ if (log.isWarnEnabled()) {
+ log.warn("Can't convert parameter value to String: " + paramName, eee);
+ }
+ }
+ }
+
+ return result;
+ }
+}
Property changes on: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/StorageHelper.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/export/ExportHelper.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/export/ExportHelper.java 2011-06-17 12:13:36 UTC (rev 3419)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/export/ExportHelper.java 2011-06-17 13:55:14 UTC (rev 3420)
@@ -30,7 +30,6 @@
import java.io.FileWriter;
import java.io.Writer;
import java.util.List;
-import java.util.Map;
import java.util.Properties;
import org.apache.commons.beanutils.ConvertUtilsBean;
@@ -38,11 +37,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.persistence.TopiaEntity;
+import fr.ifremer.isisfish.IsisFishException;
import fr.ifremer.isisfish.datastore.ExportStorage;
import fr.ifremer.isisfish.datastore.SensitivityExportStorage;
import fr.ifremer.isisfish.datastore.SimulationStorage;
+import fr.ifremer.isisfish.datastore.StorageHelper;
import fr.ifremer.isisfish.util.ConverterUtil;
/**
@@ -56,7 +56,7 @@
* Last update: $Date$
* by : $Author$
*/
-public class ExportHelper {
+public class ExportHelper extends StorageHelper {
/** Class logger. */
private static Log log = LogFactory.getLog(ExportHelper.class);
@@ -135,41 +135,21 @@
*/
public static void populateSensitivityExport(int exportIndex, TopiaContext context,
SensitivityExport export, Properties props) {
- //ConvertUtilsBean beanUtils = ConverterUtil.getConverter(region
- // .getStorage());
- String exportName = SensitivityExportStorage.getName(export);
- String paramTag = "sensitivityexport." + exportIndex + ".parameter.";
-
- for (Map.Entry<String, Class<?>> entry : SensitivityExportStorage
- .getParameterNames(export).entrySet()) {
- String propName = entry.getKey();
- Class<?> type = entry.getValue();
- if (TopiaEntity.class.isAssignableFrom(type)) {
- type = TopiaEntity.class;
- }
- String valueString = "not initialized";
- try {
- valueString = props.getProperty(paramTag + propName);
-
- // ATTENTION il semblerait que notre intance de beanUtils
- // soit ecrasé par celle du MatrixType ...
- // a ne pas deplacer avant la boucle
- ConvertUtilsBean beanUtils = ConverterUtil.getConverter(context);
-
- Object value = beanUtils.convert(valueString, type);
- if (log.isDebugEnabled()) {
- log.debug("Set sensitivityexport param: " + paramTag +
- propName + " = " + value + "(" + valueString + ")");
- }
-
- SensitivityExportStorage.setParameterValue(export, propName, value);
- } catch (Exception eee) {
- if (log.isWarnEnabled()) {
- log.info("Properties: " + props);
- log.warn("Can't reload field " + propName + " for export "
- + exportName + " with value " + valueString, eee);
- }
- }
- }
+ populateStorageParams(exportIndex, context, export, props, "sensitivityexport");
}
+
+ /**
+ * Permet de mettre les parametres de l'export sous une forme String pour
+ * pouvoir les relire ensuite.
+ *
+ * @param sensitivityExportIndex l'index de l'export
+ * @param context le topia context dont on a besoin
+ * @param sensitivityExport l'export dont on souhaite mettre les parametres dans l'objet
+ * Properties retourné
+ * @return L'objet Properties contenant les valeurs des parametres de l'export
+ */
+ public static Properties getSensitivityExportAsProperties(
+ int sensitivityExportIndex, TopiaContext context, SensitivityExport sensitivityExport) {
+ return getParamsAsProperties(sensitivityExportIndex, context, sensitivityExport, "sensitivityexport");
+ }
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/rule/RuleHelper.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/rule/RuleHelper.java 2011-06-17 12:13:36 UTC (rev 3419)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/rule/RuleHelper.java 2011-06-17 13:55:14 UTC (rev 3420)
@@ -25,19 +25,14 @@
package fr.ifremer.isisfish.rule;
-import java.util.Map;
import java.util.Properties;
-import org.apache.commons.beanutils.ConvertUtilsBean;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.persistence.TopiaEntity;
-import fr.ifremer.isisfish.IsisFishException;
import fr.ifremer.isisfish.datastore.RegionStorage;
-import fr.ifremer.isisfish.datastore.RuleStorage;
-import fr.ifremer.isisfish.util.ConverterUtil;
+import fr.ifremer.isisfish.datastore.StorageHelper;
/**
* Helper pour effectuer des manipulations sur les règles.
@@ -55,7 +50,7 @@
* Last update: $Date$
* by : $Author$
*/
-public class RuleHelper {
+public class RuleHelper extends StorageHelper {
/** Logger for this class. */
private static final Log log = LogFactory.getLog(RuleHelper.class);
@@ -88,41 +83,7 @@
* @param props les propriétés contenant les paramètres de la règle
*/
public static void populateRule(int ruleIndex, TopiaContext context, Rule rule, Properties props) {
- String ruleName = RuleStorage.getName(rule);
- String paramTag = "rule." + ruleIndex + ".parameter.";
-
- for (Map.Entry<String, Class<?>> entry : RuleStorage.getParameterNames(rule).entrySet()) {
- String propName = entry.getKey();
- Class<?> type = entry.getValue();
- if (TopiaEntity.class.isAssignableFrom(type)) {
- type = TopiaEntity.class;
- }
- String valueString = "not initialized";
- try {
- valueString = props.getProperty(paramTag + propName);
-
- if (log.isDebugEnabled()) {
- log.debug("About to convert rule param: " + paramTag + propName + " = " + valueString);
- }
-
- // ATTENTION il semblerait que notre intance de beanUtils
- // soit ecrasé par celle du MatrixType ...
- // a ne pas deplacer avant la boucle
- ConvertUtilsBean beanUtils = ConverterUtil
- .getConverter(context);
- Object value = beanUtils.convert(valueString, type);
-
- if (log.isDebugEnabled()) {
- log.debug("Set rule param: " + paramTag + propName + " = " + value + "(" + valueString + ")");
- }
- RuleStorage.setParameterValue(rule, propName, value);
- } catch (Exception eee) {
- if (log.isWarnEnabled()) {
- log.info("Properties: " + props);
- log.warn("Can't reload field " + propName + " for rule " + ruleName + " with value " + valueString, eee);
- }
- }
- }
+ populateStorageParams(ruleIndex, context, rule, props, "rule");
}
/**
@@ -137,23 +98,6 @@
* regle
*/
public static Properties getRuleAsProperties(int ruleIndex, TopiaContext context, Rule rule) {
- Properties result = new Properties();
- ConvertUtilsBean beanUtils = ConverterUtil.getConverter(context);
- for (String paramName : RuleStorage.getParameterNames(rule).keySet()) {
- String paramValueString;
- try {
- Object value = RuleStorage.getParameterValue(rule, paramName);
- paramValueString = beanUtils.convert(value);
- if (paramValueString != null) {
- result.setProperty("rule." + ruleIndex + ".parameter." + paramName, paramValueString);
- }
- } catch (IsisFishException eee) {
- if (log.isWarnEnabled()) {
- log.warn("Can't convert parameter value to String: " + paramName, eee);
- }
- }
- }
-
- return result;
+ return getParamsAsProperties(ruleIndex, context, rule, "rule");
}
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameterImpl.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameterImpl.java 2011-06-17 12:13:36 UTC (rev 3419)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameterImpl.java 2011-06-17 13:55:14 UTC (rev 3420)
@@ -60,6 +60,7 @@
import fr.ifremer.isisfish.datastore.RuleStorage;
import fr.ifremer.isisfish.datastore.SensitivityExportStorage;
import fr.ifremer.isisfish.datastore.SensitivityStorage;
+import fr.ifremer.isisfish.datastore.StorageHelper;
import fr.ifremer.isisfish.entities.Population;
import fr.ifremer.isisfish.entities.PopulationDAO;
import fr.ifremer.isisfish.entities.Strategy;
@@ -294,206 +295,6 @@
return result;
}
- /**
- * Permet de mettre les parametres de la regle sous une forme String pour
- * pouvoir les relire ensuite.
- *
- * @param ruleIndex l'index de la rule
- * @param rule La regle dont on souhaite mettre les parametres dans l'objet
- * Properties retourne
- * @return L'objet Properties contenant les valeurs des parametres de la
- * regle
- */
- protected Properties ruleParametertoProperties(int ruleIndex, Rule rule) {
- Properties result = new Properties();
- ConvertUtilsBean beanUtils = ConverterUtil.getConverter(getRegion()
- .getStorage());
- for (String paramName : RuleStorage.getParameterNames(rule).keySet()) {
- String paramValueString;
- try {
- Object value = RuleStorage.getParameterValue(rule, paramName);
- paramValueString = beanUtils.convert(value);
- if (paramValueString != null) {
- result.setProperty("rule." + ruleIndex + ".parameter." + paramName, paramValueString);
- }
- } catch (IsisFishException eee) {
- if (log.isWarnEnabled()) {
- log.warn("Can't convert parameter value to String: " + paramName, eee);
- }
- }
- }
-
- return result;
- }
-
- /**
- * Permet de mettre les parametres de l'export sous une forme String pour
- * pouvoir les relire ensuite.
- *
- * @param sensitivityExportIndex l'index de l'export
- * @param sensitivityExport l'export dont on souhaite mettre les parametres dans l'objet
- * Properties retourné
- * @return L'objet Properties contenant les valeurs des parametres de l'export
- */
- protected Properties sensitivityExportParametertoProperties(
- int sensitivityExportIndex, SensitivityExport sensitivityExport) {
- Properties result = new Properties();
- ConvertUtilsBean beanUtils = ConverterUtil.getConverter(getRegion().getStorage());
- for (String paramName : SensitivityExportStorage.getParameterNames(sensitivityExport).keySet()) {
- try {
- Object value = SensitivityExportStorage.getParameterValue(
- sensitivityExport, paramName);
- String paramValueString = beanUtils.convert(value);
- if (paramValueString != null) {
- result.setProperty("sensitivityexport."
- + sensitivityExportIndex + ".parameter."
- + paramName, paramValueString);
- }
- } catch (IsisFishException eee) {
- if (log.isWarnEnabled()) {
- log.warn("Can't convert parameter value to String: "
- + paramName, eee);
- }
- }
- }
-
- return result;
- }
-
- /**
- * Permet de mettre les parametres du calculateur sous une forme String pour
- * pouvoir les relire ensuite.
- *
- * @param sensitivityIndex l'index du calculateur de sensitivity
- * @param calculator Le calculateurdont on souhaite mettre les parametres dans l'objet
- * Properties retourne
- * @return L'objet Properties contenant les valeurs des parametres du calculateur de sensibilité
- */
- protected Properties sensitivityCalculatorParametertoProperties(
- int sensitivityIndex, SensitivityCalculator calculator) {
- Properties result = new Properties();
- ConvertUtilsBean beanUtils = ConverterUtil.getConverter(getRegion().getStorage());
- for (String paramName : SensitivityStorage.getParameterNames(calculator).keySet()) {
- try {
- Object value = SensitivityStorage.getParameterValue(calculator,
- paramName);
- String paramValueString = beanUtils.convert(value);
- if (paramValueString != null) {
- result.setProperty("sensitivity." + sensitivityIndex + ".parameter." + paramName, paramValueString);
- }
- } catch (IsisFishException eee) {
- if (log.isWarnEnabled()) {
- log.warn("Can't convert parameter value to String: "
- + paramName, eee);
- }
- }
- }
-
- return result;
- }
-
- /**
- * Permet de mettre les parametres du plan sous une forme String pour
- * pouvoir les relire ensuite.
- *
- * @param planIndex l'index du plan
- * @param plan Le plan dont on souhaite mettre les parametres dans l'objet
- * Properties retourne
- * @return L'objet Properties contenant les valeurs des parametres du plan
- */
- protected Properties planParametertoProperties(int planIndex,
- AnalysePlan plan) {
- Properties result = new Properties();
- ConvertUtilsBean beanUtils = ConverterUtil.getConverter(getRegion().getStorage());
- for (String paramName : AnalysePlanStorage.getParameterNames(plan).keySet()) {
- try {
- Object value = AnalysePlanStorage.getParameterValue(plan,paramName);
- String paramValueString = beanUtils.convert(value);
- if (paramValueString != null) {
- result.setProperty("plan." + planIndex + ".parameter."
- + paramName, paramValueString);
- }
- } catch (IsisFishException eee) {
- if (log.isWarnEnabled()) {
- log.warn("Can't convert parametre value to String: "
- + paramName, eee);
- }
- }
- }
-
- return result;
- }
-
- /**
- * Recupere dans prop les valeurs des champs specifique au plan et met a
- * jour les champs du plan.
- *
- * @param planIndex l'index du plan
- * @param plan le plan dont les parametres doivent etre lu depuis les
- * proprietes
- * @param props les proprietes contenant les parametre du plan
- */
- protected void populateAnalysePlan(int planIndex, AnalysePlan plan,
- Properties props) {
- ConvertUtilsBean beanUtils = ConverterUtil.getConverter(getRegion()
- .getStorage());
- String planName = AnalysePlanStorage.getName(plan);
- String paramTag = "plan." + planIndex + ".parameter.";
-
- for (Map.Entry<String, Class<?>> entry : AnalysePlanStorage.getParameterNames(plan).entrySet()) {
- String propName = entry.getKey();
- Class<?> type = entry.getValue();
- if (TopiaEntity.class.isAssignableFrom(type)) {
- type = TopiaEntity.class;
- }
- String valueString = props.getProperty(paramTag + propName);
- Object value = beanUtils.convert(valueString, type);
- try {
- AnalysePlanStorage.setParameterValue(plan, propName, value);
- } catch (IsisFishException eee) {
- if (log.isWarnEnabled()) {
- log.warn("Can't reload field " + propName + " for plan "
- + planName, eee);
- }
- }
- }
- }
-
- /**
- * Recupere dans prop les valeurs des champs specifique au calculateur de
- * sensibilité et met a jour les champs du calculateur.
- *
- * @param calculatorIndex l'index du calculateur
- * @param calculator le calculateur dont les parametres doivent etre lu depuis lesproprietes
- * @param props les proprietes contenant les parametre du calculateur
- */
- protected void populateSensitivityCalculator(int calculatorIndex,
- SensitivityCalculator calculator, Properties props) {
- ConvertUtilsBean beanUtils = ConverterUtil.getConverter(getRegion()
- .getStorage());
- String calculatorName = SensitivityStorage.getName(calculator);
- String paramTag = "sensitivity." + calculatorIndex + ".parameter.";
-
- for (Map.Entry<String, Class<?>> entry : SensitivityStorage.getParameterNames(calculator).entrySet()) {
- String propName = entry.getKey();
- Class<?> type = entry.getValue();
- if (TopiaEntity.class.isAssignableFrom(type)) {
- type = TopiaEntity.class;
- }
- String valueString = props.getProperty(paramTag + propName);
- Object value = beanUtils.convert(valueString, type);
- try {
- SensitivityStorage.setParameterValue(calculator, propName, value);
- } catch (IsisFishException eee) {
- if (log.isWarnEnabled()) {
- log.warn("Can't reload field " + propName
- + " for sensitivity calculator " + calculatorName,
- eee);
- }
- }
- }
- }
-
/*
* @see fr.ifremer.isisfish.simulator.SimulationParameter#getExtraRules()
*/
@@ -692,7 +493,8 @@
AnalysePlan plan = AnalysePlanStorage
.getAnalysePlan(name)
.getNewAnalysePlanInstance();
- populateAnalysePlan(planIndex++, plan, propertiesParameters);
+ StorageHelper.populateStorageParams(planIndex++,
+ getRegion().getStorage(), plan, propertiesParameters, "plan");
analysePlans.add(plan);
} catch (IsisFishException eee) {
if (log.isWarnEnabled()) {
@@ -955,7 +757,8 @@
SensitivityStorage sensitivityStorage = SensitivityStorage.getSensitivity(calculatorName);
sensitivityCalculator = sensitivityStorage.getNewSensitivityInstance();
// 0 = only single sensitivity
- populateSensitivityCalculator(0, sensitivityCalculator, propertiesParameters);
+ StorageHelper.populateStorageParams(0, getRegion().getStorage(), sensitivityCalculator,
+ propertiesParameters, "sensitivity");
} catch (IsisFishException eee) {
sensitivityCalculator = null;
if (log.isWarnEnabled()) {
@@ -1700,7 +1503,7 @@
int ruleIndex = 0;
for (Rule rule : getRules()) {
ruleList += RuleStorage.getName(rule) + ",";
- Properties ruleProp = ruleParametertoProperties(ruleIndex++, rule);
+ Properties ruleProp = RuleHelper.getRuleAsProperties(ruleIndex++, getRegion().getStorage(), rule);
result.putAll(ruleProp);
}
result.setProperty("rules", ruleList);
@@ -1724,7 +1527,8 @@
int planIndex = 0;
for (AnalysePlan plan : getAnalysePlans()) {
planList += AnalysePlanStorage.getName(plan) + ",";
- Properties planProp = planParametertoProperties(planIndex++, plan);
+ Properties planProp = StorageHelper.getParamsAsProperties(planIndex++,
+ getRegion().getStorage(), plan, "plan");
result.putAll(planProp);
}
result.setProperty("plans", planList);
@@ -1760,8 +1564,8 @@
result.setProperty("sensitivitycalculator", calculatorName);
// calculator parameter
- Properties calculatorParams = sensitivityCalculatorParametertoProperties(
- 0, getSensitivityCalculator());
+ Properties calculatorParams = StorageHelper.getParamsAsProperties(0,
+ getRegion().getStorage(), getSensitivityCalculator(), "sensitivity");
result.putAll(calculatorParams);
} else {
if (propertiesParameters != null
@@ -1783,8 +1587,8 @@
for (SensitivityExport sensitivityExport : getSensitivityExport()) {
sensitivityExportList += SensitivityExportStorage
.getName(sensitivityExport) + ",";
- Properties exportProp = sensitivityExportParametertoProperties(
- sensitivityExportIndex++, sensitivityExport);
+ Properties exportProp = ExportHelper.getSensitivityExportAsProperties(
+ sensitivityExportIndex++, getRegion().getStorage(), sensitivityExport);
result.putAll(exportProp);
}
result.setProperty("sensitivityexports", sensitivityExportList);
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx 2011-06-17 12:13:36 UTC (rev 3419)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx 2011-06-17 13:55:14 UTC (rev 3420)
@@ -83,22 +83,23 @@
}
protected void sensCalculatorChanged() {
-
- // TODO change combo box content
+
+ String sensitivityName = (String)fieldSensitivityCalculatorSelect.getSelectedItem();
+
// when calculator is changed by refreshSelectedSensitivityCalculator
// this event is thrown by build a new Calculator instance
// and parameter are lost
+ // fix it with a small class name test
+ SensitivityCalculator sensivitityCalculator = getSimulAction().getSensitivityCalculator();
+ if (sensivitityCalculator != null && sensivitityCalculator.getClass().getSimpleName().equals(sensitivityName)) {
+ sensivitityCalculator = getSimulAction().getSensitivityCalculator();
+ } else {
+ sensivitityCalculator = getSimulAction().getSensivitityCalculatorInstance(sensitivityName);
+ }
- String sensitivityName = (String)fieldSensitivityCalculatorSelect.getSelectedItem();
- SensitivityCalculator sensivitityCalculator = getSimulAction().getSensivitityCalculatorInstance(sensitivityName);
-
// can be null for example if calculator can't be compiled
if (sensivitityCalculator != null) {
getSimulAction().setSensitivityCalculator(sensivitityCalculator);
-
- // enable/disable table (if sensivitityCalculator can manage it)
- //factorCardinalityScrollPane.setVisible(!sensivitityCalculator.canManageCardinality());
- //validate();
CardLayout factorPanelLayout = (CardLayout)factorCardinalityPanel.getLayout();
if (sensivitityCalculator.canManageCardinality()) {
@@ -106,10 +107,8 @@
} else {
factorPanelLayout.show(factorCardinalityPanel, "factorCardinalityNotSupported");
}
-
// update model
- //setSensitivityCalculatorParamsModel();
SensitivityCalculatorParametersTableModel parametersTableModel = new SensitivityCalculatorParametersTableModel(sensivitityCalculator);
simulSensitivityCalculatorParam.setModel(parametersTableModel);
simulSensitivityCalculatorParam.getColumnModel().getColumn(0).setCellRenderer(new SensitivityCalculatorParametersTableCellRenderer(sensivitityCalculator));
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/Doc.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/Doc.java 2011-06-17 12:13:36 UTC (rev 3419)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/Doc.java 2011-06-17 13:55:14 UTC (rev 3420)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
+ * Copyright (C) 2009 - 2011 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
Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/DocHelper.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/DocHelper.java 2011-06-17 12:13:36 UTC (rev 3419)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/DocHelper.java 2011-06-17 13:55:14 UTC (rev 3420)
@@ -1,140 +0,0 @@
-/*
- * #%L
- * IsisFish
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2007 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
- * %%
- * 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 fr.ifremer.isisfish.util;
-
-import static org.nuiton.i18n.I18n._;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.lang.reflect.Field;
-
-/**
- * Class containing usefull methods to obtain @Doc informations
- * for a class,field,method...
- *
- * @author chemit
- * @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
- */
-public class DocHelper {
-
- /** Logger for this class */
- private static final Log log = LogFactory.getLog(DocHelper.class);
-
- /**
- * @param klazz class to use
- * @return the @Doc associated with the class of null if klazz is null or
- * there is no Doc for this klazz
- */
- public static Doc getClassDoc(Class<?> klazz) {
- return klazz == null ? null : klazz.getAnnotation(Doc.class);
- }
-
- /**
- * @param value object given
- * @return the @Doc associated to the class of the given object, or null if value is
- * null or no doc found for his class
- *
- * @deprecated as of 20090408 never used
- */
- public static Doc getClassDoc(Object value) {
- return value == null ? null : getClassDoc(value.getClass());
- }
-
- /**
- * @param f file to use
- * @return the @Doc associated to the field, or null
- * if field is null of no @doc found
- *
- * @deprecated as of 20090408 never used
- */
- public static Doc getFieldDoc(Field f) {
- return f == null ? null : f.getAnnotation(Doc.class);
- }
-
- /**
- * @param klazz class to use
- * @param fieldName field name to use
- * @return the @Doc associated with e filed of the given class,
- * or null if class is null, field does not exist, or no
- * Doc for the field
- */
- public static Doc getFieldDoc(Class<?> klazz, String fieldName) {
- Field f = null;
- try {
- f = klazz == null ? null : klazz.getField(fieldName);
- } catch (NoSuchFieldException e) {
- // should never appear
- log.warn(_("isisfish.error.not.found.field.class", fieldName,
- klazz));
- //throw new IsisFishRuntimeException(e);
- }
- return f == null ? null : f.getAnnotation(Doc.class);
- }
-
- /**
- * @param doc doc to use
- * @return the {@link Doc#value()} of the given @Doc
- *
- * @deprecated as of 20090408 never used
- */
- public static String getValue(Doc doc) {
- return doc == null ? "" : doc.value();
- }
-
- /**
- * @param doc doc to use
- * @return the {@link Doc#author()}} of the given @Doc
- *
- * @deprecated as of 20090408 never used
- */
- public static String getAuthor(Doc doc) {
- return doc == null ? "" : doc.author();
- }
-
- /**
- * @param doc doc to use
- * @return the {@link Doc#date()} of the given @Doc
- *
- * @deprecated as of 20090408 never used
- */
- public static String getDate(Doc doc) {
- return doc == null ? "" : doc.date();
- }
-
- /**
- * @param doc doc to use
- * @return the {@link Doc#version()} of the given @Doc
- *
- * @deprecated as of 20090408 never used
- */
- public static String getVersion(Doc doc) {
- return doc == null ? "" : doc.version();
- }
-}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/Docable.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/Docable.java 2011-06-17 12:13:36 UTC (rev 3419)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/Docable.java 2011-06-17 13:55:14 UTC (rev 3420)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
+ * Copyright (C) 2009 - 2011 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
@@ -30,7 +30,6 @@
*
* @author chemit
* @see Doc
- * @see DocHelper
* @version $Revision$
*
* Last update : $Date$
@@ -39,13 +38,6 @@
public interface Docable {
/**
- * Class documentation (if any).
- *
- * @return the @Doc of the class, or null if none
- */
- Doc getClassDoc();
-
- /**
* Field documentation (if any).
*
* @param fieldName name of the field to use
1
0