|
From: <de...@us...> - 2010-02-23 23:09:48
|
Revision: 5686
http://fudaa.svn.sourceforge.net/fudaa/?rev=5686&view=rev
Author: deniger
Date: 2010-02-23 23:09:40 +0000 (Tue, 23 Feb 2010)
Log Message:
-----------
Modified Paths:
--------------
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/ctulu/CtuluAnalyze.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/common/CrueErrorManager.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/common/CrueData.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/common/CrueDataImpl.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/dao/CrueConverterDCLM.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/dao/CrueConverterDCSP.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/dao/CrueConverterDPTG.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/dao/CrueConverterDRSO.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/dao/CrueDaoStructureDPTG.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/neuf/AbstractCrue9Writer.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/neuf/DCFileReader.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/neuf/DCFileWriter.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/neuf/DHReader.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/neuf/DHWriter.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/neuf/STRFactory.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/CalcTransCasierProfilQruis.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/DonFrtConteneur.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/DonLoiHYConteneur.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/EMH.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/EMHModeleBase.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/EMHScenario.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/EMHSousModele.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/OrdPrtCIniModeleBase.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/OrdPrtGeoModeleBase.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/helper/EMHHelper.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/helper/FactoryEMH.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/helper/LoiFactory.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/projet/ScenarioExporterCrue10.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/projet/ScenarioExporterCrue9.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/projet/ScenarioLoader.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/projet/ScenarioLoaderCrue9.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/projet/ScenarioSaver.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/property/CrueLoaderProperties.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/property/PropertyValidator.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/validation/CruePrefix.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/validation/ValidateEMHProperties.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/validation/ValidateModeleScenarioWithSchema.java
trunk/soft/fudaa-crue/dodico/src/main/resources/crue-variable.csv
trunk/soft/fudaa-crue/dodico/src/main/resources/org/fudaa/dodico/crue/common/commonMessages.properties
trunk/soft/fudaa-crue/dodico/src/main/resources/org/fudaa/dodico/crue/io/ioMessages.properties
trunk/soft/fudaa-crue/dodico/src/main/resources/xsd/frag-dcsp-1.0.0.xsd
trunk/soft/fudaa-crue/dodico/src/test/java/org/fudaa/dodico/crue/common/AbstractTestCase.java
trunk/soft/fudaa-crue/dodico/src/test/java/org/fudaa/dodico/crue/comparaison/TestRequete.java
trunk/soft/fudaa-crue/dodico/src/test/java/org/fudaa/dodico/crue/io/AbstractIOTestCase.java
trunk/soft/fudaa-crue/dodico/src/test/java/org/fudaa/dodico/crue/io/TestConfigLoiReader.java
trunk/soft/fudaa-crue/dodico/src/test/java/org/fudaa/dodico/crue/io/TestCrueDCLMFile.java
trunk/soft/fudaa-crue/dodico/src/test/java/org/fudaa/dodico/crue/io/TestCrueDFRTFile.java
trunk/soft/fudaa-crue/dodico/src/test/java/org/fudaa/dodico/crue/io/TestCrueDH.java
trunk/soft/fudaa-crue/dodico/src/test/java/org/fudaa/dodico/crue/property/TestCrueNatureAndPropertyLoader.java
trunk/soft/fudaa-crue/dodico/src/test/java/org/fudaa/dodico/crue/validation/TestEMHPropertiesValidator.java
trunk/soft/fudaa-crue/dodico/src/test/java/org/fudaa/dodico/crue/validation/TestValidateModeleScenario.java
trunk/soft/fudaa-crue/fudaa/src/main/java/org/fudaa/fudaa/crue/builder/EMHGeneralBuilder.java
trunk/soft/fudaa-crue/fudaa/src/main/java/org/fudaa/fudaa/crue/common/CommonGuiLib.java
trunk/soft/fudaa-crue/fudaa/src/main/java/org/fudaa/fudaa/crue/projet/CrueProjet.java
trunk/soft/fudaa-crue/fudaa/src/main/java/org/fudaa/fudaa/crue/projet/ScenarioSaverUI.java
trunk/soft/fudaa-crue/fudaa/src/main/java/org/fudaa/fudaa/crue/view/CrueFilleEMH.java
Added Paths:
-----------
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/Sortable.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/helper/FactoryInfoEMH.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/helper/ObjetNommeComparator.java
trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/helper/RelationEMHComparator.java
Modified: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/ctulu/CtuluAnalyze.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/ctulu/CtuluAnalyze.java 2010-02-19 17:49:39 UTC (rev 5685)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/ctulu/CtuluAnalyze.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -27,6 +27,8 @@
*/
public class CtuluAnalyze {
+ public static Level FATAL = Level.ALL;
+
/**
* Constructeur par défaut
*/
@@ -129,7 +131,7 @@
* @param _m le message
*/
public void addFatalError(final String _m) {
- addError(_m);
+ addRecord(FATAL, _m);
}
/**
@@ -139,7 +141,7 @@
* @param _index le num de ligne
*/
public void addFatalError(final String _m, final int _index) {
- addErrorFromFile(_m, _index);
+ addRecord(FATAL, _m, Integer.valueOf(_index));
}
/**
@@ -147,8 +149,7 @@
* @param arg
*/
public void addFatalError(final String _m, final Object... arg) {
- // TODO a continuer
- addError(_m, arg);
+ addRecord(FATAL, _m, arg);
}
/**
@@ -158,7 +159,7 @@
* @param _in pour recuperer le num de ligne
*/
public void addFatalError(final String _m, final LineNumberReader _in) {
- addErrorFromFile(_m, _in);
+ addFatalError(_m, _in == null ? -1 : _in.getLineNumber());
}
/**
@@ -272,6 +273,10 @@
logs.clear();
}
+ public boolean containsErrorOrFatalError() {
+ return containsErrors() || containsFatalError();
+ }
+
/**
* @return true si contient au moins une erreur
*/
@@ -283,7 +288,7 @@
* @return true si contient une erreur fatale
*/
public boolean containsFatalError() {
- return containsErrors();
+ return containsLevel(FATAL);
}
/**
Modified: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/common/CrueErrorManager.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/common/CrueErrorManager.java 2010-02-19 17:49:39 UTC (rev 5685)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/common/CrueErrorManager.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -139,7 +139,7 @@
public boolean containsError() {
if (isContentEmpty()) { return false; }
for (CtuluAnalyze analyze : analyser) {
- if (analyze.containsFatalError() || analyze.containsErrors()) { return true; }
+ if (analyze.containsErrorOrFatalError()) { return true; }
}
if (groups != null) {
for (CrueErrorManager mng : groups) {
Modified: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/common/CrueData.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/common/CrueData.java 2010-02-19 17:49:39 UTC (rev 5685)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/common/CrueData.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -259,4 +259,6 @@
public CrueProperties getCruePropertyDefinitionContainer();
+ public void sort();
+
}
\ No newline at end of file
Modified: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/common/CrueDataImpl.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/common/CrueDataImpl.java 2010-02-19 17:49:39 UTC (rev 5685)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/common/CrueDataImpl.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -1,6 +1,5 @@
package org.fudaa.dodico.crue.io.common;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -70,8 +69,7 @@
* @param conteneur le conteneur
* @return le crueData qui va bien
*/
- public static CrueData buildFor(final CatEMHConteneur conteneur,
- final CrueProperties propertyDefContainer) {
+ public static CrueData buildFor(final CatEMHConteneur conteneur, final CrueProperties propertyDefContainer) {
if (conteneur.getCatType().equals(EnumTypeEMH.SCENARIO)) { return new CrueDataImpl((EMHScenario) conteneur, null,
((EMHScenario) conteneur).getConcatSousModele(), propertyDefContainer); }
if (conteneur.getCatType().equals(EnumTypeEMH.MODELE)) { return new CrueDataImpl(null, (EMHModeleBase) conteneur,
@@ -95,7 +93,7 @@
// private List<ResPrtGeo> rptg;
final EMHScenario scenarioData;
- private final EMHSousModele ssModele;
+ final EMHSousModele ssModele;
private final EMHNoeudFactory nodeFactory;
@@ -221,13 +219,14 @@
* @return
*/
public List<EMH> getAllSimpleEMH() {
- final List<EMH> listeTotale = new ArrayList<EMH>();
- listeTotale.addAll(getNoeuds());
- listeTotale.addAll(getBranches());
- listeTotale.addAll(getSections());
- listeTotale.addAll(getCasiers());
+ return EMHHelper.collectEMHInRelationEMHContient(ssModele);
+ }
- return listeTotale;
+ public void sort() {
+ scenarioData.sort();
+ modele.sort();
+ ssModele.sort();
+
}
public List<CatEMHBranche> getBranches() {
Modified: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/dao/CrueConverterDCLM.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/dao/CrueConverterDCLM.java 2010-02-19 17:49:39 UTC (rev 5685)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/dao/CrueConverterDCLM.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -388,7 +388,7 @@
loi = (LoiDF) getLoiFromReferenceDLHY(eltPersist.HydrogrammeQruis.NomRef, dataLinked, analyzer);
}
- eltMetier.setHydrogrammeQruis(loi);
+ eltMetier.setLoiTQruis(loi);
calculTransMetier.addCalcTransCasierProfilQruis(eltMetier);
}
Modified: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/dao/CrueConverterDCSP.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/dao/CrueConverterDCSP.java 2010-02-19 17:49:39 UTC (rev 5685)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/dao/CrueConverterDCSP.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -51,6 +51,8 @@
import org.fudaa.dodico.crue.metier.emh.ElemSeuilAvecPdc;
import org.fudaa.dodico.crue.metier.emh.LoiFF;
import org.fudaa.dodico.crue.metier.helper.EMHHelper;
+import org.fudaa.dodico.crue.metier.helper.FactoryInfoEMH;
+import org.fudaa.dodico.crue.property.CrueProperties;
/**
* Factory qui se charge de remplir les structures DAO du ficheir DCSP avec les donn�es m�tier et inversement.
@@ -90,8 +92,8 @@
if (casier == null) {
analyser.addInfo("io.global.cantFindCasier.error", daoCasier.NomRef);
}
- final DonCalcSansPrtCasierProfil dcsp = new DonCalcSansPrtCasierProfil(dataLinked
- .getCruePropertyDefinitionContainer());
+ CrueProperties cruePropertyDefinitionContainer = dataLinked.getCruePropertyDefinitionContainer();
+ DonCalcSansPrtCasierProfil dcsp = FactoryInfoEMH.getDCSPCasierProfil(casier, cruePropertyDefinitionContainer);
dcsp.setCoefRuis(daoCasier.CoefRuis);
casier.addInfosEMH(dcsp);
}
@@ -150,6 +152,9 @@
}
}
}
+ if (res.DonCalcSansPrtCasiers.isEmpty()) {
+ res.DonCalcSansPrtCasiers = null;
+ }
}
/**
Modified: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/dao/CrueConverterDPTG.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/dao/CrueConverterDPTG.java 2010-02-19 17:49:39 UTC (rev 5685)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/dao/CrueConverterDPTG.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -1,6 +1,7 @@
package org.fudaa.dodico.crue.io.dao;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -26,6 +27,7 @@
import org.fudaa.dodico.crue.metier.emh.PtEvolutionFF;
import org.fudaa.dodico.crue.metier.emh.PtProfil;
import org.fudaa.dodico.crue.metier.helper.EMHHelper;
+import org.fudaa.dodico.crue.metier.helper.ObjetNommeComparator;
/**
* Factory qui se charge de remplir les structures DAO du fichier DPTG avec les données métier et inversement.
@@ -114,6 +116,10 @@
saveDonPrtGeoProfilSection(analyser, res, listeProfilUniqueReference, donPrtGeoProfilSection);
}
+ Collections.sort(res.DonPrtGeoBranches, ObjetNommeComparator.INSTANCE);
+ Collections.sort(res.DonPrtGeoCasiers, ObjetNommeComparator.INSTANCE);
+ Collections.sort(res.DonPrtGeoProfilSections, ObjetNommeComparator.INSTANCE);
+ Collections.sort(res.DonPrtGeoSections, ObjetNommeComparator.INSTANCE);
return res;
}
Modified: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/dao/CrueConverterDRSO.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/dao/CrueConverterDRSO.java 2010-02-19 17:49:39 UTC (rev 5685)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/dao/CrueConverterDRSO.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -74,6 +74,7 @@
import org.fudaa.dodico.crue.metier.emh.RelationEMHSectionDansBranche;
import org.fudaa.dodico.crue.metier.emh.RelationEMHSectionDansBrancheSaintVenant;
import org.fudaa.dodico.crue.metier.helper.EMHHelper;
+import org.fudaa.dodico.crue.metier.helper.FactoryEMH;
import org.fudaa.dodico.crue.metier.helper.FactoryEMHRelation;
/**
@@ -443,7 +444,7 @@
// -- on recherche sa spécialisation --//
if (casierPersist instanceof CasierProfil) {
- casier = new EMHCasierProfil(nom);
+ casier = FactoryEMH.createCasierProfil(nom, data.getCruePropertyDefinitionContainer());
final CasierProfil casierProfilPersist = (CasierProfil) casierPersist;
if (CollectionUtils.isNotEmpty(casierProfilPersist.ProfilCasiers)) {
Modified: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/dao/CrueDaoStructureDPTG.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/dao/CrueDaoStructureDPTG.java 2010-02-19 17:49:39 UTC (rev 5685)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/dao/CrueDaoStructureDPTG.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -2,14 +2,15 @@
import java.util.List;
+import com.thoughtworks.xstream.XStream;
+
import org.fudaa.ctulu.CtuluAnalyze;
import org.fudaa.dodico.crue.io.common.CrueFileType;
import org.fudaa.dodico.crue.metier.emh.EvolutionFF;
+import org.fudaa.dodico.crue.metier.emh.ObjetNomme;
import org.fudaa.dodico.crue.metier.emh.PtProfil;
import org.fudaa.dodico.crue.property.CrueProperties;
-import com.thoughtworks.xstream.XStream;
-
/**
* Toutes les structures dao utilisées et les inits du parser xml pour le format DPTG. Toutes ces structures sont
* nécessaires pour bien formatter le contenu xml. Ici il n'y a pas besoin de définir de sttructures supplémentaires.
@@ -60,7 +61,19 @@
xstream.useAttributeFor(BrancheSaintVenant.class, "NomRef");
}
- protected static class ProfilSection {
+ protected static class ProfilSection implements ObjetNomme {
+ public String getId() {
+ return Nom;
+ }
+
+ public String getNom() {
+ return Nom;
+ }
+
+ public void setNom(String newNom) {
+ Nom = newNom;
+ }
+
protected String Nom;
/**
* optionnel.
@@ -92,7 +105,20 @@
}
- protected static class AbstractCasier {
+ protected static class AbstractCasier implements ObjetNomme {
+ public String getId() {
+ return Nom;
+ }
+
+ public String getNom() {
+ return Nom;
+ }
+
+ public void setNom(String newNom) {
+ Nom = newNom;
+
+ }
+
protected String Nom;
}
@@ -110,16 +136,41 @@
// -------------- SECTIONS -------------------//
- protected static class SectionIdem {
+ protected static class SectionIdem implements ObjetNomme {
protected String NomRef;
protected double Dz;
+
+ public String getId() {
+ return NomRef;
+ }
+
+ public String getNom() {
+ return NomRef;
+ }
+
+ public void setNom(String newNom) {
+ NomRef = newNom;
+ }
+
}
// -------------- BRANCHES -------------------//
- protected static class BrancheSaintVenant {
+ protected static class BrancheSaintVenant implements ObjetNomme {
protected String NomRef;
protected double CoefSinuo;
+ public String getId() {
+ return NomRef;
+ }
+
+ public String getNom() {
+ return NomRef;
+ }
+
+ public void setNom(String newNom) {
+ NomRef = newNom;
+ }
+
}
}
Modified: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/neuf/AbstractCrue9Writer.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/neuf/AbstractCrue9Writer.java 2010-02-19 17:49:39 UTC (rev 5685)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/neuf/AbstractCrue9Writer.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -75,11 +75,17 @@
}
final String[] titles = StringUtils.splitPreserveAllTokens(commentaire, '|');
for (int i = 0; i < Math.min(NB_LINES_TITLE, titles.length); i++) {
+ String trim = titles[i].trim();
if (writeTitre) {
- fortranWriter.stringField(0, CrueIODico.TITRE);
- fortranWriter.stringField(1, titles[i]);
+
+ if (trim.length() > 0) {
+ fortranWriter.stringField(0, CrueIODico.TITRE + " ");
+ fortranWriter.stringField(1, trim);
+ } else {
+ fortranWriter.stringField(0, CrueIODico.TITRE);
+ }
} else {
- fortranWriter.stringField(0, titles[i]);
+ fortranWriter.stringField(0, trim);
}
fortranWriter.writeFields();
}
Modified: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/neuf/DCFileReader.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/neuf/DCFileReader.java 2010-02-19 17:49:39 UTC (rev 5685)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/neuf/DCFileReader.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -85,6 +85,7 @@
import org.fudaa.dodico.crue.metier.emh.ValParamEntier;
import org.fudaa.dodico.crue.metier.helper.EMHHelper;
import org.fudaa.dodico.crue.metier.helper.FactoryEMH;
+import org.fudaa.dodico.crue.metier.helper.FactoryInfoEMH;
import org.fudaa.dodico.crue.property.CrueLoaderPropertiesDefault;
import org.fudaa.dodico.crue.property.CrueNumberUtils;
import org.fudaa.dodico.crue.validation.CruePrefix;
@@ -1355,8 +1356,8 @@
// -- on lit la suite --//
lireSuite();
- final EMHCasierProfil newCasier = new EMHCasierProfil(CruePrefix.changePrefix(idNoeud, CruePrefix.P_NOEUD,
- CruePrefix.P_CASIER));
+ final EMHCasierProfil newCasier = FactoryEMH.createCasierProfil(CruePrefix.changePrefix(idNoeud,
+ CruePrefix.P_NOEUD, CruePrefix.P_CASIER), metier.getCruePropertyDefinitionContainer());
newCasier.setUserActive(true);
CatEMHNoeud noeudRef = metier.findNoeudByReference(idNoeud);
@@ -1385,7 +1386,7 @@
// TODO utiliser TDoubleArrayList
final List<Double> abscissesLimiteX = new ArrayList<Double>();
// valeurs par defaut
- final DonCalcSansPrtCasierProfil dataDPTGQRuis = new DonCalcSansPrtCasierProfil(metier
+ DonCalcSansPrtCasierProfil dataDPTGQRuis = FactoryInfoEMH.getDCSPCasierProfil(newCasier, metier
.getCruePropertyDefinitionContainer());
newCasier.addInfosEMH(dataDPTGQRuis);
DonPrtGeoProfilCasier dataDPTG = null;
@@ -1544,7 +1545,7 @@
private LoiFF createLoiZavZam(final String idBranche) {
final LoiFF newLoi = new LoiFF();
- newLoi.setNom(CruePrefix.addPrefixIfNeeded(EnumTypeLoi.LoiZavZam, idBranche));
+ newLoi.setNom(CruePrefix.addPrefixIfNeeded(idBranche, EnumTypeLoi.LoiZavZam));
newLoi.setEvolutionFF(new EvolutionFF(new ArrayList<PtEvolutionFF>()));
newLoi.setType(EnumTypeLoi.LoiZavZam);
dataLinked.getLoiConteneur().addLois(newLoi);
@@ -2097,7 +2098,7 @@
if (comm.length() > 0) {
comm.append('|');
}
- comm.append(StringUtils.removeStart(in_.getLine(), CrueIODico.TITRE));
+ comm.append(StringUtils.removeStart(in_.getLine(), CrueIODico.TITRE).trim());
} else {
readSuite = false;
break;
Modified: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/neuf/DCFileWriter.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/neuf/DCFileWriter.java 2010-02-19 17:49:39 UTC (rev 5685)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/neuf/DCFileWriter.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -3,9 +3,12 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
+import com.thoughtworks.xstream.converters.SingleValueConverter;
+
import org.apache.commons.collections.CollectionUtils;
import org.fudaa.ctulu.CtuluActivity;
import org.fudaa.ctulu.CtuluLib;
@@ -68,8 +71,6 @@
import org.fudaa.dodico.crue.metier.helper.EMHHelper;
import org.fudaa.dodico.crue.metier.helper.LoiHelper;
-import com.thoughtworks.xstream.converters.SingleValueConverter;
-
/**
* Writer de la structure DC.
*
@@ -413,6 +414,7 @@
// écrit dans le DH
fortranWriter.doubleField(1, 1);
fortranWriter.writeFields();
+ break;
}
}
}
@@ -642,7 +644,9 @@
// LIT STOCKD 1
// LIT STOCKG 7
- for (final String key : mapNomsLits.keySet()) {
+ List<String> keySet = new ArrayList<String>(mapNomsLits.keySet());
+ Collections.sort(keySet);
+ for (final String key : keySet) {
cpt = 0;
fortranWriter.stringField(cpt++, CrueIODico.LIT);
fortranWriter.stringField(cpt++, key);
@@ -819,16 +823,17 @@
fortranWriter.stringField(indiceFortran++, carteToUse);
for (final PtEvolutionFF pt : liste) {
- // on inverse tout le temps dans dc
- fortranWriter.doubleField(indiceFortran++, pt.getY());
- fortranWriter.doubleField(indiceFortran++, pt.getX());
- cptCouples++;
if (cptCouples >= nbMaxCouples) {
indiceFortran = 0;
cptCouples = 0;
fortranWriter.writeFields(createFmtXZ());
fortranWriter.stringField(indiceFortran++, carteToUse);
}
+ // on inverse tout le temps dans dc
+ fortranWriter.doubleField(indiceFortran++, pt.getY());
+ fortranWriter.doubleField(indiceFortran++, pt.getX());
+ cptCouples++;
+
}
fortranWriter.writeFields(createFmtXZ());
}
@@ -951,8 +956,8 @@
if (branche.getDCSP() != null) {
for (final DonCalcSansPrt dcsp : branche.getDCSP()) {
if (dcsp instanceof DonCalcSansPrtBrancheSaintVenant) {
- final double ruis = ((DonCalcSansPrtBrancheSaintVenant) dcsp).getCoefRuis();
- final double alpha = ((DonCalcSansPrtBrancheSaintVenant) dcsp).getCoefBeta();
+ // final double ruis = ((DonCalcSansPrtBrancheSaintVenant) dcsp).getCoefRuis();
+ // final double alpha = ((DonCalcSansPrtBrancheSaintVenant) dcsp).getCoefBeta();
fortranWriter.stringField(0, CrueIODico.BRANCHE_RUIS);
// on met toujours 1 dans le dc, c'est le dh qui se chargera de spécifier les coef.
fortranWriter.doubleField(1, 1);
Modified: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/neuf/DHReader.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/neuf/DHReader.java 2010-02-19 17:49:39 UTC (rev 5685)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/neuf/DHReader.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -31,6 +31,7 @@
import org.fudaa.dodico.crue.metier.emh.CalcTrans;
import org.fudaa.dodico.crue.metier.emh.CalcTransBrancheOrificeManoeuvre;
import org.fudaa.dodico.crue.metier.emh.CalcTransBrancheSaintVenantQruis;
+import org.fudaa.dodico.crue.metier.emh.CalcTransCasierProfilQruis;
import org.fudaa.dodico.crue.metier.emh.CalcTransItem;
import org.fudaa.dodico.crue.metier.emh.CalcTransNoeudNiveauContinuLimnigramme;
import org.fudaa.dodico.crue.metier.emh.CalcTransNoeudNiveauContinuQapp;
@@ -88,6 +89,7 @@
import org.fudaa.dodico.crue.metier.emh.ValParamDouble;
import org.fudaa.dodico.crue.metier.helper.EMHHelper;
import org.fudaa.dodico.crue.metier.helper.FactoryEMH;
+import org.fudaa.dodico.crue.metier.helper.FactoryInfoEMH;
import org.fudaa.dodico.crue.metier.helper.LoiFactory;
import org.fudaa.dodico.crue.metier.helper.LoiHelper;
import org.fudaa.dodico.crue.property.CrueProperties;
@@ -588,18 +590,9 @@
if (casier == null) {
analyze_.addWarn("io.dh.ref.emhnoeud.coefRuis.noCasier.error", noeudName);
} else {
-
- final List<DonCalcSansPrtCasierProfil> dptis = EMHHelper.collectClass(casier.getInfosEMH(),
- DonCalcSansPrtCasierProfil.class);
- if (CollectionUtils.isEmpty(dptis)) {
- // TODO trop bizarre ! pas un coef !
- final DonCalcSansPrtCasierProfil cini = new DonCalcSansPrtCasierProfil(res
- .getCruePropertyDefinitionContainer());
- noeud.addInfosEMH(cini);
- }
- for (final DonCalcSansPrtCasierProfil condInit : dptis) {
- condInit.setCoefRuis(condInit.getCoefRuis() * coefRuis);
- }
+ final DonCalcSansPrtCasierProfil condInit = FactoryInfoEMH.getDCSPCasierProfil(casier, res
+ .getCruePropertyDefinitionContainer());
+ condInit.setCoefRuis(condInit.getCoefRuis() * coefRuis);
}
}
@@ -612,7 +605,7 @@
return true;
}
- private void addDptiInBranche(final double debitInitial, final CatEMHBranche br, CrueData res) {
+ private void addDptiInBranche(final double debitInitial, final CatEMHBranche br, final CrueData res) {
List<DonPrtCIni> dptis = br.getDPTI();
if (CollectionUtils.isEmpty(dptis)) {
if (br instanceof EMHBrancheSaintVenant) {
@@ -700,7 +693,7 @@
*/
private void readDonneesPermanentes(final CompositeReader reader, final CrueData res, final double cru)
throws IOException {
- CrueProperties cruePropertyDefinitionContainer = dataLinked.getCruePropertyDefinitionContainer();
+ final CrueProperties cruePropertyDefinitionContainer = dataLinked.getCruePropertyDefinitionContainer();
// Ligne A : DTPJ, DTPH, DTPM, DTPS, TOLZ, TOLQ, ICALMX, IPRINT, NDECOU
reader.readLine();
final Duration dtperm = readDuration(reader);
@@ -924,7 +917,7 @@
calcPerm.setNom(CruePrefix.P_CALCUL + "P" + (nbEtatPermanent + 1));
calcPerm.setDescription("Calcul permanent " + (nbEtatPermanent + 1));
// pour le premier on prend en compte la reprise éventuelle
- boolean first = ocal.getOrdCalc().isEmpty();
+ final boolean first = ocal.getOrdCalc().isEmpty();
if (reprise != null && first) {
reprise.setCalcPseudoPerm(calcPerm);
ocal.addOrdCalc(reprise);
@@ -1310,15 +1303,6 @@
while (!FIN.equalsIgnoreCase(reader.stringField(0))) {
- // TODO CDE : n'y a t-il pas une erreur dans la spec ? Car dans PdtVar de Pdt de ParamNumCalcTrans, on devrait
- // avoir comme pour ParamNumCalcPseudoPerm, NbrPdt et DureePdt
- // final CrueDate tempsDuCalcul = readDate(reader);
- // final CrueDate pasDeTempsVar = readDate(reader, 4);
- // if (isFine()) {
- // LOGGER.debug("tempsDuCalcul " + tempsDuCalcul + " pas de temps " + pasDeTempsVar);
- // }
- // final int n = reader.intField(0);
-
currentDuration = readDuration(reader, 0);
nbStepTime = (int) (currentDuration.minus(lastDuration).getStandardSeconds() / lastStepTime
@@ -1523,21 +1507,28 @@
final DonLoiHYConteneur dlhy = res.getLoiConteneur();
final List<EMHBrancheSaintVenant> branches = res.getBranchesSaintVenant();
- final String nomLoi = CruePrefix.changePrefix(calcTrans.getNom(), CruePrefix.P_BRANCHE, EnumTypeLoi.LoiTQruis);
+ final String nomLoi = CruePrefix.addPrefixIfNeeded("1", EnumTypeLoi.LoiTQruis);
final LoiDF loiDF = new LoiDF();
LoiFactory.alimenteDebutLoiDF(loiDF, nomLoi, EnumTypeLoi.LoiTQruis);
loiDF.setEvolutionFF(evolutionFF);
dlhy.addLois(loiDF);
for (final EMHBrancheSaintVenant emh : branches) {
final CalcTransBrancheSaintVenantQruis brancheSV = new CalcTransBrancheSaintVenantQruis();
-
calcTrans.addCalcTransBrancheSaintVenantQruis(brancheSV);
brancheSV.setCalculParent(calcTrans);
brancheSV.setEmh(emh);
emh.addInfosEMH(brancheSV);
brancheSV.setLoiTQruis(loiDF);
- brancheSV.setEmh(emh);
}
+ final List<EMHCasierProfil> casiers = EMHHelper.collectClass(res.getCasiers(), EMHCasierProfil.class);
+ for (final EMHCasierProfil casier : casiers) {
+ final CalcTransCasierProfilQruis ctProfil = new CalcTransCasierProfilQruis();
+ calcTrans.addCalcTransCasierProfilQruis(ctProfil);
+ ctProfil.setCalculParent(calcTrans);
+ ctProfil.setEmh(casier);
+ casier.addInfosEMH(ctProfil);
+ ctProfil.setLoiTQruis(loiDF);
+ }
}
@@ -1582,7 +1573,7 @@
if (nncTrans instanceof CalcTransNoeudNiveauContinuQapp) {
- nomLoi = CruePrefix.changePrefix(nomEmh, CruePrefix.P_NOEUD, EnumTypeLoi.LoiTQapp);
+ nomLoi = CruePrefix.addPrefixIfNeeded(nomEmh, EnumTypeLoi.LoiTQapp);
final Loi loi = LoiHelper.findByReference(nomLoi, dlhy.getLois());
if (loi == null) {
final LoiDF loiDF = new LoiDF();
@@ -1598,7 +1589,7 @@
} else if (nncTrans instanceof CalcTransNoeudNiveauContinuLimnigramme) {
- nomLoi = CruePrefix.changePrefix(nomEmh, CruePrefix.P_NOEUD, EnumTypeLoi.LoiTZ);
+ nomLoi = CruePrefix.addPrefixIfNeeded(nomEmh, EnumTypeLoi.LoiTZ);
final Loi loi = LoiHelper.findByReference(nomLoi, dlhy.getLois());
if (loi == null) {
final LoiDF loiDF = new LoiDF();
@@ -1614,7 +1605,7 @@
} else if (nncTrans instanceof CalcTransNoeudNiveauContinuTarage) {
- nomLoi = CruePrefix.changePrefix(nomEmh, CruePrefix.P_NOEUD, EnumTypeLoi.LoiQZ);
+ nomLoi = CruePrefix.addPrefixIfNeeded(nomEmh, EnumTypeLoi.LoiQZ);
final Loi loi = LoiHelper.findByReference(nomLoi, dlhy.getLois());
if (loi == null) {
final LoiFF loiFF = new LoiFF();
@@ -1649,8 +1640,7 @@
if (brancheOrManoeuvre.getNomCalculParent() != null
&& brancheOrManoeuvre.getNomCalculParent().equals(calcTrans.getNom())) {
- nomLoi = CruePrefix.changePrefix(nomEmh, CruePrefix.P_BRANCHE, EnumTypeLoi.LoiTOuv, brancheOrManoeuvre
- .getSensOuv());
+ nomLoi = CruePrefix.addPrefix(nomEmh, EnumTypeLoi.LoiTOuv, brancheOrManoeuvre.getSensOuv());
final Loi loi = LoiHelper.findByReference(nomLoi, dlhy.getLois());
if (loi == null) {
final LoiDF loiDF = new LoiDF();
@@ -1814,22 +1804,9 @@
private void initialiseRuisInCasier(final double cofqrq, final CrueData crueData) {
final List<CatEMHCasier> casiers = crueData.getCasiers();
for (final CatEMHCasier casier : casiers) {
- final List<DonCalcSansPrtCasierProfil> dcsps = EMHHelper.collectClass(casier.getDCSP(),
- DonCalcSansPrtCasierProfil.class);
- if (CollectionUtils.isEmpty(dcsps)) {
- final DonCalcSansPrtCasierProfil newInfosEMH = new DonCalcSansPrtCasierProfil(crueData
- .getCruePropertyDefinitionContainer());
- casier.addInfosEMH(newInfosEMH);
- } else {
- final int dcspsSize = dcsps.size();
- if (dcspsSize > 1) {
- LOGGER.error("Trop de DonCalcSansPrtCasierProfil definit par " + casier.getNom());
- }
- for (int j = 0; j < dcspsSize; j++) {
- final DonCalcSansPrtCasierProfil dcsp = dcsps.get(j);
- dcsp.setCoefRuis(cofqrq * dcsp.getCoefRuis());
- }
- }
+ final DonCalcSansPrtCasierProfil dcsp = FactoryInfoEMH.getDCSPCasierProfil(casier, crueData
+ .getCruePropertyDefinitionContainer());
+ dcsp.setCoefRuis(cofqrq * dcsp.getCoefRuis());
}
}
Modified: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/neuf/DHWriter.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/neuf/DHWriter.java 2010-02-19 17:49:39 UTC (rev 5685)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/neuf/DHWriter.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -33,7 +33,6 @@
import org.fudaa.dodico.crue.metier.emh.CalcTransNoeudNiveauContinuLimnigramme;
import org.fudaa.dodico.crue.metier.emh.CalcTransNoeudNiveauContinuQapp;
import org.fudaa.dodico.crue.metier.emh.CalcTransNoeudNiveauContinuTarage;
-import org.fudaa.dodico.crue.metier.emh.CatEMHActivable;
import org.fudaa.dodico.crue.metier.emh.CatEMHBranche;
import org.fudaa.dodico.crue.metier.emh.CatEMHCasier;
import org.fudaa.dodico.crue.metier.emh.CatEMHNoeud;
@@ -74,6 +73,7 @@
import org.fudaa.dodico.crue.metier.emh.ValParam;
import org.fudaa.dodico.crue.metier.emh.ValParamDouble;
import org.fudaa.dodico.crue.metier.helper.EMHHelper;
+import org.fudaa.dodico.crue.property.CrueProperties;
import org.fudaa.dodico.crue.validation.CruePrefix;
import org.joda.time.Duration;
import org.joda.time.LocalDateTime;
@@ -199,7 +199,8 @@
boolean modeLateral = isModeLateral(data);
// cru
- if (modeLateral && !computeQruisIdentique(coeffsRuisParCalcPerm, calcPseudoPerm)) { return; }
+ if (modeLateral
+ && !computeQruisIdentique(coeffsRuisParCalcPerm, calcPseudoPerm, data.getCruePropertyDefinitionContainer())) { return; }
// S'il existe au moins un débit de ruissellement pour un calcul permanent on met cru à 1/idem pour cofqrq
if (modeLateral && MapUtils.isNotEmpty(coeffsRuisParCalcPerm)) {
@@ -566,7 +567,8 @@
private double computeQruisQDM(final CrueData data) {
final List<EMHBrancheSaintVenant> branchesSaintVenant = data.getBranchesSaintVenant();
boolean valueSet = false;
- double res = 0;
+ double defaultValue = data.getCruePropertyDefinitionContainer().getDefaultDoubleValue("coefRuisQdm");
+ double res = defaultValue;
final double eps = data.getCruePropertyDefinitionContainer().getEpsilon("coefRuisQdm");
for (final EMHBrancheSaintVenant brancheSaintVenant : branchesSaintVenant) {
if (brancheSaintVenant.getUserActive()) {
@@ -575,9 +577,7 @@
for (final DonCalcSansPrtBrancheSaintVenant dcsp : dcsps) {
final double coefRuisQdm = dcsp.getCoefRuisQdm();
if (valueSet) {
- if (!CtuluLib.isEquals(res, coefRuisQdm, eps)) {
- analyze_.addFatalError("dh.coefRuisQdm.notConstant", brancheSaintVenant.getNom());
- }
+ if (!CtuluLib.isEquals(res, coefRuisQdm, eps)) { return defaultValue; }
} else {
valueSet = true;
res = coefRuisQdm;
@@ -589,7 +589,7 @@
}
private boolean computeQruisIdentique(final Map<String, Double> coeffsRuisParCalcPerm,
- final List<CalcPseudoPerm> calcPseudoPerm) {
+ final List<CalcPseudoPerm> calcPseudoPerm, CrueProperties props) {
// Pour déterminer s'il existe un coefficient de ruissellement commun pour un calcul permanent, il faut que le
// coefficient de chaque branche Saint Venant de ce calcul soit le même.
for (int i = 0, imax = calcPseudoPerm.size(); i < imax; i++) {
@@ -599,41 +599,9 @@
final List<CalcPseudoPermBrancheSaintVenantQruis> calcQruis = calcPerm.getCalcPseudoPermBrancheSaintVenantQruis();
final List<CalcPseudoPermCasierProfilQruis> calcCasierQruis = calcPerm.getCalcPseudoPermCasierProfilQruis();
if (CollectionUtils.isNotEmpty(calcQruis) || CollectionUtils.isNotEmpty(calcCasierQruis)) {
- double qruis = 0;
- boolean qruisSet = false;
- if (calcQruis != null) {
- for (int j = 1, jmax = calcQruis.size(); j < jmax; j++) {
-
- final CalcPseudoPermBrancheSaintVenantQruis brancheSV = calcQruis.get(j);
- if (((CatEMHActivable) brancheSV.getEmh()).getUserActive()) {
- if (!qruisSet) {
- qruisSet = true;
- qruis = brancheSV.getQruis();
- }
- if (!CtuluLib.isEquals(brancheSV.getQruis(), qruis, 1E-8)) {
- analyze_.addError("dh.Qruis.NotConstant", brancheSV.getEmh().getNom(), brancheSV.getNomCalculParent());
- return false;
- }
- }
- }
- }
- if (calcCasierQruis != null) {
- for (int j = 1, jmax = calcCasierQruis.size(); j < jmax; j++) {
-
- final CalcPseudoPermCasierProfilQruis casier = calcCasierQruis.get(j);
- if (((CatEMHActivable) casier.getEmh()).getUserActive()) {
- if (!qruisSet) {
- qruisSet = true;
- qruis = casier.getQruis();
- }
- if (!CtuluLib.isEquals(casier.getQruis(), qruis, 1E-8)) {
- analyze_.addError("dh.Qruis.NotConstant", casier.getEmh().getNom(), casier.getNomCalculParent());
- return false;
- }
- }
- }
- }
- coeffsRuisParCalcPerm.put(calcPerm.getNom(), Double.valueOf(qruis));
+ Double d = EMHHelper.isQruisConstant(calcPerm, props);
+ coeffsRuisParCalcPerm.put(calcPerm.getNom(), d == null ? Double.valueOf(props.getDefaultDoubleValue("qRuis"))
+ : d);
}
}
return true;
Modified: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/neuf/STRFactory.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/neuf/STRFactory.java 2010-02-19 17:49:39 UTC (rev 5685)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/io/neuf/STRFactory.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -194,7 +194,7 @@
private static LoiFF getLoiFFDeZRPTG(final float[] abscissesZ, final float[] ordonnees, final String nomLoi,
final EnumTypeLoi type) {
- return LoiFactory.getLoiFFRPTG(abscissesZ, ordonnees, CruePrefix.addPrefixIfNeeded(type, nomLoi), type);
+ return LoiFactory.getLoiFFRPTG(abscissesZ, ordonnees, CruePrefix.addPrefixIfNeeded(nomLoi, type), type);
}
/**
@@ -208,7 +208,7 @@
final ResPrtData data = new ResPrtData();
data.setData(ordonnees);
- data.setNom(CruePrefix.addPrefixIfNeeded(loi, nomData));
+ data.setNom(CruePrefix.addPrefixIfNeeded(nomData, loi));
return data;
}
Modified: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/CalcTransCasierProfilQruis.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/CalcTransCasierProfilQruis.java 2010-02-19 17:49:39 UTC (rev 5685)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/CalcTransCasierProfilQruis.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -24,7 +24,7 @@
*
* @pdOid 3953f5cb-2a92-47cc-8d01-9a199e82c5df
*/
- public LoiDF getHydrogrammeQruis() {
+ public LoiDF getLoiTQruis() {
return hydrogrammeQruis;
}
@@ -34,7 +34,7 @@
* @param newHydrogrammeQruis
* @pdOid c171e4b3-fb97-46df-b353-414351240a12
*/
- public void setHydrogrammeQruis(final LoiDF newHydrogrammeQruis) {
+ public void setLoiTQruis(final LoiDF newHydrogrammeQruis) {
if (this.hydrogrammeQruis != null) {
this.hydrogrammeQruis.unregister(this);
}
@@ -45,7 +45,7 @@
/** @pdOid 703a0309-dddf-4089-8552-ed6ba5d3455a */
public Loi getLoi() {
- return getHydrogrammeQruis();
+ return getLoiTQruis();
}
/**
@@ -53,7 +53,7 @@
* @pdOid 655e3d1d-f4cb-4433-ab82-a9072f35b756
*/
public void setLoi(final Loi newLoi) {
- setHydrogrammeQruis((LoiDF) newLoi);
+ setLoiTQruis((LoiDF) newLoi);
}
}
\ No newline at end of file
Modified: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/DonFrtConteneur.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/DonFrtConteneur.java 2010-02-19 17:49:39 UTC (rev 5685)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/DonFrtConteneur.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -5,9 +5,12 @@
package org.fudaa.dodico.crue.metier.emh;
import java.util.Collection;
+import java.util.Collections;
+import org.fudaa.dodico.crue.metier.helper.ObjetNommeComparator;
+
/** @pdOid c77c786c-5257-4b31-9175-74aedd21ace8 */
-public class DonFrtConteneur extends AbstractInfosEMH {
+public class DonFrtConteneur extends AbstractInfosEMH implements Sortable {
/**
* @pdRoleInfo migr=no name=DonFrt assc=association70 coll=java.util.List impl=java.util.ArrayList mult=0..*
* type=Aggregation
@@ -19,6 +22,12 @@
return EnumInfosEMH.DON_FRT_CONTENEUR;
}
+ public void sort() {
+ if (listFrt != null) {
+ Collections.sort(listFrt, ObjetNommeComparator.INSTANCE);
+ }
+ }
+
/** @pdGenerated default getter */
public java.util.List<DonFrt> getListFrt() {
if (listFrt == null) {
Modified: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/DonLoiHYConteneur.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/DonLoiHYConteneur.java 2010-02-19 17:49:39 UTC (rev 5685)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/DonLoiHYConteneur.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -4,8 +4,12 @@
package org.fudaa.dodico.crue.metier.emh;
+import java.util.Collections;
+
+import org.fudaa.dodico.crue.metier.helper.ObjetNommeComparator;
+
/** @pdOid 3f4238ea-eff7-4a3a-bfd3-7aa79554a414 */
-public class DonLoiHYConteneur extends AbstractInfosEMH {
+public class DonLoiHYConteneur extends AbstractInfosEMH implements Sortable {
/**
* @pdRoleInfo migr=no name=Loi assc=association71 coll=java.util.List impl=java.util.ArrayList mult=0..*
* type=Composition
@@ -28,6 +32,13 @@
return lois.iterator();
}
+ public void sort() {
+ if (lois != null) {
+ Collections.sort(lois, ObjetNommeComparator.INSTANCE);
+ }
+
+ }
+
/**
* @pdGenerated default setter
* @param newLois
Modified: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/EMH.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/EMH.java 2010-02-19 17:49:39 UTC (rev 5685)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/EMH.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -7,9 +7,10 @@
import org.apache.commons.collections.CollectionUtils;
import org.fudaa.dodico.crue.io.neuf.FCBSequentialReader.ResultatCalcul;
import org.fudaa.dodico.crue.metier.helper.EMHHelper;
+import org.fudaa.dodico.crue.metier.helper.RelationEMHComparator;
/** @pdOid 04144c01-720d-499c-8dff-98d76efec46a */
-public abstract class EMH implements ObjetNomme {
+public abstract class EMH implements ObjetNomme, Sortable {
/** @pdOid f01fa378-abc0-4ad4-8861-a0273afadb2e */
private String nom;
@@ -46,6 +47,21 @@
return infosEMHImmutable;
}
+ /**
+ * sort infoEMH only. Do not sort the relationEMH.
+ */
+ public void sort() {
+ if (infosEMH != null) {
+ for (InfosEMH info : infosEMH) {
+ if (info instanceof Sortable) {
+ ((Sortable) info).sort();
+ }
+
+ }
+ }
+
+ }
+
public abstract boolean getUserActive();
/**
@@ -206,6 +222,12 @@
}
}
+ protected void sortRelationEMH() {
+ if (relationEMH != null) {
+ Collections.sort(relationEMH, RelationEMHComparator.INSTANCE);
+ }
+ }
+
/**
* @pdGenerated default getter
* @return une liste non modifiable.
Modified: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/EMHModeleBase.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/EMHModeleBase.java 2010-02-19 17:49:39 UTC (rev 5685)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/EMHModeleBase.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -23,6 +23,14 @@
return EMHHelper.collectEMHInRelationEMHContient(this, EnumTypeEMH.SOUS_MODELE);
}
+ @Override
+ public void sort() {
+ super.sort();
+ for (EMHSousModele modele : getSousModele()) {
+ modele.sort();
+ }
+ }
+
/**
* @return la concatenation des sous-modele
*/
Modified: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/EMHScenario.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/EMHScenario.java 2010-02-19 17:49:39 UTC (rev 5685)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/EMHScenario.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -30,6 +30,14 @@
return defContainer;
}
+ @Override
+ public void sort() {
+ super.sort();
+ for (EMHModeleBase modele : getModeles()) {
+ modele.sort();
+ }
+ }
+
/**
* @return the rptg
*/
Modified: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/EMHSousModele.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/EMHSousModele.java 2010-02-19 17:49:39 UTC (rev 5685)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/EMHSousModele.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -33,6 +33,16 @@
return frtConteneur;
}
+ /**
+ * sort le Frts and the the contained EMH.
+ */
+ @Override
+ public void sort() {
+ super.sort();
+ super.sortRelationEMH();
+
+ }
+
public void addAllInfos(List<? extends InfosEMH> infos) {
if (infos != null) {
for (InfosEMH info : infos) {
Modified: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/OrdPrtCIniModeleBase.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/OrdPrtCIniModeleBase.java 2010-02-19 17:49:39 UTC (rev 5685)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/OrdPrtCIniModeleBase.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -4,8 +4,12 @@
package org.fudaa.dodico.crue.metier.emh;
+import java.util.Collections;
+
+import org.fudaa.dodico.crue.metier.helper.ObjetNommeComparator;
+
/** @pdOid a637504e-9e1b-4a87-8327-92ea3b3fa1ea */
-public class OrdPrtCIniModeleBase extends AbstractInfosEMH {
+public class OrdPrtCIniModeleBase extends AbstractInfosEMH implements Sortable {
/** @pdOid 404a2a65-177d-47c5-8a9b-37ce33aae566 */
private EnumMethodeInterpolation methodeInterpol;
@@ -13,7 +17,7 @@
* @pdRoleInfo migr=no name=ValParam assc=association112 coll=java.util.Collection impl=java.util.ArrayList mult=0..*
* type=Composition
*/
- private java.util.Collection<ValParam> valParam;
+ private java.util.List<ValParam> valParam;
/** @pdGenerated default getter */
public java.util.Collection<ValParam> getValParam() {
@@ -23,6 +27,12 @@
return valParam;
}
+ public void sort() {
+ if (valParam != null) {
+ Collections.sort(valParam, ObjetNommeComparator.INSTANCE);
+ }
+ }
+
/** @pdGenerated default iterator getter */
public java.util.Iterator getIteratorValParam() {
if (valParam == null) {
Modified: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/OrdPrtGeoModeleBase.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/OrdPrtGeoModeleBase.java 2010-02-19 17:49:39 UTC (rev 5685)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/OrdPrtGeoModeleBase.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -8,10 +8,11 @@
import java.util.HashMap;
import java.util.Map;
+import org.fudaa.dodico.crue.metier.helper.ObjetNommeComparator;
import org.fudaa.dodico.crue.property.CrueProperties;
/** @pdOid cc0ae74b-13f5-4a1d-b197-4e2ef83bb99c */
-public class OrdPrtGeoModeleBase extends AbstractInfosEMH {
+public class OrdPrtGeoModeleBase extends AbstractInfosEMH implements Sortable {
/** @pdRoleInfo migr=no name=Planimetrage assc=association109 mult=1..1 type=Composition */
private Planimetrage planimetrage;
/**
@@ -30,6 +31,13 @@
return planimetrage;
}
+ public void sort() {
+ if (regle != null) {
+ Collections.sort(regle, ObjetNommeComparator.INSTANCE);
+ }
+
+ }
+
/**
* @pdGenerated default parent setter
* @param newPlanimetrage
Added: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/Sortable.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/Sortable.java (rev 0)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/emh/Sortable.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -0,0 +1,10 @@
+package org.fudaa.dodico.crue.metier.emh;
+
+/**
+ * @author deniger
+ */
+public interface Sortable {
+
+ public void sort();
+
+}
Modified: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/helper/EMHHelper.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/helper/EMHHelper.java 2010-02-19 17:49:39 UTC (rev 5685)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/helper/EMHHelper.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -12,6 +12,9 @@
import org.apache.commons.collections.Predicate;
import org.apache.commons.collections.Transformer;
import org.fudaa.ctulu.CtuluLib;
+import org.fudaa.dodico.crue.metier.emh.CalcPseudoPerm;
+import org.fudaa.dodico.crue.metier.emh.CalcPseudoPermBrancheSaintVenantQruis;
+import org.fudaa.dodico.crue.metier.emh.CalcPseudoPermCasierProfilQruis;
import org.fudaa.dodico.crue.metier.emh.CatEMHActivable;
import org.fudaa.dodico.crue.metier.emh.CatEMHBranche;
import org.fudaa.dodico.crue.metier.emh.CatEMHCasier;
@@ -45,6 +48,7 @@
import org.fudaa.dodico.crue.metier.emh.RelationEMHSectionDansBrancheSaintVenant;
import org.fudaa.dodico.crue.metier.emh.RelationEMHSectionDansSectionIdem;
import org.fudaa.dodico.crue.metier.emh.RelationEMHSectionPiloteDansBranche;
+import org.fudaa.dodico.crue.property.CrueProperties;
/**
* Classe utilitaire permettant de naviguer facilement dans les EMH, infosEMH et les RelationEMH
@@ -648,4 +652,47 @@
return (int) Math.ceil(distance / distmax);
}
+ /**
+ * @param calcPerm
+ * @param props
+ * @return null si different ou si pas de CalcPseudoPerm*Qruis
+ */
+ public static Double isQruisConstant(final CalcPseudoPerm calcPerm, CrueProperties props) {
+ final List<CalcPseudoPermBrancheSaintVenantQruis> calcQruis = calcPerm.getCalcPseudoPermBrancheSaintVenantQruis();
+ final List<CalcPseudoPermCasierProfilQruis> calcCasierQruis = calcPerm.getCalcPseudoPermCasierProfilQruis();
+ double eps = props.getEpsilon("qRuis");
+ if (CollectionUtils.isNotEmpty(calcQruis) || CollectionUtils.isNotEmpty(calcCasierQruis)) {
+ double qruis = 0;
+ boolean qruisSet = false;
+ if (calcQruis != null) {
+ for (int j = 0, jmax = calcQruis.size(); j < jmax; j++) {
+
+ final CalcPseudoPermBrancheSaintVenantQruis brancheSV = calcQruis.get(j);
+ if (((CatEMHActivable) brancheSV.getEmh()).getActuallyActive()) {
+ if (!qruisSet) {
+ qruisSet = true;
+ qruis = brancheSV.getQruis();
+ }
+ if (!CtuluLib.isEquals(brancheSV.getQruis(), qruis, eps)) { return null; }
+ }
+ }
+ }
+ if (calcCasierQruis != null) {
+ for (int j = 0, jmax = calcCasierQruis.size(); j < jmax; j++) {
+ final CalcPseudoPermCasierProfilQruis casier = calcCasierQruis.get(j);
+ if (((CatEMHActivable) casier.getEmh()).getActuallyActive()) {
+ if (!qruisSet) {
+ qruisSet = true;
+ qruis = casier.getQruis();
+ }
+ if (!CtuluLib.isEquals(casier.getQruis(), qruis, 1E-8)) { return null; }
+ }
+ }
+ }
+ return Double.valueOf(qruis);
+ }
+ return props.getDefaultDoubleValue("qRuis");
+
+ }
+
}
Modified: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/helper/FactoryEMH.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/helper/FactoryEMH.java 2010-02-19 17:49:39 UTC (rev 5685)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/helper/FactoryEMH.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -15,10 +15,12 @@
import org.fudaa.dodico.crue.metier.emh.CatEMHCasier;
import org.fudaa.dodico.crue.metier.emh.CatEMHSection;
import org.fudaa.dodico.crue.metier.emh.DonCalcSansPrtBranchePdc;
+import org.fudaa.dodico.crue.metier.emh.DonCalcSansPrtCasierProfil;
import org.fudaa.dodico.crue.metier.emh.DonFrtStrickler;
import org.fudaa.dodico.crue.metier.emh.DonPrtGeoBatiCasier;
import org.fudaa.dodico.crue.metier.emh.DonPrtGeoProfilCasier;
import org.fudaa.dodico.crue.metier.emh.EMHBrancheSaintVenant;
+import org.fudaa.dodico.crue.metier.emh.EMHCasierProfil;
import org.fudaa.dodico.crue.metier.emh.EMHSectionInterpolee;
import org.fudaa.dodico.crue.metier.emh.EMHSectionSansGeometrie;
import org.fudaa.dodico.crue.metier.emh.EnumPositionSection;
@@ -66,6 +68,13 @@
}
+ public static EMHCasierProfil createCasierProfil(String nom, CrueProperties defaults) {
+ EMHCasierProfil res = new EMHCasierProfil(nom);
+ res.addInfosEMH(new DonCalcSansPrtCasierProfil(defaults));
+ return res;
+
+ }
+
/**
* @param nomFrot le nom du frottement
* @return le strickler correctement initialise
@@ -105,7 +114,7 @@
listeEvolution.setPtEvolutionFF(listePoints);
final LoiFF newLoi = new LoiFF();
final String brancheNom = getBrancheNomWithoutPrefix(idBranche);
- newLoi.setNom(CruePrefix.addPrefixIfNeeded(EnumTypeLoi.LoiQPdc, brancheNom));
+ newLoi.setNom(CruePrefix.addPrefixIfNeeded(brancheNom, EnumTypeLoi.LoiQPdc));
newLoi.setEvolutionFF(listeEvolution);
newLoi.setType(EnumTypeLoi.LoiQPdc);
dataDCSP.setLoiQPdc(newLoi);
@@ -174,16 +183,14 @@
* @param pos la position du profil dans le casier
* @return le DonPrtGeoProfilCasier produit
*/
- public static DonPrtGeoBatiCasier createDonPrtGeoBatiCasier(final CatEMHCasier casier,
- CrueProperties defaults) {
+ public static DonPrtGeoBatiCasier createDonPrtGeoBatiCasier(final CatEMHCasier casier, CrueProperties defaults) {
final DonPrtGeoBatiCasier dataDPTG = new DonPrtGeoBatiCasier(defaults);
dataDPTG.setNom(CruePrefix.changePrefix(casier.getNom(), CruePrefix.P_CASIER, CruePrefix.P_BATI_CASIER));
return dataDPTG;
}
public static RelationEMHSectionDansBranche createRelationSectionDansBranche(final CatEMHBranche branche,
- final CatEMHSection section, final double xp, final EnumPositionSection position,
- CrueProperties defaults) {
+ final CatEMHSection section, final double xp, final EnumPositionSection position, CrueProperties defaults) {
final boolean isSaintVenant = branche instanceof EMHBrancheSaintVenant;
final RelationEMHSectionDansBranche relation = FactoryEMHRelation.createSectionDansBranche(branche, isSaintVenant,
section, defaults);
Added: trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/helper/FactoryInfoEMH.java
===================================================================
--- trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/helper/FactoryInfoEMH.java (rev 0)
+++ trunk/soft/fudaa-crue/dodico/src/main/java/org/fudaa/dodico/crue/metier/helper/FactoryInfoEMH.java 2010-02-23 23:09:40 UTC (rev 5686)
@@ -0,0 +1,24 @@
+package org.fudaa.dodico.crue.metier.helper;
+
+import org.fudaa.dodico.crue.metier.emh.CatEMHCasier;
+import org.fudaa.dodico.crue.metier.emh.DonCalcSansPrtCasierProfil;
+import org.fudaa.dodico.crue.property.CrueProperties;
+
+/**
+ * @author deniger
+ */
+public class FactoryInfoEMH {
+
+ public static DonCalcSansPrtCasierProfil getDCSPCasierProfil(final CatEMHCasier casier,
+ final CrueProperties cruePropertyDefinitionContainer) {
+ DonCalcSansPrtCasierProfil dcsp = EMHHelper.selectFirstOfClass(casier.getInfosEMH(),
+ DonCalcSansPrtCasierProfil.cla...
[truncated message content] |