Author: echatellier Date: 2018-04-05 10:47:25 +0200 (Thu, 05 Apr 2018) New Revision: 56 Url: http://forge.codelutin.com/projects/isis-fish-community/repository/revisions... Log: Improve code Modified: trunk/rules/GraviteVPUE1_Ponderation.java trunk/rules/TACpoids20012011.java trunk/rules/TACpoids20012011OgiveTriMerlu.java trunk/rules/TACpoids20012011TailleMin.java trunk/rules/TACpoidsPop.java trunk/rules/TACpoidsPop20082011.java trunk/rules/TACpoidsPop_PourHCR.java trunk/rules/TACpoidsTailleMin.java Modified: trunk/rules/GraviteVPUE1_Ponderation.java =================================================================== --- trunk/rules/GraviteVPUE1_Ponderation.java 2018-04-05 08:40:29 UTC (rev 55) +++ trunk/rules/GraviteVPUE1_Ponderation.java 2018-04-05 08:47:25 UTC (rev 56) @@ -64,7 +64,7 @@ /** stocke la somme des prop initiales [str x month] */ private MatrixND SommePropInitial = null; - /** stocke par strat*met, la dernière attractivite pour chaque mois [str x met x month] */ + /* stocke par strat*met, la dernere attractivite pour chaque mois [str x met x month] */ /** permet de stocker les CPUE nominales [str x met] */ private MatrixND valuePerUnitOfEffort = null; @@ -151,7 +151,7 @@ } } - /** Setting the different scenarios parameters; */ + /* Setting the different scenarios parameters; */ //fishers behavior: alpha varies between 0 (fully static) to 1 (fully dynamic); //alpha = 0.5; Modified: trunk/rules/TACpoids20012011.java =================================================================== --- trunk/rules/TACpoids20012011.java 2018-04-05 08:40:29 UTC (rev 55) +++ trunk/rules/TACpoids20012011.java 2018-04-05 08:47:25 UTC (rev 56) @@ -207,8 +207,7 @@ * @param metier le metier concerne */ @Override - public void preAction(SimulationContext context, TimeStep step, Metier metier) - throws Exception { + public void preAction(SimulationContext context, TimeStep step, Metier metier) throws Exception { affectation = true; log.info("[TAC] preAction for: " + metier); @@ -223,7 +222,7 @@ //recupere toutes les strategies pratiquant le metier et pour lesquelles la proportion !=0 SiMatrix siMatrix = SiMatrix.getSiMatrix(context); - Set<Strategy> strs = new HashSet<Strategy>(); + Set<Strategy> strs = new HashSet<>(); for (Strategy str : siMatrix.getStrategies(step)) { double prop = str.getStrategyMonthInfo(step.getMonth()) .getProportionMetier(metier); @@ -239,14 +238,14 @@ // 1er cas de figure: l'effort est reporte sur un metier de la // meme strategie, n'ayant pas l'espece comme capture principale // et pechant avec le meme engin - Set<Metier> possibleMetierCase1 = new HashSet<Metier>(); + Set<Metier> possibleMetierCase1 = new HashSet<>(); // second cas de figure: on cherche un metier de substitution // sans condition sur les engins, mais qui soit pratique - Set<Metier> possibleMetierCase2 = new HashSet<Metier>(); + Set<Metier> possibleMetierCase2 = new HashSet<>(); // 3 eme cas de figure: on cherche des metiers non vises, // sans consideration sur les engins, et pour lesquels la // proportion peut etre nulle - Set<Metier> possibleMetierCase3 = new HashSet<Metier>(); + Set<Metier> possibleMetierCase3 = new HashSet<>(); for (EffortDescription effort : str.getSetOfVessels() .getPossibleMetiers()) { Modified: trunk/rules/TACpoids20012011OgiveTriMerlu.java =================================================================== --- trunk/rules/TACpoids20012011OgiveTriMerlu.java 2018-04-05 08:40:29 UTC (rev 55) +++ trunk/rules/TACpoids20012011OgiveTriMerlu.java 2018-04-05 08:47:25 UTC (rev 56) @@ -213,8 +213,7 @@ * @param step le pas de temps courant * @param metier le metier concern */ @Override - public void preAction(SimulationContext context, TimeStep step, Metier metier) - throws Exception { + public void preAction(SimulationContext context, TimeStep step, Metier metier) throws Exception { // la preaction ne tourne que si le TAC est atteint affectation = true; @@ -233,7 +232,7 @@ //recupere toutes les strategies pratiquant le metier et pour lesquelles la proportion !=0 SiMatrix siMatrix = SiMatrix.getSiMatrix(context); - Set<Strategy> strs = new HashSet<Strategy>(); + Set<Strategy> strs = new HashSet<>(); for (Strategy str : siMatrix.getStrategies(step)) { double prop = str.getStrategyMonthInfo(step.getMonth()) .getProportionMetier(metier); @@ -249,14 +248,14 @@ // 1er cas de figure: l'effort est reporte sur un metier de la // meme strategie, n'ayant pas l'espece comme capture principale // et pechant avec le meme engin - Set<Metier> possibleMetierCase1 = new HashSet<Metier>(); + Set<Metier> possibleMetierCase1 = new HashSet<>(); // second cas de figure: on cherche un metier de substitution // sans condition sur les engins, mais qui soit pratique - Set<Metier> possibleMetierCase2 = new HashSet<Metier>(); + Set<Metier> possibleMetierCase2 = new HashSet<>(); // 3 eme cas de figure: on cherche des metiers non vises, // sans consideration sur les engins, et pour lesquels la // proportion peut etre nulle - Set<Metier> possibleMetierCase3 = new HashSet<Metier>(); + Set<Metier> possibleMetierCase3 = new HashSet<>(); for (EffortDescription effort : str.getSetOfVessels() .getPossibleMetiers()) { Modified: trunk/rules/TACpoids20012011TailleMin.java =================================================================== --- trunk/rules/TACpoids20012011TailleMin.java 2018-04-05 08:40:29 UTC (rev 55) +++ trunk/rules/TACpoids20012011TailleMin.java 2018-04-05 08:47:25 UTC (rev 56) @@ -208,8 +208,7 @@ * @param step le pas de temps courant * @param metier le metier concern */ @Override - public void preAction(SimulationContext context, TimeStep step, Metier metier) - throws Exception { + public void preAction(SimulationContext context, TimeStep step, Metier metier) throws Exception { // la preaction ne tourne que si le TAC est atteint affectation = true; @@ -228,7 +227,7 @@ //recupere toutes les strategies pratiquant le metier et pour lesquelles la proportion !=0 SiMatrix siMatrix = SiMatrix.getSiMatrix(context); - Set<Strategy> strs = new HashSet<Strategy>(); + Set<Strategy> strs = new HashSet<>(); for (Strategy str : siMatrix.getStrategies(step)) { double prop = str.getStrategyMonthInfo(step.getMonth()) .getProportionMetier(metier); @@ -244,14 +243,14 @@ // 1er cas de figure: l'effort est reporte sur un metier de la // meme strategie, n'ayant pas l'espece comme capture principale // et pechant avec le meme engin - Set<Metier> possibleMetierCase1 = new HashSet<Metier>(); + Set<Metier> possibleMetierCase1 = new HashSet<>(); // second cas de figure: on cherche un metier de substitution // sans condition sur les engins, mais qui soit pratique - Set<Metier> possibleMetierCase2 = new HashSet<Metier>(); + Set<Metier> possibleMetierCase2 = new HashSet<>(); // 3 eme cas de figure: on cherche des metiers non vises, // sans consideration sur les engins, et pour lesquels la // proportion peut etre nulle - Set<Metier> possibleMetierCase3 = new HashSet<Metier>(); + Set<Metier> possibleMetierCase3 = new HashSet<>(); for (EffortDescription effort : str.getSetOfVessels() .getPossibleMetiers()) { Modified: trunk/rules/TACpoidsPop.java =================================================================== --- trunk/rules/TACpoidsPop.java 2018-04-05 08:40:29 UTC (rev 55) +++ trunk/rules/TACpoidsPop.java 2018-04-05 08:47:25 UTC (rev 56) @@ -179,8 +179,7 @@ * @param metier le metier concerne */ @Override - public void preAction(SimulationContext context, TimeStep step, Metier metier) - throws Exception { + public void preAction(SimulationContext context, TimeStep step, Metier metier) throws Exception { affectation = false; log.info("[TAC] preAction for: " + metier); @@ -195,7 +194,7 @@ //recupere toutes les strategies pratiquant le metier et pour lesquelles la proportion !=0 SiMatrix siMatrix = SiMatrix.getSiMatrix(context); - Set<Strategy> strs = new HashSet<Strategy>(); + Set<Strategy> strs = new HashSet<>(); for (Strategy str : siMatrix.getStrategies(step)) { double prop = str.getStrategyMonthInfo(step.getMonth()) .getProportionMetier(metier); @@ -211,14 +210,14 @@ // 1er cas de figure: l'effort est reporte sur un metier de la // meme strategie, n'ayant pas l'espece comme capture principale // et pechant avec le meme engin - Set<Metier> possibleMetierCase1 = new HashSet<Metier>(); + Set<Metier> possibleMetierCase1 = new HashSet<>(); // second cas de figure: on cherche un metier de substitution // sans condition sur les engins, mais qui soit pratique - Set<Metier> possibleMetierCase2 = new HashSet<Metier>(); + Set<Metier> possibleMetierCase2 = new HashSet<>(); // 3 eme cas de figure: on cherche des metiers non vises, // sans consideration sur les engins, et pour lesquels la // proportion peut etre nulle - Set<Metier> possibleMetierCase3 = new HashSet<Metier>(); + Set<Metier> possibleMetierCase3 = new HashSet<>(); for (EffortDescription effort : str.getSetOfVessels() .getPossibleMetiers()) { Modified: trunk/rules/TACpoidsPop20082011.java =================================================================== --- trunk/rules/TACpoidsPop20082011.java 2018-04-05 08:40:29 UTC (rev 55) +++ trunk/rules/TACpoidsPop20082011.java 2018-04-05 08:47:25 UTC (rev 56) @@ -178,8 +178,7 @@ * @param metier le metier concerne */ @Override - public void preAction(SimulationContext context, TimeStep step, Metier metier) - throws Exception { + public void preAction(SimulationContext context, TimeStep step, Metier metier) throws Exception { //context.setValue("tacInTons2010", param_tacInTons2010); @@ -197,7 +196,7 @@ //recupere toutes les strategies pratiquant le metier et pour lesquelles la proportion !=0 SiMatrix siMatrix = SiMatrix.getSiMatrix(context); - Set<Strategy> strs = new HashSet<Strategy>(); + Set<Strategy> strs = new HashSet<>(); for (Strategy str : siMatrix.getStrategies(step)) { double prop = str.getStrategyMonthInfo(step.getMonth()) .getProportionMetier(metier); @@ -213,14 +212,14 @@ // 1er cas de figure: l'effort est reporte sur un metier de la // meme strategie, n'ayant pas l'espece comme capture principale // et pechant avec le meme engin - Set<Metier> possibleMetierCase1 = new HashSet<Metier>(); + Set<Metier> possibleMetierCase1 = new HashSet<>(); // second cas de figure: on cherche un metier de substitution // sans condition sur les engins, mais qui soit pratique - Set<Metier> possibleMetierCase2 = new HashSet<Metier>(); + Set<Metier> possibleMetierCase2 = new HashSet<>(); // 3 eme cas de figure: on cherche des metiers non vises, // sans consideration sur les engins, et pour lesquels la // proportion peut etre nulle - Set<Metier> possibleMetierCase3 = new HashSet<Metier>(); + Set<Metier> possibleMetierCase3 = new HashSet<>(); for (EffortDescription effort : str.getSetOfVessels() .getPossibleMetiers()) { Modified: trunk/rules/TACpoidsPop_PourHCR.java =================================================================== --- trunk/rules/TACpoidsPop_PourHCR.java 2018-04-05 08:40:29 UTC (rev 55) +++ trunk/rules/TACpoidsPop_PourHCR.java 2018-04-05 08:47:25 UTC (rev 56) @@ -122,16 +122,16 @@ public boolean condition(SimulationContext context, TimeStep step, Metier metier) throws Exception { - /** Population */ + /* Population */ //population = (Population) context.getValue("Population_TAC_HCR"); // pb avec l'utilisation des getValue - /** TAC in tonnes */ + /* TAC in tonnes */ tacInTons = (Double) context.getValue("TAC_" + param_population.getName() + "_HCR"); - /** First step at which this particular TAC is applied */ + /* First step at which this particular TAC is applied */ beginStep = (TimeStep) context.getValue("BeginStep_TAC_" + param_population.getName() + "_HCR"); endStep = beginStep.nextYear(); // One TAC a year log.info("beginStep = " + beginStep); log.info("endStep = " + endStep); - /** Proportion of fish that survives when discarded */ + /* Proportion of fish that survives when discarded */ propSurvie = (Double) context.getValue("PropSurvie_TAC_" + param_population.getName() + "_HCR"); @@ -175,8 +175,7 @@ * @param metier le metier concerne */ @Override - public void preAction(SimulationContext context, TimeStep step, Metier metier) - throws Exception { + public void preAction(SimulationContext context, TimeStep step, Metier metier) throws Exception { log.info("Using TACpoidsPop_PourHCR"); @@ -194,7 +193,7 @@ //recupere toutes les strategies pratiquant le metier et pour lesquelles la proportion !=0 SiMatrix siMatrix = SiMatrix.getSiMatrix(context); - Set<Strategy> strs = new HashSet<Strategy>(); + Set<Strategy> strs = new HashSet<>(); for (Strategy str : siMatrix.getStrategies(step)) { double prop = str.getStrategyMonthInfo(step.getMonth()) .getProportionMetier(metier); @@ -210,14 +209,14 @@ // 1er cas de figure: l'effort est reporte sur un metier de la // meme strategie, n'ayant pas l'espece comme capture principale // et pechant avec le meme engin - Set<Metier> possibleMetierCase1 = new HashSet<Metier>(); + Set<Metier> possibleMetierCase1 = new HashSet<>(); // second cas de figure: on cherche un metier de substitution // sans condition sur les engins, mais qui soit pratique - Set<Metier> possibleMetierCase2 = new HashSet<Metier>(); + Set<Metier> possibleMetierCase2 = new HashSet<>(); // 3 eme cas de figure: on cherche des metiers non vises, // sans consideration sur les engins, et pour lesquels la // proportion peut etre nulle - Set<Metier> possibleMetierCase3 = new HashSet<Metier>(); + Set<Metier> possibleMetierCase3 = new HashSet<>(); for (EffortDescription effort : str.getSetOfVessels() .getPossibleMetiers()) { Modified: trunk/rules/TACpoidsTailleMin.java =================================================================== --- trunk/rules/TACpoidsTailleMin.java 2018-04-05 08:40:29 UTC (rev 55) +++ trunk/rules/TACpoidsTailleMin.java 2018-04-05 08:47:25 UTC (rev 56) @@ -172,8 +172,7 @@ * @param metier le metier concerné */ @Override - public void preAction(SimulationContext context, TimeStep step, Metier metier) - throws Exception { + public void preAction(SimulationContext context, TimeStep step, Metier metier) throws Exception { // la preaction ne tourne que si le TAC est atteint if (tacAtteint) { @@ -190,7 +189,7 @@ //recupere toutes les strategies pratiquant le metier et pour lesquelles la proportion !=0 SiMatrix siMatrix = SiMatrix.getSiMatrix(context); - Set<Strategy> strs = new HashSet<Strategy>(); + Set<Strategy> strs = new HashSet<>(); for (Strategy str : siMatrix.getStrategies(step)) { double prop = str.getStrategyMonthInfo(step.getMonth()) .getProportionMetier(metier); @@ -206,14 +205,14 @@ // 1er cas de figure: l'effort est reporte sur un metier de la // meme strategie, n'ayant pas l'espece comme capture principale // et pechant avec le meme engin - Set<Metier> possibleMetierCase1 = new HashSet<Metier>(); + Set<Metier> possibleMetierCase1 = new HashSet<>(); // second cas de figure: on cherche un metier de substitution // sans condition sur les engins, mais qui soit pratique - Set<Metier> possibleMetierCase2 = new HashSet<Metier>(); + Set<Metier> possibleMetierCase2 = new HashSet<>(); // 3 eme cas de figure: on cherche des metiers non vises, // sans consideration sur les engins, et pour lesquels la // proportion peut etre nulle - Set<Metier> possibleMetierCase3 = new HashSet<Metier>(); + Set<Metier> possibleMetierCase3 = new HashSet<>(); for (EffortDescription effort : str.getSetOfVessels() .getPossibleMetiers()) {