Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3 Commits: c406f4d5 by Tony CHEMIT at 2018-04-11T11:28:45Z [N0.2] Questions sur le log (Closes #311) - - - - - 2 changed files: - t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF2Action.java - t3-domain/src/main/java/fr/ird/t3/entities/data/TripImpl.java Changes: ===================================== t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF2Action.java ===================================== --- a/t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF2Action.java +++ b/t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF2Action.java @@ -53,7 +53,9 @@ import java.util.Date; import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Set; +import java.util.stream.Collectors; import static org.nuiton.i18n.I18n.l; @@ -121,16 +123,22 @@ public class ComputeRF2Action extends AbstractLevel0Action<ComputeRF2Configurati } tripDone = TreeMultimap.create(); List<Trip> tripList = getUsableTrips(landingHarbours, true); + log.info("Trip count: "+tripList.size()); setTrips(tripList); completeTripsByVessel = ArrayListMultimap.create(); // get all trips group by the vessel ListMultimap<Vessel, Trip> tripsByVessel = TripTopiaDao.groupByVessel(tripList); + log.info("Trip vessel count: "+tripsByVessel.keySet().size()); + // compute for each vessel list of complete trip - for (Vessel vessel : tripsByVessel.keys()) { - List<Trip> tripsForVessel = new ArrayList<>(tripsByVessel.get(vessel)); + for (Map.Entry<Vessel, Collection<Trip>> entry : tripsByVessel.asMap().entrySet()) { + Vessel vessel = entry.getKey(); + List<Trip> tripsForVessel = new ArrayList<>(entry.getValue()); + log.info("Trip vessel ["+vessel.getLabel1()+"] count: "+tripsForVessel.size()); TripTopiaDao.sortTrips(tripsForVessel); // get all complete trips List<CompleteTrip> completeTrips = tripDAO.toCompleteTrip(tripsForVessel); + log.info("Complete trip vessel ["+vessel.getLabel1()+"] count: "+completeTrips.size()); completeTripsByVessel.putAll(vessel, completeTrips); } ===================================== t3-domain/src/main/java/fr/ird/t3/entities/data/TripImpl.java ===================================== --- a/t3-domain/src/main/java/fr/ird/t3/entities/data/TripImpl.java +++ b/t3-domain/src/main/java/fr/ird/t3/entities/data/TripImpl.java @@ -103,7 +103,7 @@ public class TripImpl extends TripAbstract { public boolean isLevel2Computed() { if (level2Computed == null) { level2Computed = false; - if (!isActivityEmpty()) { + if (isActivityNotEmpty()) { for (Activity a : getActivity()) { Boolean b = a.getUseMeanStratumCompositionN2(); if (b != null) { @@ -121,7 +121,7 @@ public class TripImpl extends TripAbstract { public boolean isLevel3Computed() { if (level3Computed == null) { level3Computed = false; - if (!isActivityEmpty()) { + if (isActivityNotEmpty()) { for (Activity a : getActivity()) { Boolean b = a.getUseMeanStratumCompositionN3(); if (b != null) { @@ -163,7 +163,7 @@ public class TripImpl extends TripAbstract { // @Override // public float getTotalSetsDuration() { // float result = 0; -// if (!isActivityEmpty()) { +// if (isActivityNotEmpty()) { // for (Activity activity : getActivity()) { // // // get the setDuration @@ -178,7 +178,7 @@ public class TripImpl extends TripAbstract { @Override public float getElementaryCatchTotalWeight(Collection<Species> species) { float result = 0; - if (!isActivityEmpty()) { + if (isActivityNotEmpty()) { for (Activity activity : getActivity()) { result += activity.getElementaryCatchTotalWeight(species); } @@ -189,7 +189,7 @@ public class TripImpl extends TripAbstract { @Override public float getElementaryCatchTotalWeightRf1(Collection<Species> species) { float result = 0; - if (getRf1() != null && !isActivityEmpty()) { + if (getRf1() != null && isActivityNotEmpty()) { for (Activity activity : getActivity()) { if (activity.isElementaryCatchEmpty()) { @@ -211,7 +211,7 @@ public class TripImpl extends TripAbstract { @Override public float getElementaryCatchTotalWeightRf2(Collection<Species> species) { float result = 0; - if (getRf1() != null && !isActivityEmpty()) { + if (getRf1() != null && isActivityNotEmpty()) { for (Activity activity : getActivity()) { if (activity.isElementaryCatchEmpty()) { @@ -246,7 +246,7 @@ public class TripImpl extends TripAbstract { @Override public float getElementaryLandingTotalWeight(Collection<Species> species) { float result = 0; - if (!isElementaryLandingEmpty()) { + if (isElementaryLandingNotEmpty()) { for (ElementaryLanding elementaryLanding : getElementaryLanding()) { if (species.contains(elementaryLanding.getWeightCategoryLanding().getSpecies())) { result += elementaryLanding.getWeight(); @@ -260,7 +260,7 @@ public class TripImpl extends TripAbstract { @Override public Set<Species> getElementaryCatchSpecies() { Set<Species> result = new HashSet<>(); - if (!isActivityEmpty()) { + if (isActivityNotEmpty()) { for (Activity activity : getActivity()) { if (!activity.isElementaryCatchEmpty()) { for (ElementaryCatch aCatch : activity.getElementaryCatch()) { @@ -275,7 +275,7 @@ public class TripImpl extends TripAbstract { @Override public Set<Species> getElementaryLandingSpecies() { Set<Species> result = new HashSet<>(); - if (!isElementaryLandingEmpty()) { + if (isElementaryLandingNotEmpty()) { for (ElementaryLanding landing : getElementaryLanding()) { result.add(landing.getWeightCategoryLanding().getSpecies()); } @@ -286,7 +286,7 @@ public class TripImpl extends TripAbstract { @Override public Set<Ocean> getAllOceans() { Set<Ocean> result = new HashSet<>(); - if (!isActivityEmpty()) { + if (isActivityNotEmpty()) { for (Activity activity : getActivity()) { result.add(activity.getOcean()); } View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/c406f4d5234d2c8627508b19bc4a46213... --- View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/c406f4d5234d2c8627508b19bc4a46213... You're receiving this email because of your account on gitlab.com.