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
April 2009
- 7 participants
- 108 discussions
r2082 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator
by chatellier@users.labs.libre-entreprise.org 07 Apr '09
by chatellier@users.labs.libre-entreprise.org 07 Apr '09
07 Apr '09
Author: chatellier
Date: 2009-04-07 14:24:27 +0000 (Tue, 07 Apr 2009)
New Revision: 2082
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx
Log:
Tooltip here break analyseplan !
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx 2009-04-07 13:14:40 UTC (rev 2081)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx 2009-04-07 14:24:27 UTC (rev 2082)
@@ -42,6 +42,7 @@
import fr.ifremer.isisfish.ui.widget.renderer.SimpleToolTipComboBoxRenderer;
import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
import fr.ifremer.isisfish.simulator.AnalysePlan;
+ import fr.ifremer.isisfish.datastore.AnalysePlanStorage;
import jaxx.runtime.swing.Item;
public SensUI (SimulAction action){
@@ -51,12 +52,12 @@
public void refresh(){
java.util.List<Item> items = new ArrayList<Item>();
java.util.List<AnalysePlan> values = getContextValue(SimulAction.class).getParamAnalysePlans();
-
- for (AnalysePlan ap : values){
- items.add(new Item(ap.toString(), fr.ifremer.isisfish.datastore.AnalysePlanStorage.getName(ap), ap, false));
+ for (AnalysePlan ap : values) {
+ items.add(new Item(ap.toString(), AnalysePlanStorage.getName(ap), ap, false));
}
listSimulParamsAnalysePlansList.setItems(items);
- listSimulParamsAnalysePlansList.setCellRenderer(new SimpleToolTipComboBoxRenderer(ToolTipListModelFactory.createAnalysePlanDescriptionsModel2(values, buttonSimulParamsAnalysePlansClear, listSimulParamsAnalysePlansList)));
+ // Tooltip here break Name display
+ //listSimulParamsAnalysePlansList.setCellRenderer(new SimpleToolTipComboBoxRenderer(ToolTipListModelFactory.createAnalysePlanDescriptionsModel2(values, buttonSimulParamsAnalysePlansClear, listSimulParamsAnalysePlansList)));
setSimulParamsAnalysePlans();
}
public void addAnalysePlan(){
@@ -110,8 +111,8 @@
propertyList.add(properties);
row++;
}
- model.addColumn("Name", valuesList.toArray());
- model.addColumn("Value", propertyList.toArray());
+ model.addColumn(_("isisfish.common.name"), valuesList.toArray());
+ model.addColumn(_("isisfish.common.value"), propertyList.toArray());
simulParamsAnalysePlans.setModel(model);
ParameterColumnEditor cellEditor = new ParameterColumnEditor();
cellEditor.setRegion(getContextValue(SimulAction.class).getRegionStorage());
1
0
r2081 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities
by chatellier@users.labs.libre-entreprise.org 07 Apr '09
by chatellier@users.labs.libre-entreprise.org 07 Apr '09
07 Apr '09
Author: chatellier
Date: 2009-04-07 13:14:40 +0000 (Tue, 07 Apr 2009)
New Revision: 2081
Added:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/package-info.java
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/CellImpl.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/EffortDescriptionImpl.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/EquationImpl.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/FisheryRegionImpl.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/Formule.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/GearImpl.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/MetierImpl.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/MetierSeasonInfoImpl.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/PopulationGroupImpl.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/PopulationImpl.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/PopulationSeasonInfoImpl.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/PortImpl.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/SeasonImpl.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/SelectivityImpl.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/SetOfVesselsImpl.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/SpeciesImpl.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/StrategyImpl.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/StrategyMonthInfoImpl.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/TargetSpeciesImpl.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/TripTypeImpl.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/VesselTypeImpl.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/ZoneImpl.java
Log:
Update entities doc
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/CellImpl.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/CellImpl.java 2009-04-07 13:14:20 UTC (rev 2080)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/CellImpl.java 2009-04-07 13:14:40 UTC (rev 2081)
@@ -1,28 +1,54 @@
+/* *##%
+ * Copyright (C) 2006 - 2009 Ifremer, Code Lutin
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
package fr.ifremer.isisfish.entities;
-import java.io.Serializable;
-
import fr.ifremer.isisfish.IsisFishRuntimeException;
import fr.ifremer.isisfish.datastore.RegionStorage;
import fr.ifremer.isisfish.datastore.StorageException;
/**
* Implantation des operations pour l'entité Cell.
+ *
+ * Created: 19 oct. 06 16:30:35
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
*/
-public class CellImpl extends CellAbstract implements Serializable, Cell {
+public class CellImpl extends CellAbstract {
+ /** serialVersionUID. */
private static final long serialVersionUID = 1L;
public FisheryRegion getFisheryRegion() {
try {
- FisheryRegion result = RegionStorage.getFisheryRegion(getTopiaContext());
+ FisheryRegion result = RegionStorage
+ .getFisheryRegion(getTopiaContext());
return result;
} catch (StorageException eee) {
throw new IsisFishRuntimeException(eee);
}
}
-
- /* (non-Javadoc)
+
+ /*
* @see fr.ifremer.isisfish.entities.CellAbstract#toString()
*/
@Override
@@ -30,5 +56,5 @@
String result = getName();
return result;
}
-
+
} //CellImpl
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/EffortDescriptionImpl.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/EffortDescriptionImpl.java 2009-04-07 13:14:20 UTC (rev 2080)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/EffortDescriptionImpl.java 2009-04-07 13:14:40 UTC (rev 2081)
@@ -1,6 +1,5 @@
/* *##%
- * Copyright (C) 2006
- * Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
+ * Copyright (C) 2006 - 2009 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -17,8 +16,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*##%*/
-/* *
- * EffortDescriptionImpl.java
+package fr.ifremer.isisfish.entities;
+
+import static org.codelutin.i18n.I18n._;
+
+/**
+ * EffortDescriptionImpl.
*
* Created: 19 oct. 06 16:30:35
*
@@ -28,25 +31,18 @@
* Last update: $Date$
* by : $Author$
*/
-
-package fr.ifremer.isisfish.entities;
-
-import static org.codelutin.i18n.I18n._;
-
-/**
- * @author poussin
- */
public class EffortDescriptionImpl extends EffortDescriptionAbstract {
- /* (non-Javadoc)
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 3668146790780517650L;
+
+ /*
* @see fr.ifremer.isisfish.entities.EffortDescriptionAbstract#toString()
*/
@Override
public String toString() {
- String result = _("isisfish.effortDescription.toString", getSetOfVessels(), getPossibleMetiers());
+ String result = _("isisfish.effortDescription.toString",
+ getSetOfVessels(), getPossibleMetiers());
return result;
}
-
}
-
-
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/EquationImpl.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/EquationImpl.java 2009-04-07 13:14:20 UTC (rev 2080)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/EquationImpl.java 2009-04-07 13:14:40 UTC (rev 2081)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2006
+ * Copyright (C) 2006 - 2009
* Code Lutin, Cédric Pineau, Benjamin Poussin
*
* This program is free software; you can redistribute it and/or
@@ -17,112 +17,107 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*##%*/
-/* *
- * EquationImpl.java
- *
- * Created: 20 janv. 2006 03:43:01
- *
- * @author poussin
- * @version $Revision$
- *
- * Last update: $Date$
- * by : $Author$
- */
-
package fr.ifremer.isisfish.entities;
+import static org.codelutin.i18n.I18n._;
+
+import java.util.HashMap;
+import java.util.Map;
+
import bsh.Interpreter;
-import fr.ifremer.isisfish.IsisConfig;
-import fr.ifremer.isisfish.IsisFishException;
import fr.ifremer.isisfish.IsisFishRuntimeException;
import fr.ifremer.isisfish.datastore.FormuleStorage;
import fr.ifremer.isisfish.equation.Language;
import fr.ifremer.isisfish.simulator.SimulationContext;
import fr.ifremer.isisfish.util.EvaluatorHelper;
-import static org.codelutin.i18n.I18n._;
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-
/**
+ * EquationImpl.
+ *
+ * Created: 20 janv. 2006 03:43:01
+ *
* @author poussin
+ * @version $Revision$
*
+ * Last update: $Date$
+ * by : $Author$
*/
+public class EquationImpl extends EquationAbstract {
-public class EquationImpl extends EquationAbstract implements Serializable, Cloneable {
-
- /** */
+ /** serialVersionUID. */
private static final long serialVersionUID = -2195404062556810283L;
/**
- * Evalue l'equation et retourne le résultat
- * @param param
- * @return
- * @throws IsisFishException
+ * Evalue l'equation et retourne le résultat.
+ *
+ * @param param equation args
+ * @return equation evaluation
*/
public double evaluate(Map<String, Object> param) {
String eq = getContent();
try {
// add Simulation context in map
param.put("context", SimulationContext.get());
-
+
// default is BSH
- if (Language.BSH.equals(getLanguage()) ||
- (("".equals(getLanguage()) || getLanguage() == null ) &&
- getJavaInterface() == null)) {
+ if (Language.BSH.equals(getLanguage())
+ || (("".equals(getLanguage()) || getLanguage() == null) && getJavaInterface() == null)) {
Interpreter bsh = new Interpreter();
for (Map.Entry<String, Object> e : param.entrySet()) {
bsh.set(e.getKey(), e.getValue());
}
Object val = bsh.eval(eq);
if (val instanceof Number) {
- double result =((Number)val).doubleValue();
+ double result = ((Number) val).doubleValue();
return result;
} else {
- throw new IsisFishRuntimeException(_("isisfish.error.equation.retun.number", eq));
+ throw new IsisFishRuntimeException(_(
+ "isisfish.error.equation.return.number", eq));
}
- } else // default Java if there are javaInterface
- if (Language.JAVA.equals(getLanguage()) || getJavaInterface() != null) {
- Object val = EvaluatorHelper.evaluate(FormuleStorage.FORMULE_PATH,
- getTopiaId(), getJavaInterface(), getContent(), param);
+ } else if (Language.JAVA.equals(getLanguage())
+ || getJavaInterface() != null) {
+ // default Java if there are javaInterface
+ Object val = EvaluatorHelper.evaluate(
+ FormuleStorage.FORMULE_PATH, getTopiaId(),
+ getJavaInterface(), getContent(), param);
if (val instanceof Number) {
- double result =((Number)val).doubleValue();
+ double result = ((Number) val).doubleValue();
return result;
} else {
- throw new IsisFishRuntimeException(_("isisfish.error.equation.retun.number", eq));
+ throw new IsisFishRuntimeException(_(
+ "isisfish.error.equation.return.number", eq));
}
- } else
+ } else {
// TODO other language support
- {
- throw new IsisFishRuntimeException(_("isisfish.error.unsupported.equation.langage", getLanguage(), eq));
+ throw new IsisFishRuntimeException(_(
+ "isisfish.error.unsupported.equation.langage",
+ getLanguage(), eq));
}
} catch (Exception eee) {
- throw new IsisFishRuntimeException(_("isisfish.error.evaluate.equation", eq), eee);
+ throw new IsisFishRuntimeException(_(
+ "isisfish.error.evaluate.equation", eq), eee);
}
}
-
- public double evaluate(String name, Object value, Object ... others) {
+
+ public double evaluate(String name, Object value, Object... others) {
Map<String, Object> param = new HashMap<String, Object>();
param.put(name, value);
- for (int i=0; i<others.length;) {
- name = (String)others[i++];
+ for (int i = 0; i < others.length;) {
+ name = (String) others[i++];
value = others[i++];
param.put(name, value);
}
double result = evaluate(param);
return result;
}
-
- /* (non-Javadoc)
+
+ /*
* @see fr.ifremer.isisfish.entities.EquationAbstract#toString()
*/
@Override
public String toString() {
- String result = getName() + "("+getCategory()+")";
+ String result = getName() + "(" + getCategory() + ")";
return result;
}
}
-
-
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/FisheryRegionImpl.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/FisheryRegionImpl.java 2009-04-07 13:14:20 UTC (rev 2080)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/FisheryRegionImpl.java 2009-04-07 13:14:40 UTC (rev 2081)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2006
+ * Copyright (C) 2006 - 2009
* Code Lutin, Cédric Pineau, Benjamin Poussin
*
* This program is free software; you can redistribute it and/or
@@ -17,18 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*##%*/
-/* *
- * FisheryRegionImpl.java
- *
- * Created: 3 janv. 2006 17:14:52
- *
- * @author poussin
- * @version $Revision$
- *
- * Last update: $Date$
- * by : $Author$
- */
-
package fr.ifremer.isisfish.entities;
import java.io.File;
@@ -41,15 +29,20 @@
import fr.ifremer.isisfish.IsisFishRuntimeException;
import fr.ifremer.isisfish.datastore.RegionStorage;
-
/**
+ * FisheryRegionImpl.
+ *
+ * Created: 3 janv. 2006 17:14:52
+ *
* @author poussin
+ * @version $Revision$
*
+ * Last update: $Date$
+ * by : $Author$
*/
-
public class FisheryRegionImpl extends FisheryRegionAbstract {
- /** */
+ /** serialVersionUID */
private static final long serialVersionUID = 1L;
/* (non-Javadoc)
@@ -92,12 +85,12 @@
ArrayList<String> result = new ArrayList<String>();
RegionStorage regionStorage = RegionStorage.getRegion(getName());
for (String mapName : mapNames) {
- result.add(regionStorage.getMapRepository().getPath() + File.separator
- + mapName);
+ result.add(regionStorage.getMapRepository().getPath()
+ + File.separator + mapName);
}
return result;
}
-
+
/* (non-Javadoc)
* @see fr.ifremer.isisfish.entities.FisheryRegion#getPort()
*/
@@ -129,7 +122,8 @@
*/
public List<VesselType> getVesselType() {
try {
- VesselTypeDAO dao = IsisFishDAOHelper.getVesselTypeDAO(getTopiaContext());
+ VesselTypeDAO dao = IsisFishDAOHelper
+ .getVesselTypeDAO(getTopiaContext());
List<VesselType> result = dao.findAll();
return result;
} catch (TopiaException eee) {
@@ -168,7 +162,8 @@
*/
public List<SetOfVessels> getSetOfVessels() {
try {
- SetOfVesselsDAO dao = IsisFishDAOHelper.getSetOfVesselsDAO(getTopiaContext());
+ SetOfVesselsDAO dao = IsisFishDAOHelper
+ .getSetOfVesselsDAO(getTopiaContext());
List<SetOfVessels> result = dao.findAll();
return result;
} catch (TopiaException eee) {
@@ -194,7 +189,8 @@
*/
public List<Strategy> getStrategy() {
try {
- StrategyDAO dao = IsisFishDAOHelper.getStrategyDAO(getTopiaContext());
+ StrategyDAO dao = IsisFishDAOHelper
+ .getStrategyDAO(getTopiaContext());
List<Strategy> result = dao.findAll();
return result;
} catch (TopiaException eee) {
@@ -207,7 +203,8 @@
*/
public List<TripType> getTripType() {
try {
- TripTypeDAO dao = IsisFishDAOHelper.getTripTypeDAO(getTopiaContext());
+ TripTypeDAO dao = IsisFishDAOHelper
+ .getTripTypeDAO(getTopiaContext());
List<TripType> result = dao.findAll();
return result;
} catch (TopiaException eee) {
@@ -237,5 +234,3 @@
return result;
}
}
-
-
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/Formule.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/Formule.java 2009-04-07 13:14:20 UTC (rev 2080)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/Formule.java 2009-04-07 13:14:40 UTC (rev 2081)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2006
+ * Copyright (C) 2006 - 2009
* Code Lutin, Cédric Pineau, Benjamin Poussin
*
* This program is free software; you can redistribute it and/or
@@ -17,8 +17,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*##%*/
-/* *
- * Formule.java
+package fr.ifremer.isisfish.entities;
+
+/**
+ * Formule.
*
* Created: 14 févr. 2006 11:32:40
*
@@ -28,19 +30,26 @@
* Last update: $Date$
* by : $Author$
*/
+public interface Formule {
-package fr.ifremer.isisfish.entities;
+ /**
+ * Return formule name.
+ *
+ * @return formule name
+ */
+ String getName();
+ /**
+ * Return formule category name.
+ *
+ * @return formule category name
+ */
+ String getCategory();
-/**
- * @author poussin
- *
- */
-
-public interface Formule {
-
- public String getName();
- public String getCategory();
- public String getContent();
-
+ /**
+ * Return formule content.
+ *
+ * @return formule content
+ */
+ String getContent();
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/GearImpl.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/GearImpl.java 2009-04-07 13:14:20 UTC (rev 2080)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/GearImpl.java 2009-04-07 13:14:40 UTC (rev 2081)
@@ -1,19 +1,45 @@
+/* *##%
+ * Copyright (C) 2006 - 2009
+ * Ifremer, Code Lutin, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
package fr.ifremer.isisfish.entities;
-import java.io.Serializable;
-
import fr.ifremer.isisfish.IsisFishRuntimeException;
import fr.ifremer.isisfish.datastore.RegionStorage;
import fr.ifremer.isisfish.datastore.StorageException;
/**
* Implantation des operations pour l'entité Gear.
+ *
+ * Created: 14 févr. 2006 11:32:40
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
*/
-public class GearImpl extends GearAbstract implements Serializable, Gear {
+public class GearImpl extends GearAbstract {
+ /** serialVersionUID. */
private static final long serialVersionUID = 1L;
+ @Override
public FisheryRegion getFisheryRegion() {
try {
FisheryRegion result = RegionStorage
@@ -24,7 +50,7 @@
}
}
- /* (non-Javadoc)
+ /*
* @see fr.ifremer.isisfish.entities.FisheryRegionAbstract#toString()
*/
@Override
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/MetierImpl.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/MetierImpl.java 2009-04-07 13:14:20 UTC (rev 2080)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/MetierImpl.java 2009-04-07 13:14:40 UTC (rev 2081)
@@ -1,6 +1,24 @@
+/* *##%
+ * Copyright (C) 2006 - 2009
+ * Ifremer, Code Lutin, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
package fr.ifremer.isisfish.entities;
-import java.io.Serializable;
import java.util.Collection;
import fr.ifremer.isisfish.IsisFishRuntimeException;
@@ -10,27 +28,39 @@
/**
* Implantation des operations pour l'entité Metier.
+ *
+ * Created: 14 févr. 2006 11:32:40
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
*/
-public class MetierImpl extends fr.ifremer.isisfish.entities.MetierAbstract implements Serializable, fr.ifremer.isisfish.entities.Metier {
+public class MetierImpl extends MetierAbstract {
+ /** serialVersionUID. */
private static final long serialVersionUID = 1L;
+ @Override
public FisheryRegion getFisheryRegion() {
try {
- FisheryRegion result = RegionStorage.getFisheryRegion(getTopiaContext());
+ FisheryRegion result = RegionStorage
+ .getFisheryRegion(getTopiaContext());
return result;
} catch (StorageException eee) {
throw new IsisFishRuntimeException(eee);
}
}
- /* (non-Javadoc)
+ /*
* @see fr.ifremer.isisfish.entities.Metier#getMetierSeasonInfo(fr.ifremer.isisfish.types.Month)
*/
+ @Override
public MetierSeasonInfo getMetierSeasonInfo(Month month) {
Collection<MetierSeasonInfo> all = getMetierSeasonInfo();
MetierSeasonInfo result = null;
- for(MetierSeasonInfo msi : all) {
+ for (MetierSeasonInfo msi : all) {
if (msi.containsMonth(month)) {
result = msi;
break;
@@ -38,7 +68,8 @@
}
return result;
}
-
+
+ @Override
public double getGearParameterValueAsDouble() {
String val = getGearParameterValue();
double result = 0;
@@ -47,8 +78,8 @@
}
return result;
}
-
- /* (non-Javadoc)
+
+ /*
* @see fr.ifremer.isisfish.entities.MetierAbstract#toString()
*/
@Override
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/MetierSeasonInfoImpl.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/MetierSeasonInfoImpl.java 2009-04-07 13:14:20 UTC (rev 2080)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/MetierSeasonInfoImpl.java 2009-04-07 13:14:40 UTC (rev 2081)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2006
+ * Copyright (C) 2006 - 2009
* Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
*
* This program is free software; you can redistribute it and/or
@@ -17,18 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*##%*/
-/* *
- * MetierSeasonInfoImpl.java
- *
- * Created: 23 août 2006 16:25:40
- *
- * @author poussin
- * @version $Revision$
- *
- * Last update: $Date$
- * by : $Author$
- */
-
package fr.ifremer.isisfish.entities;
import static org.codelutin.i18n.I18n._;
@@ -40,27 +28,36 @@
import org.apache.commons.logging.LogFactory;
/**
+ * MetierSeasonInfoImpl.
+ *
+ * Created: 23 août 2006 16:25:40
+ *
* @author poussin
+ * @version $Revision$
*
+ * Last update: $Date$
+ * by : $Author$
*/
-
public class MetierSeasonInfoImpl extends MetierSeasonInfoAbstract {
- /**
- * Logger for this class
- */
- private static final Log log = LogFactory.getLog(MetierSeasonInfoImpl.class);
-
- /* (non-Javadoc)
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 4554500494092542926L;
+
+ /** Logger for this class. */
+ private static final Log log = LogFactory
+ .getLog(MetierSeasonInfoImpl.class);
+
+ /*
* @see fr.ifremer.isisfish.entities.MetierSeasonInfo#targetFactor(fr.ifremer.isisfish.entities.PopulationGroup)
*/
+ @Override
public double getTargetFactor(PopulationGroup group) {
// Par defaut on retourne 1 si dans les donnes rien n'est
// precisé (20041108: Stef + dom)
double result = 1;
-
- Species species = group.getPopulation().getSpecies();
- TargetSpecies targetSpecies = this.getSpeciesTargetSpecies(species);
+
+ Species species = group.getPopulation().getSpecies();
+ TargetSpecies targetSpecies = this.getSpeciesTargetSpecies(species);
if (targetSpecies != null) {
result = targetSpecies.getTargetFactor(group);
} else {
@@ -71,6 +68,7 @@
return result;
}
+ @Override
public List<Cell> getCells() {
List<Cell> result = new ArrayList<Cell>();
for (Zone zone : getZone()) {
@@ -78,16 +76,15 @@
}
return result;
}
-
- /* (non-Javadoc)
+
+ /*
* @see fr.ifremer.isisfish.entities.FisheryRegionAbstract#toString()
*/
@Override
public String toString() {
- String result = _("isisfish.metierSeasonInfo.toString", this.getMetier(), this.getFirstMonth(), this.getLastMonth());
+ String result = _("isisfish.metierSeasonInfo.toString", this
+ .getMetier(), this.getFirstMonth(), this.getLastMonth());
return result;
- }
+ }
}
-
-
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/PopulationGroupImpl.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/PopulationGroupImpl.java 2009-04-07 13:14:20 UTC (rev 2080)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/PopulationGroupImpl.java 2009-04-07 13:14:40 UTC (rev 2081)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2006
+ * Copyright (C) 2006 - 2009
* Code Lutin, Cédric Pineau, Benjamin Poussin
*
* This program is free software; you can redistribute it and/or
@@ -17,18 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*##%*/
-/* *
- * PopulationGroupImpl.java
- *
- * Created: 3 janv. 2006 15:26:53
- *
- * @author poussin
- * @version $Revision$
- *
- * Last update: $Date$
- * by : $Author$
- */
-
package fr.ifremer.isisfish.entities;
import static org.codelutin.i18n.I18n._;
@@ -38,60 +26,69 @@
import fr.ifremer.isisfish.types.Month;
-
/**
+ * PopulationGroupImpl.
+ *
+ * Created: 3 janv. 2006 15:26:53
+ *
* @author poussin
+ * @version $Revision$
*
+ * Last update: $Date$
+ * by : $Author$
*/
-
public class PopulationGroupImpl extends PopulationGroupAbstract {
- /**
- * Logger for this class
- */
+ /** Logger for this class. */
private static final Log log = LogFactory.getLog(PopulationGroupImpl.class);
- /** */
+ /** serialVersionUID. */
private static final long serialVersionUID = 1L;
- /* (non-Javadoc)
+ /*
* @see fr.ifremer.isisfish.entities.PopulationGroup#getAge()
*/
+ @Override
public double getAge() {
double result = 0;
if (getPopulation() != null && getPopulation().getSpecies() != null) {
if (getPopulation().getSpecies().getAgeGroupType()) {
result = super.getAge();
} else {
- result = getPopulation().getAge(getLength(), this) / Month.NUMBER_OF_MONTH;
+ result = getPopulation().getAge(getLength(), this)
+ / Month.NUMBER_OF_MONTH;
}
}
return result;
}
- /* (non-Javadoc)
+ /*
* @see fr.ifremer.isisfish.entities.PopulationGroup#getLongueurMin()
*/
+ @Override
public double getLength() {
double result = 0;
if (getPopulation() != null && getPopulation().getSpecies() != null) {
- if(!getPopulation().getSpecies().getAgeGroupType()) {
+ if (!getPopulation().getSpecies().getAgeGroupType()) {
result = (getMinLength() + getMaxLength()) / 2.0;
} else {
- result = getPopulation().getLength(getAge() * Month.NUMBER_OF_MONTH, this);
+ result = getPopulation().getLength(
+ getAge() * Month.NUMBER_OF_MONTH, this);
}
}
return result;
}
+ @Override
public boolean isInLength(double length) {
boolean result = getMinLength() <= length && length <= getMaxLength();
return result;
}
-
- /* (non-Javadoc)
+
+ /*
* @see fr.ifremer.isisfish.entities.PopulationGroup#getMeanWeight()
*/
+ @Override
public double getMeanWeight() {
double result = 0;
try {
@@ -108,15 +105,17 @@
return result;
}
- /* (non-Javadoc)
+ /*
* @see fr.ifremer.isisfish.entities.PopulationGroup#getNaturalDeathRate()
*/
+ @Override
public double getNaturalDeathRate(Zone zone) {
double result = 0;
try {
Equation eq = getPopulation().getNaturalDeathRate();
if (eq != null) {
- result = eq.evaluate("pop", this.getPopulation(), "group", this, "zone", zone);
+ result = eq.evaluate("pop", this.getPopulation(), "group",
+ this, "zone", zone);
}
} catch (Exception eee) {
if (log.isWarnEnabled()) {
@@ -129,9 +128,10 @@
return result;
}
- /* (non-Javadoc)
+ /*
* @see fr.ifremer.isisfish.entities.PopulationGroup#getPrice()
*/
+ @Override
public double getPrice() {
double result = 0;
try {
@@ -147,13 +147,12 @@
log.debug("StackTrace", eee);
}
}
- return result;
+ return result;
}
+ @Override
public String toString() {
- return _("isisfish.populationGroup.toString", this.getPopulation(), this.getId());
- }
-
+ return _("isisfish.populationGroup.toString", this.getPopulation(),
+ this.getId());
+ }
}
-
-
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/PopulationImpl.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/PopulationImpl.java 2009-04-07 13:14:20 UTC (rev 2080)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/PopulationImpl.java 2009-04-07 13:14:40 UTC (rev 2081)
@@ -70,7 +70,7 @@
*/
@Override
public void delete() throws TopiaException {
- // chatellier 20090317 fix hibernate exeception
+ // chatellier 20090317 fix hibernate exception
// object will be resaved ...
// FIXME should be fixed on topia maybe ?
this.getSpecies().getPopulation().remove(this);
@@ -337,8 +337,9 @@
}
/**
- * return Matrix [groups x zones] of Natural death rate
- * @return
+ * Return Matrix [groups x zones] of Natural death rate.
+ *
+ * @return a matrix
*/
@Override
public MatrixND getNaturalDeathRateMatrix() {
@@ -399,7 +400,8 @@
}
/**
- * Compute length of group with age
+ * Compute length of group with age.
+ *
* @param age age of group in month
* @param group group
* @return length of group
@@ -468,8 +470,7 @@
MatrixND mat = super.getCapturability();
// check the validity
if (sizePopulationGroup() == 0 || sizePopulationSeasonInfo() == 0) {
- log
- .warn("Population doesn't have population group or population season info");
+ log.warn("Population doesn't have population group or population season info");
return null;
}
List[] sems = new List[] { getPopulationGroup(),
@@ -485,8 +486,7 @@
// matrix when capturability is null instead check validity and
// create new one and paste the old
} else if (!Arrays.equals(mat.getSemantics(), sems)) {
- log
- .debug("Capturability has changed, create new matrix and copy old: "
+ log.debug("Capturability has changed, create new matrix and copy old: "
+ mat.getSemantics() + " " + sems);
MatrixND newmat = MatrixFactory.getInstance().create(
n_("isisfish.population.capturability"),
@@ -507,8 +507,7 @@
@Override
public MatrixND getMappingZoneReproZoneRecru() {
if (sizeReproductionZone() == 0 || sizeRecruitmentZone() == 0) {
- log
- .warn("Population doesn't have zone reproduction or zone recruitment");
+ log.warn("Population doesn't have zone reproduction or zone recruitment");
return null;
}
MatrixND mat = super.getMappingZoneReproZoneRecru();
@@ -535,11 +534,11 @@
}
/**
- * convertie une matrice N 2D en une matrice N 1D strucutre pour les
- * calcules.
- * N2D[classes, zones] --> N1D[classe1(zone1, zone2, ...), classe2(zone1, zone2, ...)]
+ * Convertie une matrice N 2D en une matrice N 1D strucutre pour les calculer.
+ *
+ * N2D[classes, zones] --> N1D[classe1(zone1, zone2, ...), classe2(zone1, zone2, ...)]
*
- * @see #split2D(MatrixND)
+ * @see #split2D(MatrixND)
*/
public MatrixND N2DToN1D(MatrixND N) {
int maxX = N.getDim(0);
@@ -558,7 +557,7 @@
}
/**
- * a partir d'une matrice N structure selon l'ecriture matricielle
+ * A partir d'une matrice N structure selon l'ecriture matricielle
* en classe puis en zone, construit une matrice 2D en Classe(X)
* et en Zone(Y)
*
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/PopulationSeasonInfoImpl.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/PopulationSeasonInfoImpl.java 2009-04-07 13:14:20 UTC (rev 2080)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/PopulationSeasonInfoImpl.java 2009-04-07 13:14:40 UTC (rev 2081)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2006
+ * Copyright (C) 2006 - 2009
* Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
*
* This program is free software; you can redistribute it and/or
@@ -17,18 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*##%*/
-/* *
- * PopulationSeasonInfoImpl.java
- *
- * Created: 18 mars 2006 15:24:56
- *
- * @author poussin
- * @version $Revision$
- *
- * Last update: $Date$
- * by : $Author$
- */
-
package fr.ifremer.isisfish.entities;
import static org.codelutin.i18n.I18n._;
@@ -54,18 +42,26 @@
import fr.ifremer.isisfish.equation.MigrationEquation;
import fr.ifremer.isisfish.types.Month;
-
/**
+ * PopulationSeasonInfoImpl.java
+ *
+ * Created: 18 mars 2006 15:24:56
+ *
* @author poussin
+ * @version $Revision$
*
+ * Last update: $Date$
+ * by : $Author$
*/
-
public class PopulationSeasonInfoImpl extends PopulationSeasonInfoAbstract {
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 1375563617129149755L;
+
/** to use log facility, just put in your code: log.info(\"...\"); */
- static private Log log = LogFactory.getLog(PopulationSeasonInfoImpl.class);
+ private static Log log = LogFactory.getLog(PopulationSeasonInfoImpl.class);
- /* (non-Javadoc)
+ /*
* @see fr.ifremer.isisfish.entities.PopulationSeasonInfoAbstract#getReproductionDistribution()
*/
@Override
@@ -76,22 +72,21 @@
if (result != null) {
oldMonths = result.getSemantics(0);
}
-
+
List<Month> months = getMonths();
-
- if ( ! months.equals(oldMonths)) {
- MatrixND tmp =
- MatrixFactory.getInstance().create(
- _("isisfish.populationSeasonInfo.distributionSpawing"),
- new List[]{months},
- new String[]{_("isisfish.populationSeasonInfo.months")});
+
+ if (!months.equals(oldMonths)) {
+ MatrixND tmp = MatrixFactory.getInstance().create(
+ _("isisfish.populationSeasonInfo.distributionSpawing"),
+ new List[] { months },
+ new String[] { _("isisfish.populationSeasonInfo.months") });
tmp.pasteSemantics(result);
result = tmp;
}
-
+
return result;
}
-
+
/**
* overload to return matrix if no matrix available. The matrix returned
* by this method can't be used directly because it conatins only the
@@ -108,17 +103,27 @@
if (getPopulation() != null) {
List groups = getPopulation().getPopulationGroup();
List zones = getPopulation().getPopulationZone();
- List [] sems = new List[]{ groups, zones, zones };
-
+ List[] sems = new List[] { groups, zones, zones };
+
if (mat == null) {
- mat = MatrixFactory.getInstance().create(_("isisfish.populationSeasonInfo.migration"), sems,
- new String[]{_("isisfish.populationSeasonInfo.group"), _("isisfish.populationSeasonInfo.departure"), _("isisfish.populationSeasonInfo.arrival")});
+ mat = MatrixFactory.getInstance().create(
+ _("isisfish.populationSeasonInfo.migration"),
+ sems,
+ new String[] {
+ _("isisfish.populationSeasonInfo.group"),
+ _("isisfish.populationSeasonInfo.departure"),
+ _("isisfish.populationSeasonInfo.arrival") });
// we don't call setCapturability because is better to create a valid
// matrix when capturability is null instead check validity and
// create new one and paste the old
- } else if (!Arrays.equals(mat.getSemantics(), sems)){
- MatrixND newmat = MatrixFactory.getInstance().create(_("isisfish.populationSeasonInfo.migration"), sems,
- new String[]{_("isisfish.populationSeasonInfo.group"), _("isisfish.populationSeasonInfo.departure"), _("isisfish.populationSeasonInfo.arrival")});
+ } else if (!Arrays.equals(mat.getSemantics(), sems)) {
+ MatrixND newmat = MatrixFactory.getInstance().create(
+ _("isisfish.populationSeasonInfo.migration"),
+ sems,
+ new String[] {
+ _("isisfish.populationSeasonInfo.group"),
+ _("isisfish.populationSeasonInfo.departure"),
+ _("isisfish.populationSeasonInfo.arrival") });
newmat.pasteSemantics(mat);
mat = newmat;
// perhaps call setCapturability, but if possible wait the user
@@ -127,7 +132,8 @@
}
return mat;
}
- /* (non-Javadoc)
+
+ /*
* @see fr.ifremer.isisfish.entities.PopulationSeasonInfoAbstract#getEmigrationMatrix()
*/
@Override
@@ -137,17 +143,25 @@
if (getPopulation() != null) {
List groups = getPopulation().getPopulationGroup();
List zones = getPopulation().getPopulationZone();
- List [] sems = new List[]{ groups, zones };
-
+ List[] sems = new List[] { groups, zones };
+
if (mat == null) {
- mat = MatrixFactory.getInstance().create(_("isisfish.populationSeasonInfo.emigration"), sems,
- new String[]{_("isisfish.populationSeasonInfo.group"), _("isisfish.populationSeasonInfo.departure")});
+ mat = MatrixFactory.getInstance().create(
+ _("isisfish.populationSeasonInfo.emigration"),
+ sems,
+ new String[] {
+ _("isisfish.populationSeasonInfo.group"),
+ _("isisfish.populationSeasonInfo.departure") });
// we don't call setCapturability because is better to create a valid
// matrix when capturability is null instead check validity and
// create new one and paste the old
- } else if (!Arrays.equals(mat.getSemantics(), sems)){
- MatrixND newmat = MatrixFactory.getInstance().create(n_("isisfish.populationSeasonInfo.emigration"), sems,
- new String[]{_("isisfish.populationSeasonInfo.group"), _("isisfish.populationSeasonInfo.departure")});
+ } else if (!Arrays.equals(mat.getSemantics(), sems)) {
+ MatrixND newmat = MatrixFactory.getInstance().create(
+ n_("isisfish.populationSeasonInfo.emigration"),
+ sems,
+ new String[] {
+ _("isisfish.populationSeasonInfo.group"),
+ _("isisfish.populationSeasonInfo.departure") });
newmat.pasteSemantics(mat);
mat = newmat;
// perhaps call setCapturability, but if possible wait the user
@@ -156,7 +170,8 @@
}
return mat;
}
- /* (non-Javadoc)
+
+ /*
* @see fr.ifremer.isisfish.entities.PopulationSeasonInfoAbstract#getImmigrationMatrix()
*/
@Override
@@ -166,17 +181,25 @@
if (getPopulation() != null) {
List groups = getPopulation().getPopulationGroup();
List zones = getPopulation().getPopulationZone();
- List [] sems = new List[]{ groups, zones };
-
+ List[] sems = new List[] { groups, zones };
+
if (mat == null) {
- mat = MatrixFactory.getInstance().create(_("isisfish.populationSeasonInfo.immigration"), sems,
- new String[]{_("isisfish.populationSeasonInfo.group"), _("isisfish.populationSeasonInfo.arrival")});
+ mat = MatrixFactory.getInstance().create(
+ _("isisfish.populationSeasonInfo.immigration"),
+ sems,
+ new String[] {
+ _("isisfish.populationSeasonInfo.group"),
+ _("isisfish.populationSeasonInfo.arrival") });
// we don't call setCapturability because is better to create a valid
// matrix when capturability is null instead check validity and
// create new one and paste the old
- } else if (!Arrays.equals(mat.getSemantics(), sems)){
- MatrixND newmat = MatrixFactory.getInstance().create(n_("isisfish.populationSeasonInfo.immigration"), sems,
- new String[]{_("isisfish.populationSeasonInfo.group"), _("isisfish.populationSeasonInfo.arrival")});
+ } else if (!Arrays.equals(mat.getSemantics(), sems)) {
+ MatrixND newmat = MatrixFactory.getInstance().create(
+ n_("isisfish.populationSeasonInfo.immigration"),
+ sems,
+ new String[] {
+ _("isisfish.populationSeasonInfo.group"),
+ _("isisfish.populationSeasonInfo.arrival") });
newmat.pasteSemantics(mat);
mat = newmat;
// perhaps call setCapturability, but if possible wait the user
@@ -185,8 +208,8 @@
}
return mat;
}
-
- /* (non-Javadoc)
+
+ /*
* @see fr.ifremer.isisfish.entities.PopulationSeasonInfo#getCapturability(fr.ifremer.isisfish.entities.PopulationGroup)
*/
public double getCapturability(PopulationGroup group) {
@@ -197,116 +220,125 @@
}
return result;
}
-
+
/**
- * Create not initialized no spacialized change group matrix
+ * Create not initialized no spacialized change group matrix.
+ *
* @return
*/
public MatrixND createNoSpacializedChangeGroupMatrix() {
Population pop = getPopulation();
-
+
List<PopulationGroup> groups = pop.getPopulationGroup();
-
- MatrixND result = MatrixFactory.getInstance().create(new List[]{groups, groups});
+
+ MatrixND result = MatrixFactory.getInstance().create(
+ new List[] { groups, groups });
return result;
}
-
+
/**
- * Converte spacialized matrix to no spacialized matrix
+ * Convert spacialized matrix to non spacialized matrix.
+ *
* @param mat spacialized matrix
- * @return spacialized matrix
+ * @return non spacialized matrix
*/
public MatrixND unspacializeLengthChangeMatrix(MatrixND mat) {
Population pop = getPopulation();
-
+
int nbsecteurs = pop.sizePopulationZone();
int nbclasses = pop.sizePopulationGroup();
-
+
MatrixND smallmat = createNoSpacializedChangeGroupMatrix();
- for(int i=0; i<nbclasses; i++){
- for(int j=0; j<nbclasses; j++){
- double val = mat.getValue(i*nbsecteurs, j*nbsecteurs);
- smallmat.setValue(i,j, val);
+ for (int i = 0; i < nbclasses; i++) {
+ for (int j = 0; j < nbclasses; j++) {
+ double val = mat.getValue(i * nbsecteurs, j * nbsecteurs);
+ smallmat.setValue(i, j, val);
}
}
return smallmat;
}
/**
- * Create not initialized spacialized change group matrix
+ * Create not initialized spacialized change group matrix.
+ *
* @return
*/
protected MatrixND createSpacializedChangeGroupMatrix() {
Population pop = getPopulation();
-
+
List<Zone> zones = pop.getPopulationZone();
List<PopulationGroup> groups = pop.getPopulationGroup();
-
+
ArrayList<String> semantique = new ArrayList<String>();
-
+
for (PopulationGroup group : groups) {
for (Zone zone : zones) {
semantique.add(group + "/" + zone);
}
}
-
- MatrixND result = MatrixFactory.getInstance().create(new List[]{semantique, semantique});
+
+ MatrixND result = MatrixFactory.getInstance().create(
+ new List[] { semantique, semantique });
return result;
}
-
+
/**
- * Converte no spacialized matrix to spacialized matrix
+ * Convert no spacialized matrix to spacialized matrix.
+ *
* @param mat no spacialized matrix
* @return spacialized matrix
*/
public MatrixND spacializeLengthChangeMatrix(MatrixND mat) {
Population pop = getPopulation();
-
+
int nbsecteurs = pop.sizePopulationZone();
int nbclasses = pop.sizePopulationGroup();
-
+
MatrixND bigmat = createSpacializedChangeGroupMatrix();
- for(int i=0; i<nbclasses; i++){
- for(int j=0; j<nbclasses; j++){
- MatrixND matId = MatrixFactory.getInstance().matrixId(nbsecteurs);
- matId.mults(mat.getValue(i,j));
- bigmat.paste(new int[]{i*nbsecteurs, j*nbsecteurs}, matId);
+ for (int i = 0; i < nbclasses; i++) {
+ for (int j = 0; j < nbclasses; j++) {
+ MatrixND matId = MatrixFactory.getInstance().matrixId(
+ nbsecteurs);
+ matId.mults(mat.getValue(i, j));
+ bigmat.paste(new int[] { i * nbsecteurs, j * nbsecteurs },
+ matId);
}
}
return bigmat;
}
/**
- * Create default non spacialized matrix group changement
+ * Create default non spacialized matrix group changement.
+ *
*/
public MatrixND computeLengthChangeMatrix() {
-
+
int NB_DISCRETISATION = 10;
- Population pop = getPopulation();
+ Population pop = getPopulation();
List<PopulationGroup> groups = pop.getPopulationGroup();
-
+
MatrixND result = createNoSpacializedChangeGroupMatrix();
- for (int i=0; i<groups.size(); i++) {
+ for (int i = 0; i < groups.size(); i++) {
PopulationGroup group = groups.get(i);
double min = group.getMinLength();
double max = group.getMaxLength();
// creation de la matrice de longueurs pour la classe
- double step = (max-min)/NB_DISCRETISATION;
- double [] length = new double[NB_DISCRETISATION];
+ double step = (max - min) / NB_DISCRETISATION;
+ double[] length = new double[NB_DISCRETISATION];
length[0] = min;
- for(int l=1; l<NB_DISCRETISATION; l++){
- length[l] = length[l-1] + step;
+ for (int l = 1; l < NB_DISCRETISATION; l++) {
+ length[l] = length[l - 1] + step;
}
// calcul des nouvelles longueurs pour la classe
- for(int l=0; l<NB_DISCRETISATION; l++){
+ for (int l = 0; l < NB_DISCRETISATION; l++) {
double age = pop.getAge(length[l], group);
length[l] = pop.getLength(age + 1, group); // + 1 mois
}
@@ -314,13 +346,16 @@
// modification de la matrice de changement d'age en fonction
// de la vitesse croissance de la classe.
- for(int l=0; l<NB_DISCRETISATION; l++){
+ for (int l = 0; l < NB_DISCRETISATION; l++) {
int c = 0;
- while(c<groups.size() && ! groups.get(c).isInLength(length[l])){
+ while (c < groups.size()
+ && !groups.get(c).isInLength(length[l])) {
c++;
}
- if(c >= groups.size()){
- log.warn(_("isisfish.error.acceptable.population") + " (group=" + group +" new length: " + length[l] + ")");
+ if (c >= groups.size()) {
+ log.warn(_("isisfish.error.acceptable.population")
+ + " (group=" + group + " new length: " + length[l]
+ + ")");
// pas retrouver une classe pour cette longueur, on le laisse dans la meme classe.
result.setValue(i, i, result.getValue(i, i) + 1);
} else {
@@ -341,51 +376,52 @@
*/
public MatrixND getGroupChangeMatrix(Month month) {
Population pop = getPopulation();
-
+
if (log.isDebugEnabled()) {
- log.debug("pop: " + pop + " AgeGroup: " + pop.getSpecies().getAgeGroupType() + " groupChange: " + getGroupChange() + " month: " + month + " firstMonth: " + getFirstMonth());
+ log.debug("pop: " + pop + " AgeGroup: "
+ + pop.getSpecies().getAgeGroupType() + " groupChange: "
+ + getGroupChange() + " month: " + month + " firstMonth: "
+ + getFirstMonth());
}
-
+
// si en longueur
- if (! pop.getSpecies().getAgeGroupType()){
- if(getSimpleLengthChangeMatrix()){
+ if (!pop.getSpecies().getAgeGroupType()) {
+ if (getSimpleLengthChangeMatrix()) {
return spacializeLengthChangeMatrix(getLengthChangeMatrix());
- }else{
+ } else {
return getLengthChangeMatrix();
}
- }else if(getGroupChange() &&
- month.getMonthNumber() == getFirstMonth().getMonthNumber()){
+ } else if (getGroupChange()
+ && month.getMonthNumber() == getFirstMonth().getMonthNumber()) {
// create identity matrix with special 1 for plus group if necessary
int nbrAge = pop.sizePopulationGroup();
int nbrZone = pop.sizePopulationZone();
boolean groupplus = pop.getPlusGroup();
-
+
MatrixND result = createSpacializedChangeGroupMatrix();
- for(MatrixIterator mi=result.iterator(); mi.next();){
- int [] dim = mi.getCoordinates();
+ for (MatrixIterator mi = result.iterator(); mi.next();) {
+ int[] dim = mi.getCoordinates();
int i = dim[0];
int j = dim[1];
- if(
- // un element de la diagonale dans le block choisi
- (i+nbrZone == j)
- || // calcul pour savoir s'il y a le groupe plus
+ if (
+ // un element de la diagonale dans le block choisi
+ (i + nbrZone == j) || // calcul pour savoir s'il y a le groupe plus
(groupplus
// regarde si on est bien dans le dernier block
- && (nbrAge-1 == i/nbrZone)
+ && (nbrAge - 1 == i / nbrZone)
// regarde si on est bien sur la diagonal
- && (i == j))
- ){
+ && (i == j))) {
mi.setValue(1);
}
}
return result;
- }else{
+ } else {
int nbsecteurs = pop.sizePopulationZone();
int nbclasses = pop.sizePopulationGroup();
-
+
int dim = nbsecteurs * nbclasses;
-
+
return MatrixFactory.getInstance().matrixId(dim);
}
}
@@ -394,9 +430,9 @@
* @see fr.ifremer.isisfish.entities.PopulationSeasonInfo#getMigrationMatrix(fr.ifremer.isisfish.types.Month, org.codelutin.math.matrix.MatrixND)
*/
public MatrixND getMigrationMatrix(Month month, MatrixND N) {
- if(month.getMonthNumber() == getFirstMonth().getMonthNumber()){
+ if (month.getMonthNumber() == getFirstMonth().getMonthNumber()) {
return getMigrationMatrix(N);
- }else{
+ } else {
MatrixND result = createSpacializedChangeGroupMatrix();
MatrixHelper.convertToId(result);
return result;
@@ -405,14 +441,14 @@
protected MatrixND getMigrationMatrix(MatrixND aN) {
MatrixND mat = null;
- try{
+ try {
Population population = getPopulation();
List<Zone> zones = population.getPopulationZone();
List<PopulationGroup> groups = population.getPopulationGroup();
-
+
int nbSecteur = zones.size();
-
+
mat = createSpacializedChangeGroupMatrix();
MatrixHelper.convertToId(mat);
@@ -422,11 +458,11 @@
Equation eq = getMigrationEquation();
- for (int c=0; c<groups.size(); c++) {
+ for (int c = 0; c < groups.size(); c++) {
PopulationGroup group = groups.get(c);
- for (int d=0; d<zones.size(); d++) {
+ for (int d = 0; d < zones.size(); d++) {
Zone departureZone = zones.get(d);
- for (int a=0; a<zones.size(); a++) {
+ for (int a = 0; a < zones.size(); a++) {
Zone arrivalZone = zones.get(a);
if (departureZone.equals(arrivalZone)) {
// pour zd == za on ne fait pas le calcul
@@ -435,18 +471,16 @@
continue;
}
- double coef = eq.evaluate(
- "N", N,
- "pop", population,
- "group", group,
+ double coef = eq.evaluate("N", N, "pop",
+ population, "group", group,
"departureZone", departureZone,
"arrivalZone", arrivalZone);
- int x = c*nbSecteur+d;
- int y = c*nbSecteur+a;
- double ancienne_val = mat.getValue(x,x) - coef;
- mat.setValue(x,x, ancienne_val);
- if(ancienne_val<0){
+ int x = c * nbSecteur + d;
+ int y = c * nbSecteur + a;
+ double ancienne_val = mat.getValue(x, x) - coef;
+ mat.setValue(x, x, ancienne_val);
+ if (ancienne_val < 0) {
/*#java.util.logging.Logger.getLogger("fr.ifremer.db.InfoSaisonPop.getMatriceMigration").info("Erreur dans la migration, un coef est negatif");#*/
}
mat.setValue(x, y, coef);
@@ -454,47 +488,47 @@
}
}
} else {
-
+
// matrix 3D: Group, departure, arrival
MatrixND mig = getMigrationMatrix();
-
- for (MatrixIterator i=mig.iterator(); i.hasNext();) {
+
+ for (MatrixIterator i = mig.iterator(); i.hasNext();) {
i.next();
double coef = i.getValue();
if (coef != 0) {
- int [] coord = i.getCoordinates();
+ int[] coord = i.getCoordinates();
int posClasse = coord[0];
int posSecteurD = coord[1];
int posSecteurA = coord[2];
- int x = posClasse*nbSecteur+posSecteurD;
- int y = posClasse*nbSecteur+posSecteurA;
+ int x = posClasse * nbSecteur + posSecteurD;
+ int y = posClasse * nbSecteur + posSecteurA;
// toutes les migrations doivent etre precisees.
// Peut-etre faire un teste pour que les migrations ne depassent pas 1
- double ancienne_val = mat.getValue(x,x);
- mat.setValue(x,x, ancienne_val - coef);
- if(ancienne_val<0){
+ double ancienne_val = mat.getValue(x, x);
+ mat.setValue(x, x, ancienne_val - coef);
+ if (ancienne_val < 0) {
/*#log.info("Erreur dans la migration, un coef est negatif");#*/
}
mat.setValue(x, y, coef);
}
}
}
+ } catch (Exception eee) {
+ log.warn("Erreur lors de la creation de la matrice de migration",
+ eee);
}
- catch(Exception eee){
- log.warn("Erreur lors de la creation de la matrice de migration", eee);
- }
return mat;
}
-
+
/* (non-Javadoc)
* @see fr.ifremer.isisfish.entities.PopulationSeasonInfo#getEmigrationMatrix(fr.ifremer.isisfish.types.Month, org.codelutin.math.matrix.MatrixND)
*/
public MatrixND getEmigrationMatrix(Month month, MatrixND N) {
- if(month.getMonthNumber() == getFirstMonth().getMonthNumber()){
+ if (month.getMonthNumber() == getFirstMonth().getMonthNumber()) {
return getEmigrationMatrix(N);
- }else{
+ } else {
MatrixND result = createSpacializedChangeGroupMatrix();
return result;
}
@@ -502,14 +536,14 @@
protected MatrixND getEmigrationMatrix(MatrixND aN) {
MatrixND mat = null;
- try{
+ try {
Population population = getPopulation();
List<Zone> zones = population.getPopulationZone();
List<PopulationGroup> groups = population.getPopulationGroup();
-
+
int nbSecteur = zones.size();
-
+
mat = createSpacializedChangeGroupMatrix();
if (getUseEquationMigration()) {
@@ -518,55 +552,51 @@
Equation eq = getEmigrationEquation();
- for (int c=0; c<groups.size(); c++) {
+ for (int c = 0; c < groups.size(); c++) {
PopulationGroup group = groups.get(c);
- for (int d=0; d<zones.size(); d++) {
+ for (int d = 0; d < zones.size(); d++) {
Zone departureZone = zones.get(d);
- double coef = eq.evaluate(
- "N", N,
- "pop", population,
- "group", group,
- "departureZone", departureZone
- );
+ double coef = eq.evaluate("N", N, "pop", population,
+ "group", group, "departureZone", departureZone);
- int x = c*nbSecteur+d;
+ int x = c * nbSecteur + d;
mat.setValue(x, x, coef);
}
}
} else {
-
+
// matrix 3D: Group, departure, arrival
MatrixND mig = getEmigrationMatrix();
-
- for (MatrixIterator i=mig.iterator(); i.hasNext();) {
+
+ for (MatrixIterator i = mig.iterator(); i.hasNext();) {
i.next();
double coef = i.getValue();
if (coef != 0) {
- int [] coord = i.getCoordinates();
+ int[] coord = i.getCoordinates();
int posClasse = coord[0];
int posSecteurD = coord[1];
- int x = posClasse*nbSecteur+posSecteurD;
+ int x = posClasse * nbSecteur + posSecteurD;
mat.setValue(x, x, coef);
}
}
}
+ } catch (Exception eee) {
+ log.warn("Erreur lors de la creation de la matrice d'emigration",
+ eee);
}
- catch(Exception eee){
- log.warn("Erreur lors de la creation de la matrice d'emigration", eee);
- }
return mat;
}
-
+
/* (non-Javadoc)
* @see fr.ifremer.isisfish.entities.PopulationSeasonInfo#getImmigrationMatrix(fr.ifremer.isisfish.types.Month, org.codelutin.math.matrix.MatrixND)
*/
public MatrixND getImmigrationMatrix(Month month, MatrixND N) {
- if(month.getMonthNumber() == getFirstMonth().getMonthNumber()){
+ if (month.getMonthNumber() == getFirstMonth().getMonthNumber()) {
return getImmigrationMatrix(N);
- }else{
+ } else {
MatrixND result = createSpacializedChangeGroupMatrix();
return result;
}
@@ -574,77 +604,76 @@
protected MatrixND getImmigrationMatrix(MatrixND aN) {
MatrixND mat = null;
- try{
+ try {
Population population = getPopulation();
List<Zone> zones = population.getPopulationZone();
List<PopulationGroup> groups = population.getPopulationGroup();
-
+
int nbSecteur = zones.size();
-
- mat = MatrixFactory.getInstance().create(new int[]{groups.size() * nbSecteur});
+ mat = MatrixFactory.getInstance().create(
+ new int[] { groups.size() * nbSecteur });
+
if (getUseEquationMigration()) {
// on commence par faire une copie pour ne pas modifier N
MatrixND N = MatrixFactory.getInstance().create(aN);
Equation eq = getImmigrationEquation();
- for (int c=0; c<groups.size(); c++) {
+ for (int c = 0; c < groups.size(); c++) {
PopulationGroup group = groups.get(c);
- for (int a=0; a<zones.size(); a++) {
+ for (int a = 0; a < zones.size(); a++) {
Zone arrivalZone = zones.get(a);
-
- double coef = eq.evaluate(
- "N", N,
- "pop", population,
- "group", group,
- "arrivalZone", arrivalZone);
- int y = c*nbSecteur+a;
+ double coef = eq.evaluate("N", N, "pop", population,
+ "group", group, "arrivalZone", arrivalZone);
+
+ int y = c * nbSecteur + a;
mat.setValue(y, coef);
}
}
} else {
-
+
// matrix 3D: Group, departure, arrival
MatrixND mig = getImmigrationMatrix();
-
- for (MatrixIterator i=mig.iterator(); i.hasNext();) {
+
+ for (MatrixIterator i = mig.iterator(); i.hasNext();) {
i.next();
double coef = i.getValue();
if (coef != 0) {
- int [] coord = i.getCoordinates();
+ int[] coord = i.getCoordinates();
int posClasse = coord[0];
int posSecteurA = coord[1];
- int y = posClasse*nbSecteur+posSecteurA;
+ int y = posClasse * nbSecteur + posSecteurA;
mat.setValue(y, coef);
}
}
}
+ } catch (Exception eee) {
+ log.warn("Erreur lors de la creation de la matrice d'immigration",
+ eee);
}
- catch(Exception eee){
- log.warn("Erreur lors de la creation de la matrice d'immigration", eee);
- }
return mat;
}
-
+
public void setMigrationEquationAsString(String content) {
try {
Equation eq = getMigrationEquation();
-
+
if (eq == null) {
- EquationDAO dao = IsisFishDAOHelper.getEquationDAO(getTopiaContext());
+ EquationDAO dao = IsisFishDAOHelper
+ .getEquationDAO(getTopiaContext());
// create equation
- eq = dao.create();
+ eq = dao.create();
eq.setCategory("Migration");
eq.setLanguage(Language.JAVA);
eq.setJavaInterface(MigrationEquation.class);
setMigrationEquation(eq);
}
-
+
if (getPopulation() != null) {
eq.setName(getPopulation().getName() + "(" + toString() + ")");
}
@@ -659,24 +688,26 @@
fireOnPostWrite("content", _oldValue, content);
} catch (TopiaException eee) {
- throw new IsisFishRuntimeException(_("isisfish.error.change.equation"), eee);
+ throw new IsisFishRuntimeException(
+ _("isisfish.error.change.equation"), eee);
}
}
public void setEmigrationEquationAsString(String content) {
try {
Equation eq = getEmigrationEquation();
-
+
if (eq == null) {
- EquationDAO dao = IsisFishDAOHelper.getEquationDAO(getTopiaContext());
+ EquationDAO dao = IsisFishDAOHelper
+ .getEquationDAO(getTopiaContext());
// create equation
- eq = dao.create();
+ eq = dao.create();
eq.setCategory("Emigration");
eq.setLanguage(Language.JAVA);
eq.setJavaInterface(EmigrationEquation.class);
setEmigrationEquation(eq);
}
-
+
if (getPopulation() != null) {
eq.setName(getPopulation().getName() + "(" + toString() + ")");
}
@@ -691,24 +722,26 @@
fireOnPostWrite("content", _oldValue, content);
} catch (TopiaException eee) {
- throw new IsisFishRuntimeException(_("isisfish.error.change.equation"), eee);
+ throw new IsisFishRuntimeException(
+ _("isisfish.error.change.equation"), eee);
}
}
public void setImmigrationEquationAsString(String content) {
try {
Equation eq = getImmigrationEquation();
-
+
if (eq == null) {
- EquationDAO dao = IsisFishDAOHelper.getEquationDAO(getTopiaContext());
+ EquationDAO dao = IsisFishDAOHelper
+ .getEquationDAO(getTopiaContext());
// create equation
- eq = dao.create();
+ eq = dao.create();
eq.setCategory("Immigration");
eq.setLanguage(Language.JAVA);
eq.setJavaInterface(ImmigrationEquation.class);
setImmigrationEquation(eq);
}
-
+
if (getPopulation() != null) {
eq.setName(getPopulation().getName() + "(" + toString() + ")");
}
@@ -723,7 +756,8 @@
fireOnPostWrite("content", _oldValue, content);
} catch (TopiaException eee) {
- throw new IsisFishRuntimeException(_("isisfish.error.change.equation"), eee);
+ throw new IsisFishRuntimeException(
+ _("isisfish.error.change.equation"), eee);
}
}
@@ -732,44 +766,38 @@
* nombre d'individu creer par la reproduction. Le vecteur est structure
* en zone de reproduction.
*/
- public MatrixND getReproductionMatrix(Month month, MatrixND aN) {
- Population pop = getPopulation();
- List<Zone> zoneRepro = pop.getReproductionZone();
- MatrixND result = MatrixFactory.getInstance().create(new List[]{zoneRepro});
- try{
- // on commence par faire une copie pour ne pas modifier N
- MatrixND N = aN.copy();
+ public MatrixND getReproductionMatrix(Month month, MatrixND aN) {
+ Population pop = getPopulation();
+ List<Zone> zoneRepro = pop.getReproductionZone();
+ MatrixND result = MatrixFactory.getInstance().create(
+ new List[] { zoneRepro });
+ try {
+ // on commence par faire une copie pour ne pas modifier N
+ MatrixND N = aN.copy();
- if(getReproduction()){
- //recuperation de l'equation de reproduction
- Equation e = pop.getReproductionEquation();
+ if (getReproduction()) {
+ //recuperation de l'equation de reproduction
+ Equation e = pop.getReproductionEquation();
- //le coeff de repro pour le mois demande
- MatrixND coeff = getReproductionDistribution().copy();
+ //le coeff de repro pour le mois demande
+ MatrixND coeff = getReproductionDistribution().copy();
- // l'equation doit mettre les resultats dans la matrice result
- e.evaluate(
- "N", N,
- "pop", pop,
- "month", month,
- "prepro", coeff.getValue(month),
- "zoneRepro", zoneRepro,
- "groups", N.getSemantics(0),
- "zones", N.getSemantics(1),
- "result", result
- );
- }
- }catch(Exception eee){
- log.fatal("Error in matrix reproduction creation", eee);
- }
- return result;
+ // l'equation doit mettre les resultats dans la matrice result
+ e.evaluate("N", N, "pop", pop, "month", month, "prepro", coeff
+ .getValue(month), "zoneRepro", zoneRepro, "groups", N
+ .getSemantics(0), "zones", N.getSemantics(1), "result",
+ result);
+ }
+ } catch (Exception eee) {
+ log.fatal("Error in matrix reproduction creation", eee);
+ }
+ return result;
}
public String toString() {
- String result = _("isisfish.populationSeasonInfo.toString", this.getPopulation(), this.getFirstMonth(), this.getLastMonth());
+ String result = _("isisfish.populationSeasonInfo.toString", this
+ .getPopulation(), this.getFirstMonth(), this.getLastMonth());
return result;
- }
+ }
}
-
-
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/PortImpl.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/PortImpl.java 2009-04-07 13:14:20 UTC (rev 2080)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/PortImpl.java 2009-04-07 13:14:40 UTC (rev 2081)
@@ -1,28 +1,55 @@
+/* *##%
+ * Copyright (C) 2006 - 2009
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
package fr.ifremer.isisfish.entities;
-import java.io.Serializable;
-
import fr.ifremer.isisfish.IsisFishRuntimeException;
import fr.ifremer.isisfish.datastore.RegionStorage;
import fr.ifremer.isisfish.datastore.StorageException;
/**
* Implantation des operations pour l'entité Port.
+ *
+ * Created: 18 mars 2006 15:24:56
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
*/
-public class PortImpl extends fr.ifremer.isisfish.entities.PortAbstract implements Serializable, fr.ifremer.isisfish.entities.Port {
+public class PortImpl extends PortAbstract {
+ /** serialVersionUID.*/
private static final long serialVersionUID = 1L;
public FisheryRegion getFisheryRegion() {
try {
- FisheryRegion result = RegionStorage.getFisheryRegion(getTopiaContext());
+ FisheryRegion result = RegionStorage
+ .getFisheryRegion(getTopiaContext());
return result;
} catch (StorageException eee) {
throw new IsisFishRuntimeException(eee);
}
}
- /* (non-Javadoc)
+ /*
* @see fr.ifremer.isisfish.entities.FisheryRegionAbstract#toString()
*/
@Override
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/SeasonImpl.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/SeasonImpl.java 2009-04-07 13:14:20 UTC (rev 2080)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/SeasonImpl.java 2009-04-07 13:14:40 UTC (rev 2081)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2006
+ * Copyright (C) 2006 - 2009
* Code Lutin, Cédric Pineau, Benjamin Poussin
*
* This program is free software; you can redistribute it and/or
@@ -17,18 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*##%*/
-/* *
- * SeasonImpl.java
- *
- * Created: 3 janv. 2006 18:28:19
- *
- * @author poussin
- * @version $Revision$
- *
- * Last update: $Date$
- * by : $Author$
- */
-
package fr.ifremer.isisfish.entities;
import java.util.ArrayList;
@@ -37,15 +25,20 @@
import fr.ifremer.isisfish.types.Month;
import static org.codelutin.i18n.I18n._;
-
-/**
+/***
+ * SeasonImpl.
+ *
+ * Created: 3 janv. 2006 18:28:19
+ *
* @author poussin
+ * @version $Revision$
*
+ * Last update: $Date$
+ * by : $Author$
*/
-
public class SeasonImpl extends SeasonAbstract {
- /** */
+ /** serialVersionUID. */
private static final long serialVersionUID = 1L;
/**
@@ -76,11 +69,12 @@
*/
public void setMonths(List<Month> listMonth) {
if (listMonth == null || listMonth.size() == 0) {
- throw new IllegalArgumentException("listMonth must contains one month or more");
+ throw new IllegalArgumentException(
+ "listMonth must contains one month or more");
}
Month first = listMonth.get(0);
- Month last = listMonth.get(listMonth.size()-1);
-
+ Month last = listMonth.get(listMonth.size() - 1);
+
setFirstMonth(first);
setLastMonth(last);
}
@@ -90,7 +84,7 @@
*/
public boolean containsMonth(Month month) {
boolean result = month.equals(getLastMonth()); // check first last month, because loop don't do that
-
+
Month m = getFirstMonth();
while (result == false && m.equals(getLastMonth()) == false) {
result = m.equals(month);
@@ -104,10 +98,9 @@
*/
@Override
public String toString() {
- String result = _("isisfish.season.toString", this.getFirstMonth(), this.getLastMonth());
+ String result = _("isisfish.season.toString", this.getFirstMonth(),
+ this.getLastMonth());
return result;
- }
-
-}
+ }
-
+}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/SelectivityImpl.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/SelectivityImpl.java 2009-04-07 13:14:20 UTC (rev 2080)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/SelectivityImpl.java 2009-04-07 13:14:40 UTC (rev 2081)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2006
+ * Copyright (C) 2006 - 2009
* Code Lutin, Cédric Pineau, Benjamin Poussin
*
* This program is free software; you can redistribute it and/or
@@ -17,18 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*##%*/
-/* *
- * SelectivityImpl.java
- *
- * Created: 20 janv. 2006 03:29:14
- *
- * @author poussin
- * @version $Revision$
- *
- * Last update: $Date$
- * by : $Author$
- */
-
package fr.ifremer.isisfish.entities;
import org.codelutin.topia.TopiaException;
@@ -38,30 +26,37 @@
import fr.ifremer.isisfish.equation.Language;
import fr.ifremer.isisfish.equation.SelectivityEquation;
-
/**
+ * SelectivityImpl.
+ *
+ * Created: 20 janv. 2006 03:29:14
+ *
* @author poussin
+ * @version $Revision$
*
+ * Last update: $Date$
+ * by : $Author$
*/
+public class SelectivityImpl extends SelectivityAbstract {
-public class SelectivityImpl extends SelectivityAbstract implements Selectivity {
-
- /** */
+ /** serialVersionUID. */
private static final long serialVersionUID = 1L;
/* (non-Javadoc)
* @see fr.ifremer.isisfish.entities.Selectivity#getCoefficient(double, double, fr.ifremer.isisfish.entities.Metier)
*/
- public double getCoefficient(Population pop, PopulationGroup group, Metier metier) {
+ public double getCoefficient(Population pop, PopulationGroup group,
+ Metier metier) {
Equation eq = getEquation();
// poussin 20060823: modification par rapport a la version 2, on ne passe
// plus age et length mais pop et group sur lequel on pourra recuperer
// age et length. Ca evite de calculer age et length si on ne les utilise
// pas dans l'equation
- double result = eq.evaluate("pop", pop, "group", group, "metier", metier);
+ double result = eq.evaluate("pop", pop, "group", group, "metier",
+ metier);
return result;
}
-
+
/* (non-Javadoc)
* @see fr.ifremer.isisfish.entities.SelectivityAbstract#getEquation()
*/
@@ -70,7 +65,8 @@
if (super.getEquation() == null) {
Equation eq;
try {
- EquationDAO dao = IsisFishDAOHelper.getEquationDAO(getTopiaContext());
+ EquationDAO dao = IsisFishDAOHelper
+ .getEquationDAO(getTopiaContext());
eq = dao.create();
eq.setCategory("Selectivity");
eq.setLanguage(Language.JAVA);
@@ -83,7 +79,7 @@
}
return super.getEquation();
}
-
+
/* (non-Javadoc)
* @see fr.ifremer.isisfish.entities.SelectivityAbstract#setGear(fr.ifremer.isisfish.entities.Gear)
*/
@@ -92,7 +88,7 @@
super.setGear(value);
setEquationName(getEquation());
}
-
+
/* (non-Javadoc)
* @see fr.ifremer.isisfish.entities.SelectivityAbstract#setPopulation(fr.ifremer.isisfish.entities.Population)
*/
@@ -101,14 +97,14 @@
super.setPopulation(value);
setEquationName(getEquation());
}
-
+
protected void setEquationName(Equation eq) {
if (getGear() != null && getPopulation() != null) {
eq.setName(getGear().getName() + " - " + getPopulation().getName()
- + "(" + getPopulation().getSpecies().getName() + ")");
+ + "(" + getPopulation().getSpecies().getName() + ")");
}
}
-
+
/* (non-Javadoc)
* @see fr.ifremer.isisfish.entities.FisheryRegionAbstract#toString()
*/
@@ -119,5 +115,3 @@
}
}
-
-
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/SetOfVesselsImpl.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/SetOfVesselsImpl.java 2009-04-07 13:14:20 UTC (rev 2080)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/SetOfVesselsImpl.java 2009-04-07 13:14:40 UTC (rev 2081)
@@ -1,3 +1,22 @@
+/* *##%
+ * Copyright (C) 2006 - 2009
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
package fr.ifremer.isisfish.entities;
import static org.codelutin.i18n.I18n._;
@@ -2,5 +21,7 @@
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.codelutin.topia.TopiaException;
+
import fr.ifremer.isisfish.IsisFishDAOHelper;
-import java.io.Serializable;
-
import fr.ifremer.isisfish.IsisFishRuntimeException;
@@ -11,25 +32,30 @@
import fr.ifremer.isisfish.equation.Language;
import fr.ifremer.isisfish.equation.SoVTechnicalEfficiencyEquation;
import fr.ifremer.isisfish.types.Date;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.codelutin.topia.TopiaException;
/**
* Implantation des operations pour l'entité SetOfVessels.
+ *
+ * Created: 20 janv. 2006 03:29:14
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
*/
-public class SetOfVesselsImpl extends fr.ifremer.isisfish.entities.SetOfVesselsAbstract implements Serializable, fr.ifremer.isisfish.entities.SetOfVessels {
+public class SetOfVesselsImpl extends SetOfVesselsAbstract {
+ /** serialVersionUID. */
private static final long serialVersionUID = 1L;
- /**
- * Logger for this class
- */
+ /** Logger for this class. */
private static final Log log = LogFactory.getLog(SetOfVesselsImpl.class);
public FisheryRegion getFisheryRegion() {
try {
- FisheryRegion result = RegionStorage.getFisheryRegion(getTopiaContext());
+ FisheryRegion result = RegionStorage
+ .getFisheryRegion(getTopiaContext());
return result;
} catch (StorageException eee) {
throw new IsisFishRuntimeException(eee);
@@ -37,8 +63,9 @@
}
/**
- * override to change name of equation
- * @see fr.ifremer.isisfish.entities.SetOfVesselsAbstract#setName(java.lang.String)
+ * Override to change name of equation.
+ *
+ * @see SetOfVesselsAbstract#setName(java.lang.String)
*/
@Override
public void setName(String value) {
@@ -49,21 +76,16 @@
}
}
- /**
- * Compute or return inactivity days
- * @param length length of group
- * @param group group
- * @return age in month
- */
@Override
- public double getTechnicalEfficiency(Date date, Metier metier) {
+ public double getTechnicalEfficiency(Date date, Metier metier) {
double result = 1;
try {
Gear gear = metier.getGear();
Equation eq = getTechnicalEfficiencyEquation();
if (eq != null) {
- result = eq.evaluate("date", date, "metier", metier, "gear", gear);
+ result = eq.evaluate("date", date, "metier", metier, "gear",
+ gear);
}
} catch (Exception eee) {
if (log.isWarnEnabled()) {
@@ -75,21 +97,22 @@
}
return result;
}
-
+
public void setEquationTechnicalEfficiency(String content) {
try {
Equation eq = getTechnicalEfficiencyEquation();
-
+
if (eq == null) {
- EquationDAO dao = IsisFishDAOHelper.getEquationDAO(getTopiaContext());
+ EquationDAO dao = IsisFishDAOHelper
+ .getEquationDAO(getTopiaContext());
// create Growth equation
- eq = dao.create();
+ eq = dao.create();
eq.setCategory("TechnicalEfficiency");
eq.setJavaInterface(SoVTechnicalEfficiencyEquation.class);
eq.setLanguage(Language.JAVA);
setTechnicalEfficiencyEquation(eq);
}
-
+
eq.setName(getName());
// Fire
@@ -98,15 +121,16 @@
eq.setContent(content);
eq.update();
-
+
fireOnPostWrite("content", _oldValue, content);
} catch (TopiaException eee) {
- throw new IsisFishRuntimeException(_("isisfish.change.equation"), eee);
+ throw new IsisFishRuntimeException(_("isisfish.change.equation"),
+ eee);
}
}
-
- /* (non-Javadoc)
+
+ /*
* @see fr.ifremer.isisfish.entities.FisheryRegionAbstract#toString()
*/
@Override
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/SpeciesImpl.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/SpeciesImpl.java 2009-04-07 13:14:20 UTC (rev 2080)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/SpeciesImpl.java 2009-04-07 13:14:40 UTC (rev 2081)
@@ -1,28 +1,55 @@
+/* *##%
+ * Copyright (C) 2006 - 2009
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
package fr.ifremer.isisfish.entities;
-import java.io.Serializable;
-
import fr.ifremer.isisfish.IsisFishRuntimeException;
import fr.ifremer.isisfish.datastore.RegionStorage;
import fr.ifremer.isisfish.datastore.StorageException;
/**
* Implantation des operations pour l'entité Species.
+ *
+ * Created: 20 janv. 2006 03:29:14
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
*/
-public class SpeciesImpl extends fr.ifremer.isisfish.entities.SpeciesAbstract implements Serializable, fr.ifremer.isisfish.entities.Species {
+public class SpeciesImpl extends SpeciesAbstract {
+ /** serialVersionUID. */
private static final long serialVersionUID = 1L;
public FisheryRegion getFisheryRegion() {
try {
- FisheryRegion result = RegionStorage.getFisheryRegion(getTopiaContext());
+ FisheryRegion result = RegionStorage
+ .getFisheryRegion(getTopiaContext());
return result;
} catch (StorageException eee) {
throw new IsisFishRuntimeException(eee);
}
}
- /* (non-Javadoc)
+ /*
* @see fr.ifremer.isisfish.entities.FisheryRegionAbstract#toString()
*/
@Override
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/StrategyImpl.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/StrategyImpl.java 2009-04-07 13:14:20 UTC (rev 2080)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/StrategyImpl.java 2009-04-07 13:14:40 UTC (rev 2081)
@@ -1,3 +1,22 @@
+/* *##%
+ * Copyright (C) 2006 - 2009
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
package fr.ifremer.isisfish.entities;
import static org.codelutin.i18n.I18n._;
@@ -2,3 +21,2 @@
-import java.io.Serializable;
import java.util.ArrayList;
@@ -20,26 +38,37 @@
/**
* Implantation des operations pour l'entité Strategy.
+ *
+ * Created: 20 janv. 2006 03:29:14
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
*/
-public class StrategyImpl extends fr.ifremer.isisfish.entities.StrategyAbstract implements Serializable, fr.ifremer.isisfish.entities.Strategy {
+public class StrategyImpl extends StrategyAbstract {
- /** to use log facility, just put in your code: log.info("..."); */
- static private Log log = LogFactory.getLog(StrategyImpl.class);
+ /** Class logger. */
+ private static Log log = LogFactory.getLog(StrategyImpl.class);
+ /** serialVersionUID. */
private static final long serialVersionUID = 1L;
public FisheryRegion getFisheryRegion() {
try {
- FisheryRegion result = RegionStorage.getFisheryRegion(getTopiaContext());
+ FisheryRegion result = RegionStorage
+ .getFisheryRegion(getTopiaContext());
return result;
} catch (StorageException eee) {
throw new IsisFishRuntimeException(eee);
}
}
-
+
/**
- * override to change name of equation
- * @see fr.ifremer.isisfish.entities.StrategyAbstract#setName(java.lang.String)
+ * Override to change name of equation.
+ *
+ * @see StrategyAbstract#setName(java.lang.String)
*/
@Override
public void setName(String value) {
@@ -50,7 +79,7 @@
}
}
- /* (non-Javadoc)
+ /*
* @see fr.ifremer.isisfish.entities.StrategyAbstract#getStrategyMonthInfo()
*/
@Override
@@ -59,14 +88,17 @@
List<StrategyMonthInfo> result = super.getStrategyMonthInfo();
if (result == null) { // Faire le test suivant pose de gros probleme, car il essai de faire un getStrategyMonthInfo et donc ca boucle || result.size() != Month.NUMBER_OF_MONTH) {
if (result != null) {
- log.warn(_("isisfish.error.strategy.order", getName(), result.size()));
+ log.warn(_("isisfish.error.strategy.order", getName(),
+ result.size()));
clearStrategyMonthInfo();
} else {
- result = new ArrayList<StrategyMonthInfo>(Month.NUMBER_OF_MONTH);
+ result = new ArrayList<StrategyMonthInfo>(
+ Month.NUMBER_OF_MONTH);
setStrategyMonthInfo(result);
}
for (Month month : Month.MONTH) {
- StrategyMonthInfoDAO dao = IsisFishDAOHelper.getStrategyMonthInfoDAO(getTopiaContext());
+ StrategyMonthInfoDAO dao = IsisFishDAOHelper
+ .getStrategyMonthInfoDAO(getTopiaContext());
StrategyMonthInfo smi = dao.create();
smi.setMonth(month);
smi.setStrategy(this);
@@ -78,11 +110,12 @@
}
return result;
} catch (TopiaException eee) {
- throw new IsisFishRuntimeException("Can't create StrategyMonthInfo", eee);
+ throw new IsisFishRuntimeException(
+ "Can't create StrategyMonthInfo", eee);
}
}
-
- /* (non-Javadoc)
+
+ /*
* @see fr.ifremer.isisfish.entities.Strategy#getStrategyMonthInfo(fr.ifremer.isisfish.types.Month)
*/
public StrategyMonthInfo getStrategyMonthInfo(Month month) {
@@ -91,7 +124,8 @@
if (!month.equals(result.getMonth())) {
// normalement les StrategyMonthInfo sont dans l'ordre mais
// pour etre sur que ca fonctionne on fait un petit test
- log.warn("StrategyMonthInfo not in month order, i take time to find good StrategyMonthInfo");
+ log
+ .warn("StrategyMonthInfo not in month order, i take time to find good StrategyMonthInfo");
result = null;
for (StrategyMonthInfo smi : smis) {
if (month.equals(smi.getMonth())) {
@@ -102,14 +136,14 @@
}
return result;
}
-
+
/**
- * Compute or return inactivity days
- * @param length length of group
- * @param group group
+ * Compute or return inactivity days.
+ *
+ * @param month month
* @return age in month
*/
- public double getInactivityDays(Month month) {
+ public double getInactivityDays(Month month) {
double result = 0;
StrategyMonthInfo info = getStrategyMonthInfo(month);
@@ -130,20 +164,22 @@
}
return result;
}
+
public void setEquationInactivity(String content) {
try {
Equation eq = getInactivityEquation();
-
+
if (eq == null) {
- EquationDAO dao = IsisFishDAOHelper.getEquationDAO(getTopiaContext());
+ EquationDAO dao = IsisFishDAOHelper
+ .getEquationDAO(getTopiaContext());
// create Growth equation
- eq = dao.create();
+ eq = dao.create();
eq.setCategory("Inactivity");
eq.setJavaInterface(StrategyInactivityEquation.class);
eq.setLanguage(Language.JAVA);
setInactivityEquation(eq);
}
-
+
eq.setName(getName());
// Fire
@@ -156,11 +192,12 @@
fireOnPostWrite("content", _oldValue, content);
} catch (TopiaException eee) {
- throw new IsisFishRuntimeException(_("isisfish.change.equation"), eee);
+ throw new IsisFishRuntimeException(_("isisfish.change.equation"),
+ eee);
}
}
- /* (non-Javadoc)
+ /*
* @see fr.ifremer.isisfish.entities.StrategyAbstract#toString()
*/
@Override
@@ -168,5 +205,5 @@
String result = getName();
return result;
}
-
+
} //StrategyImpl
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/StrategyMonthInfoImpl.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/StrategyMonthInfoImpl.java 2009-04-07 13:14:20 UTC (rev 2080)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/StrategyMonthInfoImpl.java 2009-04-07 13:14:40 UTC (rev 2081)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2006
+ * Copyright (C) 2006 - 2009
* Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
*
* This program is free software; you can redistribute it and/or
@@ -17,22 +17,9 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*##%*/
-/* *
- * StrategyMonthInfoImpl.java
- *
- * Created: 29 août 06 11:30:27
- *
- * @author poussin
- * @version $Revision$
- *
- * Last update: $Date$
- * by : $Author$
- */
-
package fr.ifremer.isisfish.entities;
import static org.codelutin.i18n.I18n._;
-import static org.codelutin.i18n.I18n.n_;
import java.util.ArrayList;
import java.util.Collection;
@@ -47,31 +34,40 @@
import fr.ifremer.isisfish.datastore.RegionStorage;
import fr.ifremer.isisfish.datastore.StorageException;
-
/**
+ * StrategyMonthInfoImpl.
+ *
+ * Created: 29 août 06 11:30:27
+ *
* @author poussin
+ * @version $Revision$
*
+ * Last update: $Date$
+ * by : $Author$
*/
-
public class StrategyMonthInfoImpl extends StrategyMonthInfoAbstract {
- /** to use log facility, just put in your code: log.info("..."); */
- static private Log log = LogFactory.getLog(StrategyMonthInfoImpl.class);
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 4266095355294103240L;
+ /** Class logger. */
+ private static Log log = LogFactory.getLog(StrategyMonthInfoImpl.class);
+
public FisheryRegion getFisheryRegion() {
try {
- FisheryRegion result = RegionStorage.getFisheryRegion(getTopiaContext());
+ FisheryRegion result = RegionStorage
+ .getFisheryRegion(getTopiaContext());
return result;
} catch (StorageException eee) {
throw new IsisFishRuntimeException(eee);
}
}
-
+
public double getProportionMetier(Metier metier) {
double result = 0;
// on prend le super car ca ne sert a rien de mettre a jour,
// se le metier n'y ait pas on renvera 0;
- MatrixND mat = super.getProportionMetier();
+ MatrixND mat = super.getProportionMetier();
if (mat != null) {
int indice = mat.getSemantics(0).indexOf(metier);
if (indice >= 0) {
@@ -81,54 +77,53 @@
return result;
}
- public void setProportionMetier(Metier metier, double value) {
+ public void setProportionMetier(Metier metier, double value) {
MatrixND mat = getProportionMetier();
if (mat != null) {
mat = mat.copy();
mat.setValue(metier, value);
setProportionMetier(mat);
} else {
- log.warn("Can't set proportion of metier, not enough information available");
+ log
+ .warn("Can't set proportion of metier, not enough information available");
}
}
-
+
@Override
public MatrixND getProportionMetier() {
- if (getStrategy() == null
- || getStrategy().getSetOfVessels() == null
+ if (getStrategy() == null || getStrategy().getSetOfVessels() == null
|| getStrategy().getSetOfVessels().getPossibleMetiers() == null) {
return null;
}
-
- Collection<EffortDescription> efforts = getStrategy().getSetOfVessels().getPossibleMetiers();
-
+
+ Collection<EffortDescription> efforts = getStrategy().getSetOfVessels()
+ .getPossibleMetiers();
+
List<Metier> metiers = new ArrayList<Metier>(efforts.size());
for (EffortDescription effort : efforts) {
metiers.add(effort.getPossibleMetiers());
}
-
+
if (metiers.size() <= 0) {
return null;
}
-
+
MatrixND result = super.getProportionMetier();
-
+
if (result == null) {
result = MatrixFactory.getInstance().create(
_("isisfish.strategyMonthInfo.proportion"),
- new List[]{metiers},
- new String[]{_("isisfish.strategyMonthInfo.metier")}
- );
+ new List[] { metiers },
+ new String[] { _("isisfish.strategyMonthInfo.metier") });
} else if (!result.getSemantics(0).equals(metiers)) {
MatrixND tmp = MatrixFactory.getInstance().create(
_("isisfish.strategyMonthInfo.proportion"),
- new List[]{metiers},
- new String[]{_("isisfish.strategyMonthInfo.metier")}
- );
+ new List[] { metiers },
+ new String[] { _("isisfish.strategyMonthInfo.metier") });
tmp.pasteSemantics(result);
result = tmp;
}
-
+
return result;
}
@@ -140,7 +135,7 @@
super.setTripType(value);
computeNumberOfTrips();
}
-
+
/* (non-Javadoc)
* @see fr.ifremer.isisfish.entities.StrategyMonthInfoAbstract#setMinInactivityDays(int)
*/
@@ -149,29 +144,30 @@
super.setMinInactivityDays(value);
computeNumberOfTrips();
}
-
+
public void computeNumberOfTrips() {
TripType tripType = getTripType();
// remplace un simple getMinInactivityDays(), pour pouvoir utiliser une
// equation si besoin (tout est pret, il ne manque que l'interface
// graphique pour saisir l'equation dans strategie
double inactivity = getStrategy().getInactivityDays(getMonth());
- if(tripType != null && tripType.getTripDuration() != null && inactivity >= 0){
+ if (tripType != null && tripType.getTripDuration() != null
+ && inactivity >= 0) {
int nbDayMonth = getMonth().getNumbersOfDays();
- double result = (nbDayMonth - inactivity) / tripType.getTripDuration().getDay();
+ double result = (nbDayMonth - inactivity)
+ / tripType.getTripDuration().getDay();
setNumberOfTrips(result);
}
}
-
+
/* (non-Javadoc)
* @see fr.ifremer.isisfish.entities.FisheryRegionAbstract#toString()
*/
@Override
public String toString() {
- String result = _("isisfish.strategyMonthInfo.toString", this.getStrategy(), this.getMonth());
+ String result = _("isisfish.strategyMonthInfo.toString", this
+ .getStrategy(), this.getMonth());
return result;
- }
+ }
}
-
-
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/TargetSpeciesImpl.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/TargetSpeciesImpl.java 2009-04-07 13:14:20 UTC (rev 2080)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/TargetSpeciesImpl.java 2009-04-07 13:14:40 UTC (rev 2081)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2006
+ * Copyright (C) 2006 - 2009
* Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
*
* This program is free software; you can redistribute it and/or
@@ -17,18 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*##%*/
-/* *
- * TargetSpeciesImpl.java
- *
- * Created: 23 août 2006 16:38:23
- *
- * @author poussin
- * @version $Revision$
- *
- * Last update: $Date$
- * by : $Author$
- */
-
package fr.ifremer.isisfish.entities;
import static org.codelutin.i18n.I18n._;
@@ -42,17 +30,25 @@
import fr.ifremer.isisfish.equation.Language;
import fr.ifremer.isisfish.equation.TargetSpeciesTargetFactorEquation;
-
/**
+ * TargetSpeciesImpl.
+ *
+ * Created: 23 août 2006 16:38:23
+ *
* @author poussin
+ * @version $Revision$
*
+ * Last update: $Date$
+ * by : $Author$
*/
-
public class TargetSpeciesImpl extends TargetSpeciesAbstract {
- /** to use log facility, just put in your code: log.info("..."); */
- static private Log log = LogFactory.getLog(TargetSpeciesImpl.class);
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 8028733540961872729L;
+ /** Class logger. */
+ private static Log log = LogFactory.getLog(TargetSpeciesImpl.class);
+
/* (non-Javadoc)
* @see fr.ifremer.isisfish.entities.TargetSpeciesAbstract#getTargetFactorEquation()
*/
@@ -60,18 +56,20 @@
public Equation getTargetFactorEquation() {
if (super.getTargetFactorEquation() == null) {
try {
- EquationDAO dao = IsisFishDAOHelper.getEquationDAO(getTopiaContext());
+ EquationDAO dao = IsisFishDAOHelper
+ .getEquationDAO(getTopiaContext());
// create equation
- Equation eq = dao.create();
+ Equation eq = dao.create();
eq.setCategory("TargetFactor");
eq.setLanguage(Language.JAVA);
- eq.setJavaInterface(TargetSpeciesTargetFactorEquation.class);
+ eq.setJavaInterface(TargetSpeciesTargetFactorEquation.class);
eq.update();
- setTargetFactorEquation(eq);
+ setTargetFactorEquation(eq);
} catch (TopiaException eee) {
- throw new IsisFishRuntimeException(_("isisfish.error.create.equation"), eee);
+ throw new IsisFishRuntimeException(
+ _("isisfish.error.create.equation"), eee);
}
-
+
}
return super.getTargetFactorEquation();
}
@@ -80,11 +78,11 @@
* @see fr.ifremer.isisfish.entities.TargetSpeciesAbstract#setMetierSeasonInfo(fr.ifremer.isisfish.entities.MetierSeasonInfo)
*/
@Override
- public void setMetierSeasonInfo(MetierSeasonInfo value) {
+ public void setMetierSeasonInfo(MetierSeasonInfo value) {
super.setMetierSeasonInfo(value);
setEquationName(getTargetFactorEquation());
}
-
+
/* (non-Javadoc)
* @see fr.ifremer.isisfish.entities.TargetSpeciesAbstract#setSpecies(fr.ifremer.isisfish.entities.Species)
*/
@@ -93,16 +91,17 @@
super.setSpecies(value);
setEquationName(getTargetFactorEquation());
}
-
+
protected void setEquationName(Equation eq) {
- if (getMetierSeasonInfo() != null && getMetierSeasonInfo().getMetier() != null
+ if (getMetierSeasonInfo() != null
+ && getMetierSeasonInfo().getMetier() != null
&& getSpecies() != null) {
- eq.setName(getMetierSeasonInfo().getMetier().getName()+ "-" +
- getSpecies().getName() + "(" + getMetierSeasonInfo().toString() + ")");
+ eq.setName(getMetierSeasonInfo().getMetier().getName() + "-"
+ + getSpecies().getName() + "("
+ + getMetierSeasonInfo().toString() + ")");
}
}
-
/* (non-Javadoc)
* @see fr.ifremer.isisfish.entities.TargetSpecies#targetFactor(fr.ifremer.isisfish.entities.PopulationGroup)
*/
@@ -136,5 +135,3 @@
}
}
-
-
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 2009-04-07 13:14:20 UTC (rev 2080)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/TripTypeImpl.java 2009-04-07 13:14:40 UTC (rev 2081)
@@ -1,7 +1,24 @@
+/* *##%
+ * Copyright (C) 2006 - 2009
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
package fr.ifremer.isisfish.entities;
-import java.io.Serializable;
-
import org.codelutin.topia.TopiaException;
import fr.ifremer.isisfish.IsisFishRuntimeException;
@@ -11,9 +28,18 @@
/**
* Implantation des operations pour l'entité TripType.
+ *
+ * Created: 23 août 2006 16:38:23
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
*/
-public class TripTypeImpl extends fr.ifremer.isisfish.entities.TripTypeAbstract implements Serializable, fr.ifremer.isisfish.entities.TripType {
+public class TripTypeImpl extends TripTypeAbstract {
+ /** serialVersionUID. */
private static final long serialVersionUID = 1L;
/* (non-Javadoc)
@@ -24,23 +50,25 @@
setMinTimeBetweenTrip(new TimeUnit(0));
setTripDuration(new TimeUnit(0));
}
-
+
public FisheryRegion getFisheryRegion() {
try {
- FisheryRegion result = RegionStorage.getFisheryRegion(getTopiaContext());
+ FisheryRegion result = RegionStorage
+ .getFisheryRegion(getTopiaContext());
return result;
} catch (StorageException eee) {
throw new IsisFishRuntimeException(eee);
}
}
-
+
/* (non-Javadoc)
* @see fr.ifremer.isisfish.entities.TripTypeAbstract#toString()
*/
@Override
public String toString() {
- String result = getName() + "(" + getTripDuration() + ":" + getMinTimeBetweenTrip() + ")";
+ String result = getName() + "(" + getTripDuration() + ":"
+ + getMinTimeBetweenTrip() + ")";
return result;
}
-
+
} //TripTypeImpl
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/VesselTypeImpl.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/VesselTypeImpl.java 2009-04-07 13:14:20 UTC (rev 2080)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/VesselTypeImpl.java 2009-04-07 13:14:40 UTC (rev 2081)
@@ -1,7 +1,24 @@
+/* *##%
+ * Copyright (C) 2006 - 2009
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
package fr.ifremer.isisfish.entities;
-import java.io.Serializable;
-
import org.codelutin.topia.TopiaException;
import fr.ifremer.isisfish.IsisFishRuntimeException;
@@ -11,9 +28,18 @@
/**
* Implantation des operations pour l'entité VesselType.
+ *
+ * Created: 23 août 2006 16:38:23
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
*/
-public class VesselTypeImpl extends fr.ifremer.isisfish.entities.VesselTypeAbstract implements Serializable, fr.ifremer.isisfish.entities.VesselType {
+public class VesselTypeImpl extends VesselTypeAbstract {
+ /** serialVersionUID. */
private static final long serialVersionUID = 1L;
/* (non-Javadoc)
@@ -23,10 +49,11 @@
public void postCreate() throws TopiaException {
setMaxTripDuration(new TimeUnit(0));
}
-
+
public FisheryRegion getFisheryRegion() {
try {
- FisheryRegion result = RegionStorage.getFisheryRegion(getTopiaContext());
+ FisheryRegion result = RegionStorage
+ .getFisheryRegion(getTopiaContext());
return result;
} catch (StorageException eee) {
throw new IsisFishRuntimeException(eee);
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/ZoneImpl.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/ZoneImpl.java 2009-04-07 13:14:20 UTC (rev 2080)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/ZoneImpl.java 2009-04-07 13:14:40 UTC (rev 2081)
@@ -1,27 +1,54 @@
+/* *##%
+ * Copyright (C) 2006 - 2009
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
package fr.ifremer.isisfish.entities;
-import java.io.Serializable;
-
import fr.ifremer.isisfish.IsisFishRuntimeException;
import fr.ifremer.isisfish.datastore.RegionStorage;
import fr.ifremer.isisfish.datastore.StorageException;
/**
* Implantation des operations pour l'entité Zone.
+ *
+ * Created: 23 août 2006 16:38:23
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
*/
-public class ZoneImpl extends fr.ifremer.isisfish.entities.ZoneAbstract implements Serializable, fr.ifremer.isisfish.entities.Zone {
+public class ZoneImpl extends ZoneAbstract {
+ /** serialVersionUID. */
private static final long serialVersionUID = 1L;
public FisheryRegion getFisheryRegion() {
try {
- FisheryRegion result = RegionStorage.getFisheryRegion(getTopiaContext());
+ FisheryRegion result = RegionStorage
+ .getFisheryRegion(getTopiaContext());
return result;
} catch (StorageException eee) {
throw new IsisFishRuntimeException(eee);
}
}
-
+
/* (non-Javadoc)
* @see fr.ifremer.isisfish.entities.FisheryRegionAbstract#toString()
*/
Added: 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 (rev 0)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/package-info.java 2009-04-07 13:14:40 UTC (rev 2081)
@@ -0,0 +1,5 @@
+/**
+ * Database storage migration.
+ */
+package fr.ifremer.isisfish.entities;
+
1
0
r2080 - in isis-fish/trunk: . src/main/java/fr/ifremer/isisfish/util
by chatellier@users.labs.libre-entreprise.org 07 Apr '09
by chatellier@users.labs.libre-entreprise.org 07 Apr '09
07 Apr '09
Author: chatellier
Date: 2009-04-07 13:14:20 +0000 (Tue, 07 Apr 2009)
New Revision: 2080
Modified:
isis-fish/trunk/pom.xml
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/CompileHelper.java
Log:
Proper test coding (use forkMode=once :()
Remove bad java hack for this
Modified: isis-fish/trunk/pom.xml
===================================================================
--- isis-fish/trunk/pom.xml 2009-04-07 10:22:14 UTC (rev 2079)
+++ isis-fish/trunk/pom.xml 2009-04-07 13:14:20 UTC (rev 2080)
@@ -362,6 +362,9 @@
<xmlrpc.version>3.1</xmlrpc.version>
<javadoc.version>2.5</javadoc.version>
+ <!-- for compilation test to run -->
+ <maven.test.forkMode>once</maven.test.forkMode>
+
<!--Main class in JAR -->
<maven.jar.main.class>fr.ifremer.isisfish.IsisFish</maven.jar.main.class>
@@ -497,7 +500,6 @@
</execution>
</executions>
</plugin>
-
</plugins>
<pluginManagement>
@@ -508,7 +510,7 @@
<archive>
<manifest>
<addClasspath>true</addClasspath>
- <classpathPrefix>./lib/</classpathPrefix>
+ <classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
@@ -518,6 +520,24 @@
</build>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.5</version>
+ <configuration>
+ <links>
+ <link>http://java.sun.com/javase/6/docs/api/</link>
+ <link>http://lutinutil.labs.libre-entreprise.org/lutinutil/apidocs/</link>
+ <link>http://lutinmatrix.labs.libre-entreprise.org/lutinmatrix/apidocs/</link>
+ <link>http://topia.labs.libre-entreprise.org/topia/topia-persistence/apidocs/</link>
+ </links>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+
<!-- ************************************************************* -->
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/CompileHelper.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/CompileHelper.java 2009-04-07 10:22:14 UTC (rev 2079)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/CompileHelper.java 2009-04-07 13:14:20 UTC (rev 2080)
@@ -216,16 +216,22 @@
}
/**
- * @return
+ * Return full classpath (for compilation or javadoc) as string.
+ * Separated by {@link File.pathSeparator}.
+ *
+ * Add :
+ * <ul>
+ * <li>System.getProperty("java.class.path")
+ * <li>All first jar dependency (META-INF/MANIFEST.MF)
+ * <li>target/classes (if exists : for maven tests)
+ * </ul>
+ * @return classptah as string
*/
private static String getClassPathAsString(List<File> classpath)
throws Exception {
String result = StringUtils.join(classpath.iterator(),
File.pathSeparator)
+ File.pathSeparator + System.getProperty("java.class.path");
- if (log.isDebugEnabled()) {
- log.debug("Result : " + result);
- }
// Ajout des jars
for (Enumeration<?> e = CompileHelper.class.getClassLoader()
@@ -241,10 +247,10 @@
result += File.pathSeparator + jarName;
// FIX to launch isis with java -jar
- URL jarURL = new URL("jar",null,jarName);
+ URL jarURL = new URL("jar", null, jarName);
URL[] urls = Resource.getClassPathURLsFromJarManifest(jarURL);
for (URL url2 : urls) {
- String jarName2 = url2.getFile();
+ String jarName2 = url2.getPath();
if (!result.contains(jarName2)) {
result += File.pathSeparator + jarName2;
}
@@ -253,14 +259,6 @@
}
}
- // FIXME just for test to run in maven
- // In this case, current project in not packaged ad jar
- // and no META-INF/MANIFEST.MF could be found...
- File targetClassesFile = new File("target", "classes");
- if (targetClassesFile.isDirectory()) {
- result += File.pathSeparator + targetClassesFile.getAbsolutePath();
- }
-
if (log.isDebugEnabled()) {
log.debug("CLASSPATH : " + result);
}
1
0
r2079 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher
by chatellier@users.labs.libre-entreprise.org 07 Apr '09
by chatellier@users.labs.libre-entreprise.org 07 Apr '09
07 Apr '09
Author: chatellier
Date: 2009-04-07 10:22:14 +0000 (Tue, 07 Apr 2009)
New Revision: 2079
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java
Log:
simultation > simulation
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java 2009-04-07 10:17:25 UTC (rev 2078)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java 2009-04-07 10:22:14 UTC (rev 2079)
@@ -846,7 +846,7 @@
throws SimulationException {
try {
File tmpDirectory = FileUtil.createTempDirectory(
- "isisfish-simultation-", "-preparation");
+ "isisfish-simulation-", "-preparation");
//File regionXML = IsisConfig.getDataBackupFile(tmpDirectory);
File regionXML = new File(tmpDirectory,
SimulationStorage.DATA_BACKUP_FILENAME);
1
0
r2078 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher
by chatellier@users.labs.libre-entreprise.org 07 Apr '09
by chatellier@users.labs.libre-entreprise.org 07 Apr '09
07 Apr '09
Author: chatellier
Date: 2009-04-07 10:17:25 +0000 (Tue, 07 Apr 2009)
New Revision: 2078
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java
Log:
simultation > simulation
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java 2009-04-07 09:37:53 UTC (rev 2077)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java 2009-04-07 10:17:25 UTC (rev 2078)
@@ -723,7 +723,7 @@
param.setAnalysePlanNumber(planNumber);
File tmpDirectory = FileUtil.createTempDirectory(
- "isisfish-simultation-", "-preparation");
+ "isisfish-simulation-", "-preparation");
SimulationStorage sim = SimulationStorage
.importAndRenameZip(tmpDirectory, job
.getItem().getSimulationZip(),
1
0
r2077 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore
by chatellier@users.labs.libre-entreprise.org 07 Apr '09
by chatellier@users.labs.libre-entreprise.org 07 Apr '09
07 Apr '09
Author: chatellier
Date: 2009-04-07 09:37:53 +0000 (Tue, 07 Apr 2009)
New Revision: 2077
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/JavaSourceStorage.java
Log:
Update documentation
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 2009-04-06 17:02:39 UTC (rev 2076)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/JavaSourceStorage.java 2009-04-07 09:37:53 UTC (rev 2077)
@@ -1,5 +1,5 @@
/*
- * *##% Copyright (C) 2006 Code Lutin, Cédric Pineau, Benjamin Poussin
+ * *##% Copyright (C) 2006 - 2009 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
@@ -16,18 +16,6 @@
* Place - Suite 330, Boston, MA 02111-1307, USA. ##%
*/
-/*******************************************************************************
- * CodeSourceStorage.java
- *
- * Created: 21 janv. 2006 15:20:24
- *
- * @author poussin
- *
- * @version $Revision$
- *
- * Last update: $Date$ by : $Author$
- */
-
package fr.ifremer.isisfish.datastore;
import fr.ifremer.isisfish.IsisFishException;
@@ -40,33 +28,38 @@
import java.io.PrintWriter;
/**
- * Classes abstraite permettant la gestion des fichiers de code source
+ * Classes abstraite permettant la gestion des fichiers de code source.
+ *
+ * Exemple :
* {@link fr.ifremer.isisfish.datastore.ScriptStorage},
* {@link fr.ifremer.isisfish.datastore.RuleStorage},
* {@link fr.ifremer.isisfish.datastore.ExportStorage}
+ * {@link fr.ifremer.isisfish.datastore.SensitivityStorage}
+ * {@link fr.ifremer.isisfish.datastore.AnalysePlanStorage}
*
* @author poussin
*
+ * @version $Revision$
+ *
+ * Last update: $Date$ by : $Author$
*/
-
public abstract class JavaSourceStorage extends CodeSourceStorage {
/**
- * Contruit un nouveau rule storage
+ * Build a new java source storage.
*
- * @param rootSrc repertoire racine des sources
- * @param directory le repertoire ou devrait se trouver la classe. Ce
- * répertoire doit etre un sous répertoire de rootSrc
- * @param name le nom de la classe
+ * @param rootSrc sources root directory
+ * @param directory class location directory (rootSrc subdirectory)
+ * @param name class name
*/
protected JavaSourceStorage(File rootSrc, File directory, String name) {
super(rootSrc, directory, name, ".java");
}
/**
- * Retourne le nom complet de la class representant la classe package inclus
+ * Return class fully qualified name.
*
- * @return le nom complet avec le package
+ * @return class name including package name
*/
public String getFQN() {
String root = getRoot().getAbsolutePath();
@@ -79,11 +72,21 @@
if (result.endsWith(".java")) {
result = result.substring(0, result.length() - ".java".length());
}
-
+
return result;
}
/**
+ * Retourne le nom de la classe (sans le package) a partir d'un objet.
+ *
+ * @param instance l'instance dont on veut le nom
+ * @return le nom de la classe ou null si instance est null
+ */
+ public static String getName(Object instance) {
+ return ClassUtils.getShortClassName(instance, null);
+ }
+
+ /**
* Compile cette classe dans le répertoire par defaut de compilation
* ({@link fr.ifremer.isisfish.IsisConfig#getCompileDirectory()})
*
@@ -92,25 +95,26 @@
* @param out le flux sur lequel le resultat de la compilation doit
* apparaitre. Peut-etre null, dans ce cas les sorties standards sont
* utilisées.
- * @return 0 si la compilation a reussi une autre valeur sinon
+ * @return 0 si la compilation a reussi, une autre valeur sinon
*/
public int compile(boolean force, PrintWriter out) {
- return CompileHelper.compile(this, IsisFish.config.getCompileDirectory(), force, out);
+ return CompileHelper.compile(this, IsisFish.config
+ .getCompileDirectory(), force, out);
}
/**
- * Retourne la classe de la rule compilé. Compile le fichier si besoin
+ * Retourne la classe compilée. Compile le fichier si besoin.
*
- * @return la class representant la regle
+ * @return la class
* @throws IsisFishException
*/
- public Class getCodeClass() throws IsisFishException {
+ public Class<?> getCodeClass() throws IsisFishException {
String fqn = getFQN();
-// Class result = CompileHelper.loadClass(fqn);
-// if (result == null) {
+ // Class result = CompileHelper.loadClass(fqn);
+ // if (result == null) {
compile(false, null);
- Class result = CompileHelper.loadClass(fqn);
-// }
+ Class<?> result = CompileHelper.loadClass(fqn);
+ // }
if (result == null) {
throw new IsisFishException(_("isisfish.error.load.class", fqn));
}
@@ -118,13 +122,13 @@
}
/**
- * Retourne une nouvelle instance de la regle. Compile le fichier si besoin
+ * Retourne une nouvelle instance de la class. Compile le fichier si besoin.
*
- * @return une novuelle instance de la regle
- * @throws IsisFishException
+ * @return une nouvelle instance de la class
+ * @throws IsisFishException if can't make new instance
*/
public Object getNewInstance() throws IsisFishException {
- Class clazz = getCodeClass();
+ Class<?> clazz = getCodeClass();
Object result;
try {
result = clazz.newInstance();
@@ -137,15 +141,4 @@
}
return result;
}
-
- /**
- * Retourne le nom de la classe (sans le package) a partir d'un objet.
- *
- * @param instance l'instance dont on veut le nom
- * @return le nom de la classe ou null si instance est null
- */
- static public String getName(Object instance) {
- return ClassUtils.getShortClassName(instance, null);
- }
-
}
1
0
r2076 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util
by chatellier@users.labs.libre-entreprise.org 06 Apr '09
by chatellier@users.labs.libre-entreprise.org 06 Apr '09
06 Apr '09
Author: chatellier
Date: 2009-04-06 17:02:39 +0000 (Mon, 06 Apr 2009)
New Revision: 2076
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/CompileHelper.java
Log:
Fix classpath (search with manifest file from first jar)
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/CompileHelper.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/CompileHelper.java 2009-04-06 15:19:21 UTC (rev 2075)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/CompileHelper.java 2009-04-06 17:02:39 UTC (rev 2076)
@@ -41,6 +41,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.codelutin.util.FileUtil;
+import org.codelutin.util.Resource;
import fr.ifremer.isisfish.IsisFish;
import fr.ifremer.isisfish.datastore.JavaSourceStorage;
@@ -165,7 +166,7 @@
result = compile(classpath, src, dest, out);
} catch (Exception eee) {
if (log.isWarnEnabled()) {
- log.warn("Compilation faild", eee);
+ log.warn("Compilation failed", eee);
}
}
return result;
@@ -222,16 +223,32 @@
String result = StringUtils.join(classpath.iterator(),
File.pathSeparator)
+ File.pathSeparator + System.getProperty("java.class.path");
-
+ if (log.isDebugEnabled()) {
+ log.debug("Result : " + result);
+ }
+
// Ajout des jars
for (Enumeration<?> e = CompileHelper.class.getClassLoader()
.getResources("META-INF/MANIFEST.MF"); e.hasMoreElements();) {
URL url = (URL) e.nextElement();
+ if (log.isDebugEnabled()) {
+ log.debug("Found manifest : " + url);
+ }
if ((url != null) && url.getFile().startsWith("file:/")) {
String jarName = url.getPath().substring(5,
url.getPath().indexOf("!"));
if (!result.contains(jarName)) {
result += File.pathSeparator + jarName;
+
+ // FIX to launch isis with java -jar
+ URL jarURL = new URL("jar",null,jarName);
+ URL[] urls = Resource.getClassPathURLsFromJarManifest(jarURL);
+ for (URL url2 : urls) {
+ String jarName2 = url2.getFile();
+ if (!result.contains(jarName2)) {
+ result += File.pathSeparator + jarName2;
+ }
+ }
}
}
}
1
0
r2075 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator
by chatellier@users.labs.libre-entreprise.org 06 Apr '09
by chatellier@users.labs.libre-entreprise.org 06 Apr '09
06 Apr '09
Author: chatellier
Date: 2009-04-06 15:19:21 +0000 (Mon, 06 Apr 2009)
New Revision: 2075
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java
Log:
Replace java.util.logger by commons-logging logger
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2009-04-06 14:23:13 UTC (rev 2074)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2009-04-06 15:19:21 UTC (rev 2075)
@@ -37,8 +37,6 @@
import java.util.Properties;
import java.util.SortedMap;
import java.util.TreeMap;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import javax.swing.JComponent;
@@ -152,7 +150,9 @@
param.setResultEnabled(resultNames);
}
} catch (Exception eee) {
- log.error("Can't init SimulationParameter", eee);
+ if (log.isErrorEnabled()) {
+ log.error("Can't init SimulationParameter", eee);
+ }
showMsgBox(eee);
}
}
@@ -169,17 +169,19 @@
proper.load(fos);
param.fromProperties(SimulationStorage.getSimulationDirectory(),
proper);
- } catch (Exception ex) {
- Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE,
- null, ex);
- showMsgBox(ex);
+ } catch (Exception e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't import simulation", e);
+ }
+ showMsgBox(e);
} finally {
try {
fos.close();
- } catch (IOException ex) {
- Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE,
- null, ex);
- showMsgBox(ex);
+ } catch (IOException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't import simulation", e);
+ }
+ showMsgBox(e);
}
}
}
@@ -189,17 +191,19 @@
try {
fos = new FileOutputStream(f);
param.copy().toProperties().store(fos, simulName);
- } catch (Exception ex) {
- Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE,
- null, ex);
- showMsgBox(ex);
+ } catch (Exception e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't save simulation", e);
+ }
+ showMsgBox(e);
} finally {
try {
fos.close();
- } catch (IOException ex) {
- Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE,
- null, ex);
- showMsgBox(ex);
+ } catch (IOException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't save simulation", e);
+ }
+ showMsgBox(e);
}
}
}
@@ -231,8 +235,10 @@
protected void stopSimulation(SimulationJob job) {
job.stop();
- log.info(_("User stop simulation %s", job.getItem().getControl()
+ if (log.isInfoEnabled()) {
+ log.info(_("User stop simulation %s", job.getItem().getControl()
.getId()));
+ }
}
protected void viewLog(SimulationJob job) {
@@ -262,8 +268,11 @@
for (Rule r : param.getRules()) {
rules.put(r, RuleStorage.getName(r));
}
- } catch (Exception eee) {
- showMsgBox(eee);
+ } catch (Exception e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't change region", e);
+ }
+ showMsgBox(e);
}
}
@@ -302,7 +311,9 @@
}
}
} catch (Exception eee) {
- log.error("Can't load old Simulation: " + simulName, eee);
+ if (log.isErrorEnabled()) {
+ log.error("Can't load old Simulation: " + simulName, eee);
+ }
showMsgBox(eee);
}
}
@@ -320,10 +331,11 @@
Rule ruleTmp = ruleStorage.getNewRuleInstance();
rules.put(ruleTmp, name);
param.addRule(ruleTmp);
- } catch (IsisFishException ex) {
- Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE,
- null, ex);
- showMsgBox(ex);
+ } catch (IsisFishException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't add rule", e);
+ }
+ showMsgBox(e);
}
}
@@ -340,10 +352,11 @@
for (Rule r : param.getRules()) {
try {
result.add(RuleStorage.getName(r));
- } catch (Exception ex) {
- Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE,
- null, ex);
- showMsgBox(ex);
+ } catch (Exception e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't get rules", e);
+ }
+ showMsgBox(e);
}
}
return result;
@@ -387,10 +400,11 @@
try {
result = RuleStorage.getParameterValue(getRule(ruleName),
paramName);
- } catch (IsisFishException ex) {
- Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE,
- null, ex);
- showMsgBox(ex);
+ } catch (IsisFishException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't get rule param value", e);
+ }
+ showMsgBox(e);
}
}
return result;
@@ -401,10 +415,11 @@
if (ruleName != null) {
try {
RuleStorage.setParameterValue(getRule(ruleName), paramName, o);
- } catch (IsisFishException ex) {
- Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE,
- null, ex);
- showMsgBox(ex);
+ } catch (IsisFishException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't set rule param value", e);
+ }
+ showMsgBox(e);
}
}
}
@@ -418,10 +433,11 @@
result = RegionStorage.getFisheryRegion(tx).getStrategy();
tx.rollbackTransaction();
tx.closeContext();
- } catch (Exception ex) {
- Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE,
- null, ex);
- showMsgBox(ex);
+ } catch (Exception e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't get strategies", e);
+ }
+ showMsgBox(e);
}
return result;
}
@@ -456,10 +472,11 @@
}
tx.rollbackTransaction();
tx.closeContext();
- } catch (Exception ex) {
- Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE,
- null, ex);
- showMsgBox(ex);
+ } catch (Exception e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't get population", e);
+ }
+ showMsgBox(e);
}
return result;
}
@@ -511,14 +528,16 @@
oldSimulNames.add(0, " ");
return oldSimulNames;
- } catch (ParseException ex) {
- Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE,
- null, ex);
- showMsgBox(ex);
- } catch (IOException ex) {
- Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE,
- null, ex);
- showMsgBox(ex);
+ } catch (ParseException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't get old simulation item", e);
+ }
+ showMsgBox(e);
+ } catch (IOException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't get old simulation item", e);
+ }
+ showMsgBox(e);
}
return null;
}
@@ -580,9 +599,10 @@
if (!SensitivityExport.class.isInstance(exInstance)) {
result.add(export);
}
- } catch (IsisFishException ex) {
- Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE,
- null, ex);
+ } catch (IsisFishException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't get export names", e);
+ }
}
}
return result;
@@ -634,10 +654,11 @@
AnalysePlan ap = AnalysePlanStorage.getAnalysePlan(name)
.getNewAnalysePlanInstance();
getSimulationParameter().addAnalysePlan(ap);
- } catch (IsisFishException ex) {
- Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE,
- null, ex);
- showMsgBox(ex);
+ } catch (IsisFishException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't add analyse plan", e);
+ }
+ showMsgBox(e);
}
}
@@ -662,10 +683,11 @@
if (ap != null) {
try {
result = AnalysePlanStorage.getParameterValue(ap, paramName);
- } catch (IsisFishException ex) {
- Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE,
- null, ex);
- showMsgBox(ex);
+ } catch (IsisFishException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't get analyse plan param value", e);
+ }
+ showMsgBox(e);
}
}
return result;
@@ -679,10 +701,11 @@
}
try {
AnalysePlanStorage.setParameterValue(ap, paramName, value);
- } catch (IsisFishException ex) {
- Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE,
- null, ex);
- showMsgBox(ex);
+ } catch (IsisFishException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't set analyse plan param value", e);
+ }
+ showMsgBox(e);
}
}
@@ -700,9 +723,10 @@
if (SensitivityExport.class.isInstance(exInstance)) {
result.add(export);
}
- } catch (IsisFishException ex) {
- Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE,
- null, ex);
+ } catch (IsisFishException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't get sensitivity export names", e);
+ }
}
}
return result;
@@ -724,9 +748,10 @@
.getNewExportInstance();
sensitivityExports.put(exInstance, name);
param.setSensitivityExport(getSensitivityExportList());
- } catch (IsisFishException ex) {
- Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE,
- null, ex);
+ } catch (IsisFishException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't add sensitivity export", e);
+ }
}
}
@@ -784,9 +809,10 @@
try {
SensitivityStorage sens = SensitivityStorage.getSensitivity(name);
result = sens.getParameterNames();
- } catch (IsisFishException ex) {
- Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE,
- null, ex);
+ } catch (IsisFishException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't get sensitivity sensitivity params names", e);
+ }
}
return result;
}
@@ -796,10 +822,11 @@
try {
result = SensitivityStorage.getParameterValue(param
.getSensitivityCalculator(), paramName);
- } catch (IsisFishException ex) {
- Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE,
- null, ex);
- showMsgBox(ex);
+ } catch (IsisFishException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't get sensitivity param value", e);
+ }
+ showMsgBox(e);
}
return result;
}
@@ -811,10 +838,11 @@
SensitivityStorage.setParameterValue(param
.getSensitivityCalculator(), paramName, value);
}
- } catch (IsisFishException ex) {
- Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE,
- null, ex);
- showMsgBox(ex);
+ } catch (IsisFishException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't set sensitivity param value", e);
+ }
+ showMsgBox(e);
}
}
@@ -829,9 +857,10 @@
.getNewSensitivityInstance();
sensitivityCalculator = sensCal;
param.setSensitivityCalculator(sensitivityCalculator);
- } catch (IsisFishException ex) {
- Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE,
- null, ex);
+ } catch (IsisFishException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't set sensitivity", e);
+ }
}
}
@@ -882,8 +911,9 @@
f.setDomain(domain);
f.setComment(comment);
f.setPath(path);
- if (exist)
+ if (exist) {
removeFactor(f);
+ }
addFactor(f, c);
}
@@ -910,8 +940,9 @@
f.setComment(comment);
f.setDomain(domain);
f.setPath(path);
- if (exist)
+ if (exist) {
removeFactor(f);
+ }
addFactor(f, c);
}
1
0
r2074 - in isis-fish/trunk/src/main: java/fr/ifremer/isisfish/ui/sensitivity resources/i18n
by sletellier@users.labs.libre-entreprise.org 06 Apr '09
by sletellier@users.labs.libre-entreprise.org 06 Apr '09
06 Apr '09
Author: sletellier
Date: 2009-04-06 14:23:13 +0000 (Mon, 06 Apr 2009)
New Revision: 2074
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EquationContinuousPanel.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorAction.java
isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties
isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties
Log:
Coeficient must be under 0 and 100
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EquationContinuousPanel.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EquationContinuousPanel.jaxx 2009-04-06 13:55:51 UTC (rev 2073)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EquationContinuousPanel.jaxx 2009-04-06 14:23:13 UTC (rev 2074)
@@ -52,7 +52,7 @@
import java.util.regex.Pattern;
import org.apache.commons.lang.StringUtils;
-protected String[] columnNames = {"Name", "Value", "Coef", "Operator", "Action"};
+protected String[] columnNames = {"Name", "Value", "Coef (in %)", "Operator", "Action"};
protected java.util.List<EquationContinuousDomain> datas = new ArrayList<EquationContinuousDomain>();
protected java.util.List<JComboBox> operateurs = new ArrayList<JComboBox>();
protected java.util.List<JButton> actions = new ArrayList<JButton>();
@@ -94,7 +94,7 @@
} else if (columnIndex == 1){
return datas.get(rowIndex).getReferenceValue();
} else if (columnIndex == 2){
- return datas.get(rowIndex).getCoefficient();
+ return datas.get(rowIndex).getCoefficient() == null ? 100 : datas.get(rowIndex).getCoefficient() * 100;
} else if (columnIndex == 3){
return datas.get(rowIndex).getOperator();
} else if (columnIndex == 4){
@@ -112,7 +112,7 @@
} else if (columnIndex == 1){
datas.get(rowIndex).setReferenceValue(Double.parseDouble((String)aValue));
} else if (columnIndex == 2){
- datas.get(rowIndex).setCoefficient(Double.parseDouble((String)aValue));
+ datas.get(rowIndex).setCoefficient(Double.parseDouble((String)aValue) / 100);
} else if (columnIndex == 3){
datas.get(rowIndex).setOperator((String)aValue);
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorAction.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorAction.java 2009-04-06 13:55:51 UTC (rev 2073)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorAction.java 2009-04-06 14:23:13 UTC (rev 2074)
@@ -68,14 +68,11 @@
List<EquationContinuousDomain> domains = equationPanel.getDomains();
for (EquationContinuousDomain domain : domains) {
- if (domain.getCoefficient() != null && domain.getCoefficient() == 1){
- JOptionPane.showMessageDialog(equationPanel, _("isisfish.error.factor.coefValueIsOne"));
- }
- else if (domain.getReferenceValue() != null && domain.getCoefficient() != null && domain.getCoefficient() < 1 && domain.getCoefficient() > 0 && domain.getOperator() != null && domain.getVariableName() != null ){
+ if (domain.getReferenceValue() != null && domain.getCoefficient() != null && domain.getCoefficient() <= 100 && domain.getCoefficient() > 0 && domain.getOperator() != null && domain.getVariableName() != null ){
action.addContinuousEquationFactor(name, comment, path, domain, cOrigine, exist);
}
else {
- JOptionPane.showMessageDialog(equationPanel, _("isisfish.error.factor.invalid"));
+ JOptionPane.showMessageDialog(equationPanel, _("isisfish.error.factor.invalid") + domain.getVariableName());
}
}
} catch (Exception ex) {
Modified: isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties
===================================================================
--- isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties 2009-04-06 13:55:51 UTC (rev 2073)
+++ isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties 2009-04-06 14:23:13 UTC (rev 2074)
@@ -252,7 +252,7 @@
isisfish.error.evaluate.equation=Can't evaluate equation\: %1$s
isisfish.error.evalute.plan.script=Can't evaluate plan script
isisfish.error.factor.coefValueIsOne=Coefficient can't be equal to 1
-isisfish.error.factor.invalid=Factor is not valid
+isisfish.error.factor.invalid=Factor is not valid \:
isisfish.error.file.already.exists=The file %1$s already exist
isisfish.error.get.fisheryRegion=Can't get FisheryRegion
isisfish.error.growth.equation.before.create.group.population=Error, You must input growth equation before create the group population
Modified: isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties
===================================================================
--- isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties 2009-04-06 13:55:51 UTC (rev 2073)
+++ isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties 2009-04-06 14:23:13 UTC (rev 2074)
@@ -252,8 +252,8 @@
isisfish.error.evaluate.equation=Can't evaluate equation\: %1$s
isisfish.error.evalute.plan.script=Can't evaluate plan script
isisfish.error.factor.coefValueIsOne=Un co\u00E9fficient ne peux pas \u00EAtre \u00E9gual \u00E0 1
-isisfish.error.factor.invalid=Le facteur n'est pas valide
-isisfish.error.file.already.exists=The file %1$s already exist
+isisfish.error.factor.invalid=Le facteur n'est pas valide \:
+isisfish.error.file.already.exists\=The=file %1$s already exist
isisfish.error.get.fisheryRegion=Can't get FisheryRegion
isisfish.error.growth.equation.before.create.group.population=Error, You must input growth equation before create the group population
isisfish.error.immigration.negative=immigration negative
1
0
r2073 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity
by sletellier@users.labs.libre-entreprise.org 06 Apr '09
by sletellier@users.labs.libre-entreprise.org 06 Apr '09
06 Apr '09
Author: sletellier
Date: 2009-04-06 13:55:51 +0000 (Mon, 06 Apr 2009)
New Revision: 2073
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorAction.java
Log:
Coeficient must be under 0 and 1
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorAction.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorAction.java 2009-04-06 13:50:08 UTC (rev 2072)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorAction.java 2009-04-06 13:55:51 UTC (rev 2073)
@@ -71,7 +71,7 @@
if (domain.getCoefficient() != null && domain.getCoefficient() == 1){
JOptionPane.showMessageDialog(equationPanel, _("isisfish.error.factor.coefValueIsOne"));
}
- else if (domain.getReferenceValue() != null && domain.getCoefficient() != null && domain.getCoefficient() > 1 && domain.getOperator() != null && domain.getVariableName() != null ){
+ else if (domain.getReferenceValue() != null && domain.getCoefficient() != null && domain.getCoefficient() < 1 && domain.getCoefficient() > 0 && domain.getOperator() != null && domain.getVariableName() != null ){
action.addContinuousEquationFactor(name, comment, path, domain, cOrigine, exist);
}
else {
1
0