Author: echatellier Date: 2016-03-01 11:43:26 +0100 (Tue, 01 Mar 2016) New Revision: 383 Url: http://forge.codelutin.com/projects/isis-fish-data/repository/revisions/383 Log: R?\195?\169?\195?\169criture des exports par pas de temps. Modified: trunk/exports/Abundances.java trunk/exports/Biomasses.java trunk/exports/CapturesNombre.java trunk/exports/CapturesNombreStrategies.java trunk/exports/CapturesPoids.java trunk/exports/CapturesPoidsStrategies.java trunk/exports/CellsDefinition.java trunk/exports/EffortsMetier.java trunk/exports/Lbar.java trunk/exports/MetierZone.java trunk/exports/NonActivite.java trunk/exports/OwnerMargin.java trunk/exports/Recruitment.java trunk/exports/RegionDefinition.java trunk/exports/RejetsNombre.java trunk/exports/RejetsPoids.java trunk/exports/VesselMargin.java trunk/exports/ZonesDefinition.java Modified: trunk/exports/Abundances.java =================================================================== --- trunk/exports/Abundances.java 2016-02-12 10:12:36 UTC (rev 382) +++ trunk/exports/Abundances.java 2016-03-01 10:43:26 UTC (rev 383) @@ -29,7 +29,7 @@ import org.nuiton.math.matrix.*; import fr.ifremer.isisfish.entities.*; -import fr.ifremer.isisfish.export.Export; +import fr.ifremer.isisfish.export.ExportStep; import fr.ifremer.isisfish.types.TimeStep; import resultinfos.MatrixAbundance; import fr.ifremer.isisfish.datastore.SimulationStorage; @@ -36,16 +36,8 @@ /** * Abundances.java - * - * Created: 1 septembre 2006 - * - * @author anonymous <anonymous@labs.libre-entreprise.org> - * @version $Revision: 1.3 $ - * - * Last update: $Date: 2007-05-24 09:30:07 $ - * by : $Author: bpoussin $ */ -public class Abundances implements Export { +public class Abundances implements ExportStep { /** to use log facility, just put in your code: log.info("..."); */ static private Log log = LogFactory.getLog(Abundances.class); @@ -71,10 +63,10 @@ @Override public String getDescription() { - return "Exporte les abondances en nombre tableau avec des lignes pop;id;zone;date;nombre."; + return "Exporte les abondances en nombre tableau avec des lignes step;pop;id;zone;nombre."; } - @Override + /*@Override public void export(SimulationStorage simulation, Writer out) throws Exception { for (Population pop : simulation.getParameter().getPopulations()) { MatrixND mat = simulation.getResultStorage().getMatrix(pop, MatrixAbundance.NAME); @@ -89,5 +81,31 @@ out.write(pop.getName() + ";" + group.getId() + ";" + zone.getName() + ";" + step.getStep() + ";" + val + "\n"); } } + }*/ + + @Override + public void exportBegin(SimulationStorage simulation, Writer out) throws Exception { + out.write("step;population;group;zone;value\n"); } + + @Override + public void export(SimulationStorage simulation, TimeStep step, Writer out) throws Exception { + for (Population pop : simulation.getParameter().getPopulations()) { + MatrixND mat = simulation.getResultStorage().getMatrix(step, pop, MatrixAbundance.NAME); + for (MatrixIterator i = mat.iterator(); i.hasNext();) { + i.next(); + Object[] sems = i.getSemanticsCoordinates(); + PopulationGroup group = (PopulationGroup) sems[0]; + Zone zone = (Zone) sems[1]; + + double val = i.getValue(); + out.write(step.getStep() + ";" + pop.getName() + ";" + group.getId() + ";" + zone.getName() + ";" + val + "\n"); + } + } + } + + @Override + public void exportEnd(SimulationStorage simulation, Writer out) throws Exception { + + } } Modified: trunk/exports/Biomasses.java =================================================================== --- trunk/exports/Biomasses.java 2016-02-12 10:12:36 UTC (rev 382) +++ trunk/exports/Biomasses.java 2016-03-01 10:43:26 UTC (rev 383) @@ -2,7 +2,7 @@ * #%L * IsisFish data * %% - * Copyright (C) 2006 - 2015 Ifremer, CodeLutin + * Copyright (C) 2006 - 2016 Ifremer, CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -29,7 +29,7 @@ import org.nuiton.math.matrix.*; import fr.ifremer.isisfish.entities.*; -import fr.ifremer.isisfish.export.Export; +import fr.ifremer.isisfish.export.ExportStep; import fr.ifremer.isisfish.types.TimeStep; import resultinfos.MatrixBiomass; import fr.ifremer.isisfish.datastore.SimulationStorage; @@ -36,16 +36,8 @@ /** * Biomasses.java - * - * Created: 23 novembre 2006 - * - * @author anonymous <anonymous@labs.libre-entreprise.org> - * @version $Revision: 1.3 $ - * - * Last update: $Date: 2007-05-24 09:30:07 $ - * by : $Author: bpoussin $ */ -public class Biomasses implements Export { +public class Biomasses implements ExportStep { /** to use log facility, just put in your code: log.info("..."); */ static private Log log = LogFactory.getLog(Biomasses.class); @@ -71,10 +63,10 @@ @Override public String getDescription() { - return "Exporte les biomasses tableau avec des lignes pop;id;zone;date;nombre"; + return "Exporte les biomasses tableau avec des lignes step;pop;id;zone;nombre"; } - @Override + /*@Override public void export(SimulationStorage simulation, Writer out) throws Exception { for (Population pop : simulation.getParameter().getPopulations()) { MatrixND mat = simulation.getResultStorage().getMatrix(pop, MatrixBiomass.NAME); @@ -89,5 +81,32 @@ out.write(pop.getName() + ";" + group.getId() + ";" + zone.getName() + ";" + step.getStep() + ";" + val + "\n"); } } + }*/ + + @Override + public void exportBegin(SimulationStorage simulation, Writer out) throws Exception { + out.write("step;population;group;zone;value\n"); } + + @Override + public void export(SimulationStorage simulation, TimeStep step, Writer out) throws Exception { + for (Population pop : simulation.getParameter().getPopulations()) { + MatrixND mat = simulation.getResultStorage().getMatrix(step, pop, MatrixBiomass.NAME); + for (MatrixIterator i = mat.iterator(); i.hasNext();) { + i.next(); + Object[] sems = i.getSemanticsCoordinates(); + PopulationGroup group = (PopulationGroup) sems[0]; + Zone zone = (Zone) sems[1]; + + double val = i.getValue(); + out.write(step.getStep() + ";" + pop.getName() + ";" + group.getId() + ";" + zone.getName() + ";" + val + "\n"); + } + } + + } + + @Override + public void exportEnd(SimulationStorage simulation, Writer out) throws Exception { + + } } Modified: trunk/exports/CapturesNombre.java =================================================================== --- trunk/exports/CapturesNombre.java 2016-02-12 10:12:36 UTC (rev 382) +++ trunk/exports/CapturesNombre.java 2016-03-01 10:43:26 UTC (rev 383) @@ -2,7 +2,7 @@ * #%L * IsisFish data * %% - * Copyright (C) 2006 - 2015 Ifremer, CodeLutin + * Copyright (C) 2006 - 2016 Ifremer, CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -26,7 +26,7 @@ import fr.ifremer.isisfish.entities.Population; import fr.ifremer.isisfish.entities.PopulationGroup; import fr.ifremer.isisfish.entities.Zone; -import fr.ifremer.isisfish.export.Export; +import fr.ifremer.isisfish.export.ExportStep; import fr.ifremer.isisfish.types.TimeStep; import resultinfos.MatrixCatchPerStrategyMetPerZonePop; @@ -41,14 +41,9 @@ * CapturesNombre.java * * Export des captures en nombre de la forme : - * Population ; Métier ; Groupe ; Zone ; Pas de temps ; Valeur - * - * @author anonymous <anonymous@labs.libre-entreprise.org> - * @version $Revision: 1.4 $ - * - * Last update: $Date: 2007-05-24 09:30:07 $ by : $Author: bpoussin $ + * Pas de temps ; Population ; Métier ; Groupe ; Zone ; Valeur */ -public class CapturesNombre implements Export { +public class CapturesNombre implements ExportStep { /** to use log facility, just put in your code: log.info("..."); */ static private Log log = LogFactory.getLog(CapturesNombre.class); @@ -77,7 +72,7 @@ return "Export les captures en nombre de la simulation. tableau pop;metier;id;zone;nombre"; } - @Override + /*@Override public void export(SimulationStorage simulation, Writer out) throws Exception { TimeStep lastStep = simulation.getResultStorage().getLastStep(); @@ -103,5 +98,35 @@ } } } + }*/ + + @Override + public void exportBegin(SimulationStorage simulation, Writer out) throws Exception { + out.write("step;population;metier;group;zone;value\n"); } + + @Override + public void export(SimulationStorage simulation, TimeStep step, Writer out) throws Exception { + for (Population pop : simulation.getParameter().getPopulations()) { + MatrixND mat = simulation.getResultStorage().getMatrix(step, pop, MatrixCatchPerStrategyMetPerZonePop.NAME); + mat = mat.sumOverDim(0); //sum on strategy + for (MatrixIterator i = mat.iterator(); i.hasNext();) { + i.next(); + Object[] sems = i.getSemanticsCoordinates(); + Metier metier = (Metier) sems[1]; + PopulationGroup group = (PopulationGroup) sems[2]; + Zone zone = (Zone) sems[3]; + + double val = i.getValue(); + out.write(step.getStep() + ";" + pop.getName() + ";" + + metier.getName() + ";" + group.getId() + ";" + + zone.getName() + ";" + val + "\n"); + } + } + } + + @Override + public void exportEnd(SimulationStorage simulation, Writer out) throws Exception { + + } } Modified: trunk/exports/CapturesNombreStrategies.java =================================================================== --- trunk/exports/CapturesNombreStrategies.java 2016-02-12 10:12:36 UTC (rev 382) +++ trunk/exports/CapturesNombreStrategies.java 2016-03-01 10:43:26 UTC (rev 383) @@ -2,7 +2,7 @@ * #%L * IsisFish data * %% - * Copyright (C) 2006 - 2014 Ifremer, CodeLutin + * Copyright (C) 2006 - 2016 Ifremer, CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -27,7 +27,7 @@ import fr.ifremer.isisfish.entities.PopulationGroup; import fr.ifremer.isisfish.entities.Strategy; import fr.ifremer.isisfish.entities.Zone; -import fr.ifremer.isisfish.export.Export; +import fr.ifremer.isisfish.export.ExportStep; import fr.ifremer.isisfish.types.TimeStep; import resultinfos.MatrixCatchPerStrategyMetPerZonePop; @@ -42,14 +42,9 @@ * CapturesNombreStrategies.java * * Export des captures en nombre de la forme : - * Population ; Stratégie ; Métier ; Groupe ; Zone ; Pas de temps ; Valeur - * - * @author anonymous <anonymous@labs.libre-entreprise.org> - * @version $Revision: 1.4 $ - * - * Last update: $Date: 2007-05-24 09:30:07 $ by : $Author: bpoussin $ + * Pas de temps ; Population ; Stratégie ; Métier ; Groupe ; Zone ; Valeur */ -public class CapturesNombreStrategies implements Export { +public class CapturesNombreStrategies implements ExportStep { /** to use log facility, just put in your code: log.info("..."); */ static private Log log = LogFactory.getLog(CapturesNombreStrategies.class); @@ -75,10 +70,10 @@ @Override public String getDescription() { - return "Export les captures en nombre de la simulation. tableau pop;strategie;metier;id;zone;nombre"; + return "Export les captures en nombre de la simulation. tableau step;pop;strategie;metier;id;zone;nombre"; } - @Override + /*@Override public void export(SimulationStorage simulation, Writer out) throws Exception { TimeStep lastStep = simulation.getResultStorage().getLastStep(); @@ -106,5 +101,35 @@ } } } + }*/ + + @Override + public void exportBegin(SimulationStorage simulation, Writer out) throws Exception { + out.write("step;population;strategy;metier;group;zone;value\n"); } + + @Override + public void export(SimulationStorage simulation, TimeStep step, Writer out) throws Exception { + for (Population pop : simulation.getParameter().getPopulations()) { + MatrixND mat = simulation.getResultStorage().getMatrix(step, pop, MatrixCatchPerStrategyMetPerZonePop.NAME); + for (MatrixIterator i = mat.iterator(); i.hasNext();) { + i.next(); + Object[] sems = i.getSemanticsCoordinates(); + Metier metier = (Metier) sems[1]; + PopulationGroup group = (PopulationGroup) sems[2]; + Zone zone = (Zone) sems[3]; + Strategy strategy = (Strategy) sems[0]; + + double val = i.getValue(); + out.write(step.getStep() + ";" + pop.getName() + ";" + strategy.getName() + ";" + + metier.getName() + ";" + group.getId() + ";" + + zone.getName() + ";" + val + "\n"); + } + } + } + + @Override + public void exportEnd(SimulationStorage simulation, Writer out) throws Exception { + + } } Modified: trunk/exports/CapturesPoids.java =================================================================== --- trunk/exports/CapturesPoids.java 2016-02-12 10:12:36 UTC (rev 382) +++ trunk/exports/CapturesPoids.java 2016-03-01 10:43:26 UTC (rev 383) @@ -2,7 +2,7 @@ * #%L * IsisFish data * %% - * Copyright (C) 2006 - 2015 Ifremer, CodeLutin + * Copyright (C) 2006 - 2016 Ifremer, CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -26,7 +26,7 @@ import fr.ifremer.isisfish.entities.Population; import fr.ifremer.isisfish.entities.PopulationGroup; import fr.ifremer.isisfish.entities.Zone; -import fr.ifremer.isisfish.export.Export; +import fr.ifremer.isisfish.export.ExportStep; import fr.ifremer.isisfish.types.TimeStep; import resultinfos.MatrixCatchWeightPerStrategyMetPerZonePop; @@ -41,14 +41,9 @@ * CapturesPoids.java * * Export des captures en poids de la forme : - * Population ; Métier ; Groupe ; Zone ; Pas de temps ; Valeur - * - * @author anonymous <anonymous@labs.libre-entreprise.org> - * @version $Revision: 1.4 $ - * - * Last update: $Date: 2007-05-24 09:30:07 $ by : $Author: bpoussin $ + * Pas de temps ; Population ; Métier ; Groupe ; Zone ; Valeur */ -public class CapturesPoids implements Export { +public class CapturesPoids implements ExportStep { /** to use log facility, just put in your code: log.info("..."); */ static private Log log = LogFactory.getLog(CapturesPoids.class); @@ -74,10 +69,10 @@ @Override public String getDescription() { - return "Export les captures en poids de la simulation. tableau pop;metier;id;zone;nombre"; + return "Export les captures en poids de la simulation. tableau step;pop;metier;id;zone;nombre"; } - @Override + /*@Override public void export(SimulationStorage simulation, Writer out) throws Exception { TimeStep lastStep = simulation.getResultStorage().getLastStep(); @@ -97,12 +92,40 @@ Zone zone = (Zone) sems[3]; double val = i.getValue(); - out.write(pop.getName() + ";" + metier.getName() + ";" - + group.getId() + ";" + zone.getName() + ";" - + step.getStep() + ";" + val + "\n"); + out.write(step.getStep() + ";" + pop.getName() + ";" + metier.getName() + ";" + + group.getId() + ";" + zone.getName() + ";" + val + "\n"); } } } } + }*/ + + @Override + public void exportBegin(SimulationStorage simulation, Writer out) throws Exception { + out.write("step;population;metier;group;zone;value\n"); } + + @Override + public void export(SimulationStorage simulation, TimeStep step, Writer out) throws Exception { + for (Population pop : simulation.getParameter().getPopulations()) { + MatrixND mat = simulation.getResultStorage().getMatrix(step, pop, MatrixCatchWeightPerStrategyMetPerZonePop.NAME); + mat = mat.sumOverDim(0); //sum on strategy + for (MatrixIterator i = mat.iterator(); i.hasNext();) { + i.next(); + Object[] sems = i.getSemanticsCoordinates(); + Metier metier = (Metier) sems[1]; + PopulationGroup group = (PopulationGroup) sems[2]; + Zone zone = (Zone) sems[3]; + + double val = i.getValue(); + out.write(step.getStep() + ";" + pop.getName() + ";" + metier.getName() + ";" + + group.getId() + ";" + zone.getName() + ";" + val + "\n"); + } + } + } + + @Override + public void exportEnd(SimulationStorage simulation, Writer out) throws Exception { + + } } Modified: trunk/exports/CapturesPoidsStrategies.java =================================================================== --- trunk/exports/CapturesPoidsStrategies.java 2016-02-12 10:12:36 UTC (rev 382) +++ trunk/exports/CapturesPoidsStrategies.java 2016-03-01 10:43:26 UTC (rev 383) @@ -2,7 +2,7 @@ * #%L * IsisFish data * %% - * Copyright (C) 2006 - 2015 Ifremer, CodeLutin + * Copyright (C) 2006 - 2016 Ifremer, CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -27,7 +27,7 @@ import fr.ifremer.isisfish.entities.PopulationGroup; import fr.ifremer.isisfish.entities.Strategy; import fr.ifremer.isisfish.entities.Zone; -import fr.ifremer.isisfish.export.Export; +import fr.ifremer.isisfish.export.ExportStep; import fr.ifremer.isisfish.types.TimeStep; import resultinfos.MatrixCatchWeightPerStrategyMetPerZonePop; @@ -42,14 +42,9 @@ * CapturesPoidsStrategies.java * * Export des captures en poids de la forme : - * Population ; Stratégie ; Métier ; Groupe ; Zone ; Pas de temps ; Valeur - * - * @author anonymous <anonymous@labs.libre-entreprise.org> - * @version $Revision: 1.4 $ - * - * Last update: $Date: 2007-05-24 09:30:07 $ by : $Author: bpoussin $ + * Pas de temps ; Population ; Stratégie ; Métier ; Groupe ; Zone ; Valeur */ -public class CapturesPoidsStrategies implements Export { +public class CapturesPoidsStrategies implements ExportStep { /** to use log facility, just put in your code: log.info("..."); */ static private Log log = LogFactory.getLog(CapturesPoidsStrategies.class); @@ -75,10 +70,10 @@ @Override public String getDescription() { - return "Export les captures en poids de la simulation. tableau pop;strategie;metier;id;zone;nombre"; + return "Export les captures en poids de la simulation. tableau step;pop;strategie;metier;id;zone;nombre"; } - @Override + /*@Override public void export(SimulationStorage simulation, Writer out) throws Exception { TimeStep lastStep = simulation.getResultStorage().getLastStep(); @@ -107,5 +102,35 @@ } } } + }*/ + + @Override + public void exportBegin(SimulationStorage simulation, Writer out) throws Exception { + out.write("step;population;strategy;metier;group;zone;value\n"); } + + @Override + public void export(SimulationStorage simulation, TimeStep step, Writer out) throws Exception { + for (Population pop : simulation.getParameter().getPopulations()) { + MatrixND mat = simulation.getResultStorage().getMatrix(step, pop, MatrixCatchWeightPerStrategyMetPerZonePop.NAME); + for (MatrixIterator i = mat.iterator(); i.hasNext();) { + i.next(); + Object[] sems = i.getSemanticsCoordinates(); + Metier metier = (Metier) sems[1]; + PopulationGroup group = (PopulationGroup) sems[2]; + Zone zone = (Zone) sems[3]; + Strategy strategy = (Strategy) sems[0]; + + double val = i.getValue(); + out.write(step.getStep() + ";" + pop.getName() + ";" + strategy.getName() + ";" + + metier.getName() + ";" + group.getId() + ";" + + zone.getName() + ";" + val + "\n"); + } + } + } + + @Override + public void exportEnd(SimulationStorage simulation, Writer out) throws Exception { + + } } Modified: trunk/exports/CellsDefinition.java =================================================================== --- trunk/exports/CellsDefinition.java 2016-02-12 10:12:36 UTC (rev 382) +++ trunk/exports/CellsDefinition.java 2016-03-01 10:43:26 UTC (rev 383) @@ -2,7 +2,7 @@ * #%L * IsisFish data * %% - * Copyright (C) 2006 - 2014 Ifremer, CodeLutin + * Copyright (C) 2006 - 2016 Ifremer, CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -30,20 +30,13 @@ import fr.ifremer.isisfish.datastore.SimulationStorage; import fr.ifremer.isisfish.entities.Cell; -import fr.ifremer.isisfish.export.Export; +import fr.ifremer.isisfish.export.ExportStep; +import fr.ifremer.isisfish.types.TimeStep; /** * CellsDefinition.java - * - * Created: 17 janvier 2007 - * - * @author bpoussin <bpoussin@labs.libre-entreprise.org> - * @version $Revision: 1.2 $ - * - * Last update: $Date: 2007-05-24 09:30:07 $ - * by : $Author: bpoussin $ */ -public class CellsDefinition implements Export { +public class CellsDefinition implements ExportStep { /** to use log facility, just put in your code: log.info("..."); */ static private Log log = LogFactory.getLog(CellsDefinition.class); @@ -75,7 +68,7 @@ return "Export cell's position(longitute/latitute)"; } - @Override + /*@Override public void export(SimulationStorage simulation, Writer out) throws Exception { TopiaContext tx = simulation.getStorage().beginTransaction(); List<Cell> cells = SimulationStorage.getFisheryRegion(tx).getCell(); @@ -85,5 +78,27 @@ } tx.closeContext(); + }*/ + + @Override + public void exportBegin(SimulationStorage simulation, Writer out) throws Exception { + out.write("cell;longitude;latitude\n"); } + + @Override + public void export(SimulationStorage simulation, TimeStep step, Writer out) throws Exception { + + } + + @Override + public void exportEnd(SimulationStorage simulation, Writer out) throws Exception { + TopiaContext tx = simulation.getStorage().beginTransaction(); + List<Cell> cells = SimulationStorage.getFisheryRegion(tx).getCell(); + + for (Cell cell : cells) { + out.write(cell + ";" + cell.getLongitude() + ";" + cell.getLatitude() + "\n"); + } + + tx.closeContext(); + } } Modified: trunk/exports/EffortsMetier.java =================================================================== --- trunk/exports/EffortsMetier.java 2016-02-12 10:12:36 UTC (rev 382) +++ trunk/exports/EffortsMetier.java 2016-03-01 10:43:26 UTC (rev 383) @@ -2,7 +2,7 @@ * #%L * IsisFish data * %% - * Copyright (C) 2006 - 2015 Ifremer, CodeLutin + * Copyright (C) 2006 - 2016 Ifremer, CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -29,7 +29,7 @@ import org.nuiton.math.matrix.*; import fr.ifremer.isisfish.entities.*; -import fr.ifremer.isisfish.export.Export; +import fr.ifremer.isisfish.export.ExportStep; import fr.ifremer.isisfish.types.TimeStep; import resultinfos.MatrixEffortPerStrategyMet; import fr.ifremer.isisfish.datastore.SimulationStorage; @@ -36,16 +36,8 @@ /** * EffortsMetier.java - * - * Created: 23 novembre 2006 - * - * @author anonymous <anonymous@labs.libre-entreprise.org> - * @version $Revision: 1.3 $ - * - * Last update: $Date: 2007-05-24 09:30:07 $ - * by : $Author: bpoussin $ */ -public class EffortsMetier implements Export { +public class EffortsMetier implements ExportStep { /** to use log facility, just put in your code: log.info("..."); */ static private Log log = LogFactory.getLog(EffortsMetier.class); @@ -71,10 +63,10 @@ @Override public String getDescription() { - return "retourne un tableau strategie;metier;date;effort"; + return "retourne un tableau step;strategie;metier;effort"; } - @Override + /*@Override public void export(SimulationStorage simulation, Writer out) throws Exception { MatrixND mat = simulation.getResultStorage().getMatrix(MatrixEffortPerStrategyMet.NAME); for (MatrixIterator i = mat.iterator(); i.hasNext();) { @@ -87,5 +79,29 @@ double val = i.getValue(); out.write(str.getName() +";"+ metier.getName() +";"+ step.getStep() +";"+ val +"\n"); } + }*/ + + @Override + public void exportBegin(SimulationStorage simulation, Writer out) throws Exception { + out.write("step;strategy;metier;value\n"); } + + @Override + public void export(SimulationStorage simulation, TimeStep step, Writer out) throws Exception { + MatrixND mat = simulation.getResultStorage().getMatrix(step, MatrixEffortPerStrategyMet.NAME); + for (MatrixIterator i = mat.iterator(); i.hasNext();) { + i.next(); + Object [] sems = i.getSemanticsCoordinates(); + Strategy str = (Strategy)sems[0]; + Metier metier = (Metier)sems[1]; + + double val = i.getValue(); + out.write(step.getStep() +";" + str.getName() + ";" + metier.getName() + ";" + val + "\n"); + } + } + + @Override + public void exportEnd(SimulationStorage simulation, Writer out) throws Exception { + + } } Modified: trunk/exports/Lbar.java =================================================================== --- trunk/exports/Lbar.java 2016-02-12 10:12:36 UTC (rev 382) +++ trunk/exports/Lbar.java 2016-03-01 10:43:26 UTC (rev 383) @@ -2,7 +2,7 @@ * #%L * IsisFish data * %% - * Copyright (C) 2015 Ifremer, CodeLutin + * Copyright (C) 2015 - 2016 Ifremer, CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -29,7 +29,7 @@ import org.nuiton.math.matrix.*; import fr.ifremer.isisfish.entities.*; -import fr.ifremer.isisfish.export.Export; +import fr.ifremer.isisfish.export.ExportStep; import fr.ifremer.isisfish.types.TimeStep; import resultinfos.MatrixLbar; import fr.ifremer.isisfish.datastore.SimulationStorage; @@ -36,13 +36,8 @@ /** * Population mean length. - * - * Created: 03/2015 - * - * @author lgasche <anonymous@labs.libre-entreprise.org> - * @version $Revision$ */ -public class Lbar implements Export { +public class Lbar implements ExportStep { /** to use log facility, just put in your code: log.info("..."); */ static private Log log = LogFactory.getLog(Lbar.class); @@ -68,10 +63,10 @@ @Override public String getDescription() { - return "Exporte les longueurs moyennes par pop par zone en tableau avec des lignes pop;zone;date;longueur."; + return "Exporte les longueurs moyennes par pop par zone en tableau avec des lignes step;pop;zone;longueur."; } - @Override + /*@Override public void export(SimulationStorage simulation, Writer out) throws Exception { for (Population pop : simulation.getParameter().getPopulations()) { MatrixND mat = simulation.getResultStorage().getMatrix(pop, MatrixLbar.NAME); @@ -85,5 +80,30 @@ out.write(pop.getName() + ";" + zone.getName() + ";" + step.getStep() + ";" + val + "\n"); } } + }*/ + + @Override + public void exportBegin(SimulationStorage simulation, Writer out) throws Exception { + out.write("step;population;zone;value\n"); } + + @Override + public void export(SimulationStorage simulation, TimeStep step, Writer out) throws Exception { + for (Population pop : simulation.getParameter().getPopulations()) { + MatrixND mat = simulation.getResultStorage().getMatrix(step, pop, MatrixLbar.NAME); + for (MatrixIterator i = mat.iterator(); i.hasNext();) { + i.next(); + Object[] sems = i.getSemanticsCoordinates(); + Zone zone = (Zone) sems[0]; + + double val = i.getValue(); + out.write(step.getStep() + ";" + pop.getName() + ";" + zone.getName() + ";" + val + "\n"); + } + } + } + + @Override + public void exportEnd(SimulationStorage simulation, Writer out) throws Exception { + + } } Modified: trunk/exports/MetierZone.java =================================================================== --- trunk/exports/MetierZone.java 2016-02-12 10:12:36 UTC (rev 382) +++ trunk/exports/MetierZone.java 2016-03-01 10:43:26 UTC (rev 383) @@ -2,7 +2,7 @@ * #%L * IsisFish data * %% - * Copyright (C) 2006 - 2015 Ifremer, CodeLutin + * Copyright (C) 2006 - 2016 Ifremer, CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -29,6 +29,7 @@ import org.nuiton.math.matrix.*; import fr.ifremer.isisfish.export.Export; +import fr.ifremer.isisfish.export.ExportStep; import fr.ifremer.isisfish.types.TimeStep; import resultinfos.MatrixMetierZone; import fr.ifremer.isisfish.datastore.SimulationStorage; @@ -35,16 +36,8 @@ /** * MetierZone.java - * - * Created: 17 janvier 2007 - * - * @author bpoussin <bpoussin@labs.libre-entreprise.org> - * @version $Revision: 1.3 $ - * - * Last update: $Date: 2007-05-24 09:30:07 $ - * by : $Author: bpoussin $ */ -public class MetierZone implements Export { +public class MetierZone implements ExportStep { /** to use log facility, just put in your code: log.info("..."); */ static private Log log = LogFactory.getLog(MetierZone.class); @@ -73,7 +66,7 @@ return "Export zone used by metier during simulation"; } - @Override + /*@Override public void export(SimulationStorage simulation, Writer out) throws Exception { TimeStep lastStep = simulation.getResultStorage().getLastStep(); @@ -90,5 +83,28 @@ } } } + }*/ + + @Override + public void exportBegin(SimulationStorage simulation, Writer out) throws Exception { + out.write("step;metier;zone\n"); } + + @Override + public void export(SimulationStorage simulation, TimeStep step, Writer out) throws Exception { + MatrixND mat = simulation.getResultStorage().getMatrix(step, MatrixMetierZone.NAME); + for (MatrixIterator i = mat.iterator(); i.hasNext();) { + i.next(); + if (i.getValue() == 1) { + Object metier = i.getSemanticsCoordinates()[0]; + Object zone = i.getSemanticsCoordinates()[1]; + out.write(step.getStep() + ";" + metier + ";" + zone + "\n"); + } + } + } + + @Override + public void exportEnd(SimulationStorage simulation, Writer out) throws Exception { + + } } Modified: trunk/exports/NonActivite.java =================================================================== --- trunk/exports/NonActivite.java 2016-02-12 10:12:36 UTC (rev 382) +++ trunk/exports/NonActivite.java 2016-03-01 10:43:26 UTC (rev 383) @@ -2,7 +2,7 @@ * #%L * IsisFish data * %% - * Copyright (C) 2006 - 2015 Ifremer, CodeLutin + * Copyright (C) 2006 - 2016 Ifremer, CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -29,7 +29,7 @@ import org.nuiton.math.matrix.*; import fr.ifremer.isisfish.entities.*; -import fr.ifremer.isisfish.export.Export; +import fr.ifremer.isisfish.export.ExportStep; import fr.ifremer.isisfish.types.TimeStep; import resultinfos.MatrixNoActivity; import fr.ifremer.isisfish.datastore.SimulationStorage; @@ -36,16 +36,8 @@ /** * NonActivite.java - * - * Created: 23 novembre 2006 - * - * @author anonymous <anonymous@labs.libre-entreprise.org> - * @version $Revision: 1.3 $ - * - * Last update: $Date: 2007-05-24 09:30:07 $ - * by : $Author: bpoussin $ */ -public class NonActivite implements Export { +public class NonActivite implements ExportStep { /** to use log facility, just put in your code: log.info("..."); */ static private Log log = LogFactory.getLog(NonActivite.class); @@ -71,10 +63,10 @@ @Override public String getDescription() { - return "retourne un tableau strategie;metier;date;proportion"; + return "retourne un tableau step;strategie;metier;proportion"; } - @Override + /*@Override public void export(SimulationStorage simulation, Writer out) throws Exception { MatrixND mat = simulation.getResultStorage().getMatrix(MatrixNoActivity.NAME); for (MatrixIterator i = mat.iterator(); i.hasNext();) { @@ -87,5 +79,29 @@ double val = i.getValue(); out.write(str.getName() +";"+ metier.getName() +";"+ step.getStep() +";"+ val +"\n"); } + }*/ + + @Override + public void exportBegin(SimulationStorage simulation, Writer out) throws Exception { + out.write("step;strategy;metier;value\n"); } + + @Override + public void export(SimulationStorage simulation, TimeStep step, Writer out) throws Exception { + MatrixND mat = simulation.getResultStorage().getMatrix(step, MatrixNoActivity.NAME); + for (MatrixIterator i = mat.iterator(); i.hasNext();) { + i.next(); + Object [] sems = i.getSemanticsCoordinates(); + Strategy str = (Strategy)sems[0]; + Metier metier = (Metier)sems[1]; + + double val = i.getValue(); + out.write(step.getStep() + ";" + str.getName() + ";" + metier.getName() + ";" + val +"\n"); + } + } + + @Override + public void exportEnd(SimulationStorage simulation, Writer out) throws Exception { + + } } Modified: trunk/exports/OwnerMargin.java =================================================================== --- trunk/exports/OwnerMargin.java 2016-02-12 10:12:36 UTC (rev 382) +++ trunk/exports/OwnerMargin.java 2016-03-01 10:43:26 UTC (rev 383) @@ -2,7 +2,7 @@ * #%L * IsisFish data * %% - * Copyright (C) 2006 - 2015 Ifremer, CodeLutin + * Copyright (C) 2006 - 2016 Ifremer, CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -29,7 +29,7 @@ import org.nuiton.math.matrix.*; import fr.ifremer.isisfish.entities.*; -import fr.ifremer.isisfish.export.Export; +import fr.ifremer.isisfish.export.ExportStep; import fr.ifremer.isisfish.types.TimeStep; import resultinfos.MatrixOwnerMarginOverVariableCostsPerStrategyPerVessel; import fr.ifremer.isisfish.datastore.SimulationStorage; @@ -45,7 +45,7 @@ * Last update: $Date: 2007-05-24 09:30:07 $ * by : $Author: bpoussin $ */ -public class OwnerMargin implements Export { +public class OwnerMargin implements ExportStep { /** to use log facility, just put in your code: log.info("..."); */ static private Log log = LogFactory.getLog(OwnerMargin.class); @@ -74,7 +74,7 @@ return "Exporte les profits du patrons, retourne un tableau strategy;date;value"; } - @Override + /*@Override public void export(SimulationStorage simulation, Writer out) throws Exception { MatrixND mat = simulation.getResultStorage().getMatrix(MatrixOwnerMarginOverVariableCostsPerStrategyPerVessel.NAME); for (MatrixIterator i = mat.iterator(); i.hasNext();) { @@ -86,5 +86,28 @@ double val = i.getValue(); out.write(str.getName() +";"+ step.getStep() +";"+ val +"\n"); } + }*/ + + @Override + public void exportBegin(SimulationStorage simulation, Writer out) throws Exception { + out.write("step;strategy;value\n"); } + + @Override + public void export(SimulationStorage simulation, TimeStep step, Writer out) throws Exception { + MatrixND mat = simulation.getResultStorage().getMatrix(step, MatrixOwnerMarginOverVariableCostsPerStrategyPerVessel.NAME); + for (MatrixIterator i = mat.iterator(); i.hasNext();) { + i.next(); + Object[] sems = i.getSemanticsCoordinates(); + Strategy str = (Strategy)sems[0]; + + double val = i.getValue(); + out.write(step.getStep() + ";" + str.getName() + ";" + val + "\n"); + } + } + + @Override + public void exportEnd(SimulationStorage simulation, Writer out) throws Exception { + + } } Modified: trunk/exports/Recruitment.java =================================================================== --- trunk/exports/Recruitment.java 2016-02-12 10:12:36 UTC (rev 382) +++ trunk/exports/Recruitment.java 2016-03-01 10:43:26 UTC (rev 383) @@ -2,7 +2,7 @@ * #%L * IsisFish data * %% - * Copyright (C) 2015 Ifremer, CodeLutin + * Copyright (C) 2015 - 2016 Ifremer, CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -29,7 +29,7 @@ import org.nuiton.math.matrix.*; import fr.ifremer.isisfish.entities.*; -import fr.ifremer.isisfish.export.Export; +import fr.ifremer.isisfish.export.ExportStep; import fr.ifremer.isisfish.types.TimeStep; import resultinfos.MatrixRecruitment; import fr.ifremer.isisfish.datastore.SimulationStorage; @@ -36,13 +36,8 @@ /** * Recruitment. - * - * Created: 03/2015 - * - * @author lgasche <anonymous@labs.libre-entreprise.org> - * @version $Revision$ */ -public class Recruitment implements Export { +public class Recruitment implements ExportStep { /** to use log facility, just put in your code: log.info("..."); */ static private Log log = LogFactory.getLog(Recruitment.class); @@ -71,7 +66,7 @@ return "Exporte le recrutement par pop par en tableau avec des lignes pop;date;recrutement."; } - @Override + /*@Override public void export(SimulationStorage simulation, Writer out) throws Exception { for (Population pop : simulation.getParameter().getPopulations()) { MatrixND mat = simulation.getResultStorage().getMatrix(pop, MatrixRecruitment.NAME); @@ -84,5 +79,28 @@ out.write(pop.getName() + ";" + step.getStep() + ";" + val + "\n"); } } + }*/ + + @Override + public void exportBegin(SimulationStorage simulation, Writer out) throws Exception { + out.write("step;population;value\n"); } + + @Override + public void export(SimulationStorage simulation, TimeStep step, Writer out) throws Exception { + for (Population pop : simulation.getParameter().getPopulations()) { + MatrixND mat = simulation.getResultStorage().getMatrix(step, pop, MatrixRecruitment.NAME); + for (MatrixIterator i = mat.iterator(); i.hasNext();) { + i.next(); + + double val = i.getValue(); + out.write(pop.getName() + ";" + step.getStep() + ";" + val + "\n"); + } + } + } + + @Override + public void exportEnd(SimulationStorage simulation, Writer out) throws Exception { + + } } Modified: trunk/exports/RegionDefinition.java =================================================================== --- trunk/exports/RegionDefinition.java 2016-02-12 10:12:36 UTC (rev 382) +++ trunk/exports/RegionDefinition.java 2016-03-01 10:43:26 UTC (rev 383) @@ -2,7 +2,7 @@ * #%L * IsisFish data * %% - * Copyright (C) 2006 - 2015 Ifremer, CodeLutin + * Copyright (C) 2006 - 2016 Ifremer, CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -29,21 +29,14 @@ import org.nuiton.topia.TopiaContext; import fr.ifremer.isisfish.entities.*; -import fr.ifremer.isisfish.export.Export; +import fr.ifremer.isisfish.export.ExportStep; +import fr.ifremer.isisfish.types.TimeStep; import fr.ifremer.isisfish.datastore.SimulationStorage; /** * RegionDefinition.java - * - * Created: 17 janvier 2007 - * - * @author bpoussin <bpoussin@labs.libre-entreprise.org> - * @version $Revision: 1.3 $ - * - * Last update: $Date: 2007-05-24 10:05:22 $ - * by : $Author: bpoussin $ */ -public class RegionDefinition implements Export { +public class RegionDefinition implements ExportStep { /** to use log facility, just put in your code: log.info("..."); */ static private Log log = LogFactory.getLog(RegionDefinition.class); @@ -75,7 +68,7 @@ return "Export region description"; } - @Override + /*@Override public void export(SimulationStorage simulation, Writer out) throws Exception { // NomRegion LatituteMin LatitudeMax LongitudeMin LongitudeMax PasLatitude PasLongitude TopiaContext tx = simulation.getStorage().beginTransaction(); @@ -91,5 +84,32 @@ "\n"); tx.closeContext(); + }*/ + + @Override + public void exportBegin(SimulationStorage simulation, Writer out) throws Exception { + out.write("region;minlatitude;maxlalitude;minlongitude;maxlongitude;celllengthlatitude;celllengthlongitude\n"); } + + @Override + public void export(SimulationStorage simulation, TimeStep step, Writer out) throws Exception { + + } + + @Override + public void exportEnd(SimulationStorage simulation, Writer out) throws Exception { + TopiaContext tx = simulation.getStorage().beginTransaction(); + FisheryRegion region = SimulationStorage.getFisheryRegion(tx); + + out.write(region.getName() + ";" + + region.getMinLatitude() + ";" + + region.getMaxLatitude() + ";" + + region.getMinLongitude() + ";" + + region.getMaxLongitude() + ";" + + region.getCellLengthLatitude() + ";" + + region.getCellLengthLongitude() + + "\n"); + + tx.closeContext(); + } } Modified: trunk/exports/RejetsNombre.java =================================================================== --- trunk/exports/RejetsNombre.java 2016-02-12 10:12:36 UTC (rev 382) +++ trunk/exports/RejetsNombre.java 2016-03-01 10:43:26 UTC (rev 383) @@ -2,7 +2,7 @@ * #%L * IsisFish data * %% - * Copyright (C) 2006 - 2015 Ifremer, CodeLutin + * Copyright (C) 2006 - 2016 Ifremer, CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -33,21 +33,14 @@ import fr.ifremer.isisfish.entities.Population; import fr.ifremer.isisfish.entities.PopulationGroup; import fr.ifremer.isisfish.entities.Zone; -import fr.ifremer.isisfish.export.Export; +import fr.ifremer.isisfish.export.ExportStep; import fr.ifremer.isisfish.types.TimeStep; import resultinfos.MatrixDiscardsPerStrMetPerZonePop; /** * RejetsNombre.java - * - * Created: 23 novembre 2006 - * - * @author anonymous <anonymous@labs.libre-entreprise.org> - * @version $Revision: 1.4 $ - * - * Last update: $Date: 2007-05-24 09:30:07 $ by : $Author: bpoussin $ */ -public class RejetsNombre implements Export { +public class RejetsNombre implements ExportStep { /** to use log facility, just put in your code: log.info("..."); */ static private Log log = LogFactory.getLog(RejetsNombre.class); @@ -73,10 +66,10 @@ @Override public String getDescription() { - return "Export les rejets en nombre de la simulation. tableau pop;metier;id;zone;date;nombre"; + return "Export les rejets en nombre de la simulation. tableau step;pop;metier;id;zone;nombre"; } - @Override + /*@Override public void export(SimulationStorage simulation, Writer out) throws Exception { TimeStep lastStep = simulation.getResultStorage().getLastStep(); @@ -103,5 +96,34 @@ } } } + }*/ + + @Override + public void exportBegin(SimulationStorage simulation, Writer out) throws Exception { + out.write("step;population;metier;group;zone;value\n"); } + + @Override + public void export(SimulationStorage simulation, TimeStep step, Writer out) throws Exception { + for (Population pop : simulation.getParameter().getPopulations()) { + MatrixND mat = simulation.getResultStorage().getMatrix(step, pop, MatrixDiscardsPerStrMetPerZonePop.NAME); + mat = mat.sumOverDim(0); //sum on strategy + for (MatrixIterator i = mat.iterator(); i.hasNext();) { + i.next(); + Object[] sems = i.getSemanticsCoordinates(); + Metier metier = (Metier) sems[1]; + PopulationGroup group = (PopulationGroup) sems[2]; + Zone zone = (Zone) sems[3]; + + double val = i.getValue(); + out.write(step.getStep() + ";" + pop.getName() + ";" + metier.getName() + ";" + + group.getId() + ";" + zone.getName() + ";" + val + "\n"); + } + } + } + + @Override + public void exportEnd(SimulationStorage simulation, Writer out) throws Exception { + + } } Modified: trunk/exports/RejetsPoids.java =================================================================== --- trunk/exports/RejetsPoids.java 2016-02-12 10:12:36 UTC (rev 382) +++ trunk/exports/RejetsPoids.java 2016-03-01 10:43:26 UTC (rev 383) @@ -2,7 +2,7 @@ * #%L * IsisFish data * %% - * Copyright (C) 2006 - 2015 Ifremer, CodeLutin + * Copyright (C) 2006 - 2016 Ifremer, CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -33,21 +33,14 @@ import fr.ifremer.isisfish.entities.Population; import fr.ifremer.isisfish.entities.PopulationGroup; import fr.ifremer.isisfish.entities.Zone; -import fr.ifremer.isisfish.export.Export; +import fr.ifremer.isisfish.export.ExportStep; import fr.ifremer.isisfish.types.TimeStep; import resultinfos.MatrixDiscardsWeightPerStrMetPerZonePop; /** * RejetsPoids.java - * - * Created: 23 novembre 2006 - * - * @author anonymous <anonymous@labs.libre-entreprise.org> - * @version $Revision: 1.4 $ - * - * Last update: $Date: 2007-05-24 09:30:07 $ by : $Author: bpoussin $ */ -public class RejetsPoids implements Export { +public class RejetsPoids implements ExportStep { /** to use log facility, just put in your code: log.info("..."); */ static private Log log = LogFactory.getLog(RejetsPoids.class); @@ -73,10 +66,10 @@ @Override public String getDescription() { - return "Export les rejets en poids de la simulation. tableau pop;metier;id;zone;date;nombre"; + return "Export les rejets en poids de la simulation. tableau step;pop;metier;id;zone;nombre"; } - @Override + /*@Override public void export(SimulationStorage simulation, Writer out) throws Exception { TimeStep lastStep = simulation.getResultStorage().getLastStep(); @@ -103,5 +96,34 @@ } } } + }*/ + + @Override + public void exportBegin(SimulationStorage simulation, Writer out) throws Exception { + out.write("step;population;metier;group;zone;value\n"); } + + @Override + public void export(SimulationStorage simulation, TimeStep step, Writer out) throws Exception { + for (Population pop : simulation.getParameter().getPopulations()) { + MatrixND mat = simulation.getResultStorage().getMatrix(step, pop, MatrixDiscardsWeightPerStrMetPerZonePop.NAME); + mat = mat.sumOverDim(0); //sum on strategy + for (MatrixIterator i = mat.iterator(); i.hasNext();) { + i.next(); + Object[] sems = i.getSemanticsCoordinates(); + Metier metier = (Metier) sems[1]; + PopulationGroup group = (PopulationGroup) sems[2]; + Zone zone = (Zone) sems[3]; + + double val = i.getValue(); + out.write(step.getStep() + ";" + pop.getName() + ";" + metier.getName() + ";" + + group.getId() + ";" + zone.getName() + ";" + val + "\n"); + } + } + } + + @Override + public void exportEnd(SimulationStorage simulation, Writer out) throws Exception { + + } } Modified: trunk/exports/VesselMargin.java =================================================================== --- trunk/exports/VesselMargin.java 2016-02-12 10:12:36 UTC (rev 382) +++ trunk/exports/VesselMargin.java 2016-03-01 10:43:26 UTC (rev 383) @@ -2,7 +2,7 @@ * #%L * IsisFish data * %% - * Copyright (C) 2006 - 2015 Ifremer, CodeLutin + * Copyright (C) 2006 - 2016 Ifremer, CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -29,7 +29,7 @@ import org.nuiton.math.matrix.*; import fr.ifremer.isisfish.entities.*; -import fr.ifremer.isisfish.export.Export; +import fr.ifremer.isisfish.export.ExportStep; import fr.ifremer.isisfish.types.TimeStep; import resultinfos.MatrixVesselMarginOverVariableCostsPerStrategyPerVessel; import fr.ifremer.isisfish.datastore.SimulationStorage; @@ -36,16 +36,8 @@ /** * VesselMargin.java - * - * Created: 23 novembre 2006 - * - * @author anonymous <anonymous@labs.libre-entreprise.org> - * @version $Revision: 1.3 $ - * - * Last update: $Date: 2007-05-24 09:30:07 $ - * by : $Author: bpoussin $ */ -public class VesselMargin implements Export { +public class VesselMargin implements ExportStep { /** to use log facility, just put in your code: log.info("..."); */ static private Log log = LogFactory.getLog(VesselMargin.class); @@ -71,10 +63,10 @@ @Override public String getDescription() { - return "cvs out strategy;date;value"; + return "cvs out step;strategy;value"; } - @Override + /*@Override public void export(SimulationStorage simulation, Writer out) throws Exception { MatrixND mat = simulation.getResultStorage().getMatrix(MatrixVesselMarginOverVariableCostsPerStrategyPerVessel.NAME); for (MatrixIterator i = mat.iterator(); i.hasNext();) { @@ -86,5 +78,28 @@ double val = i.getValue(); out.write(str.getName() +";"+ step.getStep() +";"+ val +"\n"); } + }*/ + + @Override + public void exportBegin(SimulationStorage simulation, Writer out) throws Exception { + out.write("step;strategy;value\n"); } + + @Override + public void export(SimulationStorage simulation, TimeStep step, Writer out) throws Exception { + MatrixND mat = simulation.getResultStorage().getMatrix(step, MatrixVesselMarginOverVariableCostsPerStrategyPerVessel.NAME); + for (MatrixIterator i = mat.iterator(); i.hasNext();) { + i.next(); + Object [] sems = i.getSemanticsCoordinates(); + Strategy str = (Strategy)sems[0]; + + double val = i.getValue(); + out.write(step.getStep() + ";" + str.getName() + ";" + val + "\n"); + } + } + + @Override + public void exportEnd(SimulationStorage simulation, Writer out) throws Exception { + + } } Modified: trunk/exports/ZonesDefinition.java =================================================================== --- trunk/exports/ZonesDefinition.java 2016-02-12 10:12:36 UTC (rev 382) +++ trunk/exports/ZonesDefinition.java 2016-03-01 10:43:26 UTC (rev 383) @@ -2,7 +2,7 @@ * #%L * IsisFish data * %% - * Copyright (C) 2006 - 2015 Ifremer, CodeLutin + * Copyright (C) 2006 - 2016 Ifremer, CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -30,22 +30,14 @@ import org.nuiton.topia.TopiaContext; import fr.ifremer.isisfish.entities.*; -import fr.ifremer.isisfish.export.Export; +import fr.ifremer.isisfish.export.ExportStep; import fr.ifremer.isisfish.types.TimeStep; import fr.ifremer.isisfish.datastore.SimulationStorage; /** * ZonesDefinition.java - * - * Created: 17 janvier 2007 - * - * @author bpoussin <bpoussin@labs.libre-entreprise.org> - * @version $Revision: 1.2 $ - * - * Last update: $Date: 2007-05-24 09:30:07 $ - * by : $Author: bpoussin $ */ -public class ZonesDefinition implements Export { +public class ZonesDefinition implements ExportStep { /** to use log facility, just put in your code: log.info("..."); */ static private Log log = LogFactory.getLog(ZonesDefinition.class); @@ -77,7 +69,7 @@ return "Export cell's zone constitution"; } - @Override + /*@Override public void export(SimulationStorage simulation, Writer out) throws Exception { TopiaContext tx = simulation.getStorage().beginTransaction(); List<Zone> zones = SimulationStorage.getFisheryRegion(tx).getZone(); @@ -93,5 +85,29 @@ } tx.closeContext(); + }*/ + + @Override + public void exportBegin(SimulationStorage simulation, Writer out) throws Exception { + out.write("step;zone;cell\n"); } + + @Override + public void export(SimulationStorage simulation, TimeStep step, Writer out) throws Exception { + TopiaContext tx = simulation.getStorage().beginTransaction(); + List<Zone> zones = SimulationStorage.getFisheryRegion(tx).getZone(); + + for (Zone zone : zones) { + for (Cell cell : zone.getCell()) { + out.write(step.getStep() + ";" + zone + ";" + cell + "\n"); + } + } + + tx.closeContext(); + } + + @Override + public void exportEnd(SimulationStorage simulation, Writer out) throws Exception { + + } }
participants (1)
-
echatellier@users.forge.codelutin.com