r2081 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities
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; +
participants (1)
-
chatellier@users.labs.libre-entreprise.org