Update of /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/dico
In directory sc8-pr-cvs1:/tmp/cvs-serv5355/dico
Modified Files:
DicoCasFileFormat.java DicoCasFileFormatVersion.java
DicoCasReader.java DicoCasWriter.java DicoGenerator.java
DicoParams.java
Log Message:
Creation des dossiers h2d/reflux et h2d/telemac et deplacement des
fichiers concerne.
Gestion des cl et des bords ( a refaire ..)
Amelioration des gestions des versions de fichiers
Index: DicoCasFileFormat.java
===================================================================
RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/dico/DicoCasFileFormat.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** DicoCasFileFormat.java 19 Aug 2003 07:44:21 -0000 1.3
--- DicoCasFileFormat.java 22 Aug 2003 15:51:11 -0000 1.4
***************
*** 27,30 ****
--- 27,31 ----
super(1);
nom_= _nom;
+ ID_=nom_.toUpperCase();
description_= "fichier de paramètres";
mode_= MODE_ASCII;
***************
*** 74,77 ****
--- 75,80 ----
return getDicoManager().createVersionImpl(this, _version, _language);
}
+
+
}
Index: DicoCasFileFormatVersion.java
===================================================================
RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/dico/DicoCasFileFormatVersion.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** DicoCasFileFormatVersion.java 18 Aug 2003 11:48:02 -0000 1.1
--- DicoCasFileFormatVersion.java 22 Aug 2003 15:51:11 -0000 1.2
***************
*** 15,18 ****
--- 15,20 ----
import org.fudaa.dodico.fichiers.FileFormatVersion;
import org.fudaa.dodico.fichiers.FileOperationSynthese;
+ import org.fudaa.dodico.fichiers.FileReadOperationAbstract;
+ import org.fudaa.dodico.fichiers.FileWriteOperationAbstract;
/**
***************
*** 95,116 ****
}
- public FileOperationSynthese writeCas(
- File _f,
- DicoCasInterface _inter,
- ProgressionInterface _prog) {
- DicoCasWriter w= createDicoCasWriter();
- FileOperationSynthese synt= FileFormatVersion.initOperation(w, _prog, _f);
- w.write(_inter, synt);
- return synt;
- }
-
- public DicoCasInterface readCas(
- File _f,
- FileOperationSynthese _synt,
- ProgressionInterface _prog) {
- DicoCasReader r= createDicoCasReader();
- FileFormatVersion.initOperation(_synt, r, _prog, _f);
- return r.read(_synt);
- }
/**
--- 97,100 ----
***************
*** 120,123 ****
--- 104,138 ----
return dico_;
}
+
+ /**
+ *
+ */
+ public FileReadOperationAbstract createReader() {
+ return createDicoCasReader();
+ }
+
+ /**
+ *
+ */
+ public FileWriteOperationAbstract createWriter() {
+ return createDicoCasWriter();
+ }
+
+ public FileOperationSynthese writeMaillage(
+ File _f,
+ DicoCasInterface _source,
+ ProgressionInterface _prog) {
+ DicoCasWriter i= createDicoCasWriter();
+ if(i==null){
+ return super.write(_f,(Object)_source,_prog);
+ }
+ i.setFile(_f);
+ i.setProgressReceiver(_prog);
+ FileOperationSynthese r= i.write(_source);
+ i.setProgressReceiver(null);
+ return r;
+
+ }
+
}
Index: DicoCasReader.java
===================================================================
RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/dico/DicoCasReader.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DicoCasReader.java 18 Aug 2003 11:05:19 -0000 1.2
--- DicoCasReader.java 22 Aug 2003 15:51:11 -0000 1.3
***************
*** 20,25 ****
import org.fudaa.dodico.fichiers.FileFormatVersion;
import org.fudaa.dodico.fichiers.FileOperationAbstract;
! import org.fudaa.dodico.fichiers.FileOperationInterface;
import org.fudaa.dodico.fichiers.FileOperationSynthese;
/**
--- 20,28 ----
import org.fudaa.dodico.fichiers.FileFormatVersion;
import org.fudaa.dodico.fichiers.FileOperationAbstract;
! import org.fudaa.dodico.fichiers.FileReadOperationAbstract;
import org.fudaa.dodico.fichiers.FileOperationSynthese;
+ import org.fudaa.dodico.fortran.FortranInterface;
+ import org.fudaa.dodico.fortran.FortranLib;
+ import org.fudaa.dodico.fortran.FortranReader;
/**
***************
*** 27,32 ****
* @version $Id$
*/
! public class DicoCasReader extends FileOperationAbstract implements FileOperationInterface
! {
DicoModelAbstract dico_;
DicoCasFileFormatVersion ft_;
--- 30,34 ----
* @version $Id$
*/
! public class DicoCasReader extends FileReadOperationAbstract {
DicoModelAbstract dico_;
DicoCasFileFormatVersion ft_;
***************
*** 34,179 ****
long readTime_;
! public DicoCasReader(DicoCasFileFormatVersion _t)
! {
! ft_ = _t;
! dico_ = ft_.getDico();
}
! public void setFile(File _f)
! {
!
! try
! {
! in_ = new LineNumberReader(new FileReader(_f));
! }
! catch (FileNotFoundException e)
! {
! in_ = null;
}
}
- public DicoCasInterface read(FileOperationSynthese _op)
- {
- DodicoAnalyze.Editor edit=new DodicoAnalyze.Editor();
- DicoCasInterface r=readCas(edit);
- FileOperationSynthese.initAndClose(_op,edit,this,"Lecture Fichier Cas");
- return r;
- }
! /**
! * @see org.fudaa.dodico.tr.TrReaderInterface#read()
! */
! private DicoCasInterface readCas(DodicoAnalyze.Editor _analyze)
! {
! DicoCasAbstract inter_ = null;
! if (in_ == null)
! {
! _analyze.addFatalError(DodicoLib.geti18n("Flux d'entree non trouve"));
return null;
}
! try
! {
String line;
String trimLine;
! boolean quoteEnCours = false;
String stemp;
! StringBuffer b = new StringBuffer(100);
! inter_ = new DicoCasAbstract();
! DicoEntite keyEnCours = null;
! while ((line = in_.readLine()) != null)
! {
! trimLine = line.trim();
//ligne vide
if (trimLine.length() == 0)
continue;
! if (quoteEnCours)
! {
! quoteEnCours = sansCommentaire(trimLine, true, b);
! }
! else
! {
//commentaire
if (trimLine.startsWith("/"))
continue;
! else if (trimLine.startsWith(ft_.getCommandStop()))
! {
inter_.setCommandStop(true);
! }
! else if (trimLine.startsWith(ft_.getCommandStopProgram()))
! {
inter_.setCommandStopProgram(true);
! }
! else if (trimLine.startsWith(ft_.getCommandPrintKeys()))
! {
inter_.setPrintKeys(true);
! }
! else if (trimLine.startsWith(ft_.getCommandPrintLongKeys()))
! {
inter_.setPrintLongKeys(true);
! }
! else if (trimLine.startsWith(ft_.getCommandPrintKeysValues()))
! {
inter_.setPrintKeysValues(true);
! }
! else
! {
! int indexE = equalIndex(trimLine);
! if (indexE > 0)
! {
! stemp = trimLine.substring(0, indexE).trim();
! if (dico_.isKey(stemp))
! {
! if (keyEnCours != null)
! {
! if (inter_.containsEntite(keyEnCours))
! {
! _analyze.addInfo(
! DodicoLib.geti18n("le mot-clef") + " " + keyEnCours.getNom() + " " + DodicoLib.geti18n("est défini plusieurs fois"),
in_.getLineNumber());
}
! ajouteClefValeur(keyEnCours, b, inter_,_analyze);
}
b.setLength(0);
! keyEnCours = dico_.getEntite(stemp);
! if (indexE < trimLine.length() - 1)
! {
! quoteEnCours = sansCommentaire(trimLine.substring(indexE + 1), false, b);
}
}
! }
! else
! {
! quoteEnCours = sansCommentaire(trimLine, false, b);
}
}
}
}
! if (keyEnCours != null)
! {
! ajouteClefValeur(keyEnCours, b, inter_,_analyze);
}
! }
! catch (IOException _ioe)
! {
! DodicoAnalyze.manageException(_ioe, _analyze);
}
return inter_;
}
! private void ajouteClefValeur(DicoEntite _cle, StringBuffer _valeur, DicoCasAbstract _dico,DodicoAnalyze.Editor _analyze)
! {
! String s = _valeur.toString().trim();
_dico.addTelemacCasInput(_cle, s);
! if (!_cle.isValide(s))
! {
! _analyze.addError("Valeur non valide", in_.getLineNumber());
! _analyze.addInfo(
! DodicoLib.geti18n("clef") + ": \"" + _cle.getNom() + "\", " + DodicoLib.geti18n("valeur") + ": \"" + _valeur.toString().trim() + "\"",
in_.getLineNumber());
--- 36,153 ----
long readTime_;
! public DicoCasReader(DicoCasFileFormatVersion _t) {
! ft_= _t;
! dico_= ft_.getDico();
}
! public void setFile(File _f) {
! analyze_= new DodicoAnalyze.Editor();
! analyze_.setRessource(_f.getAbsolutePath());
! try {
! in_= new LineNumberReader(new FileReader(_f));
! } catch (FileNotFoundException e) {
! in_= null;
}
}
! private DicoCasInterface readCas() {
! DicoCasAbstract inter_= null;
! if (in_ == null) {
! analyze_.addFatalError(DodicoLib.geti18n("Flux d'entree non trouve"));
return null;
}
! try {
String line;
String trimLine;
! boolean quoteEnCours= false;
String stemp;
! StringBuffer b= new StringBuffer(100);
! inter_= new DicoCasAbstract();
! DicoEntite keyEnCours= null;
! while ((line= in_.readLine()) != null) {
! trimLine= line.trim();
//ligne vide
if (trimLine.length() == 0)
continue;
! if (quoteEnCours) {
! quoteEnCours= sansCommentaire(trimLine, true, b);
! } else {
//commentaire
if (trimLine.startsWith("/"))
continue;
! else if (trimLine.startsWith(ft_.getCommandStop())) {
inter_.setCommandStop(true);
! } else if (trimLine.startsWith(ft_.getCommandStopProgram())) {
inter_.setCommandStopProgram(true);
! } else if (trimLine.startsWith(ft_.getCommandPrintKeys())) {
inter_.setPrintKeys(true);
! } else if (trimLine.startsWith(ft_.getCommandPrintLongKeys())) {
inter_.setPrintLongKeys(true);
! } else if (trimLine.startsWith(ft_.getCommandPrintKeysValues())) {
inter_.setPrintKeysValues(true);
! } else {
! int indexE= equalIndex(trimLine);
! if (indexE > 0) {
! stemp= trimLine.substring(0, indexE).trim();
! if (dico_.isKey(stemp)) {
! if (keyEnCours != null) {
! if (inter_.containsEntite(keyEnCours)) {
! analyze_.addInfo(
! DodicoLib.geti18n("le mot-clef")
! + " "
! + keyEnCours.getNom()
! + " "
! + DodicoLib.geti18n("est défini plusieurs fois"),
in_.getLineNumber());
}
! ajouteClefValeur(keyEnCours, b, inter_, analyze_);
}
b.setLength(0);
! keyEnCours= dico_.getEntite(stemp);
! if (indexE < trimLine.length() - 1) {
! quoteEnCours=
! sansCommentaire(trimLine.substring(indexE + 1), false, b);
}
}
! } else {
! quoteEnCours= sansCommentaire(trimLine, false, b);
}
}
}
}
! if (keyEnCours != null) {
! ajouteClefValeur(keyEnCours, b, inter_, analyze_);
}
! } catch (IOException _ioe) {
! DodicoAnalyze.manageException(_ioe, analyze_);
}
return inter_;
}
! private void ajouteClefValeur(
! DicoEntite _cle,
! StringBuffer _valeur,
! DicoCasAbstract _dico,
! DodicoAnalyze.Editor analyze_) {
! String s= _valeur.toString().trim();
_dico.addTelemacCasInput(_cle, s);
! if (!_cle.isValide(s)) {
! analyze_.addError("Valeur non valide", in_.getLineNumber());
! analyze_.addInfo(
! DodicoLib.geti18n("clef")
! + ": \""
! + _cle.getNom()
! + "\", "
! + DodicoLib.geti18n("valeur")
! + ": \""
! + _valeur.toString().trim()
! + "\"",
in_.getLineNumber());
***************
*** 185,215 ****
* Supprime les commentaires et les quotes ( et transforme les double en simple).
*/
! private static boolean sansCommentaire(String _s, boolean _beginByQuote, StringBuffer _b)
! {
! int l = _s.length();
! int index = _s.indexOf('\'');
! if (_beginByQuote)
! {
! if (index < 0)
! {
_b.append(_s);
return true;
! }
! else if (index == l - 1)
! {
_b.append(_s.substring(0, l - 1));
return false;
! }
! else
! {
! char c = _s.charAt(index + 1);
! if (c == '\'')
! {
_b.append(_s.substring(0, index + 1));
return sansCommentaire(_s.substring(index + 2), _beginByQuote, _b);
! }
! else
! {
_b.append(_s.substring(0, index));
--- 159,182 ----
* Supprime les commentaires et les quotes ( et transforme les double en simple).
*/
! private static boolean sansCommentaire(
! String _s,
! boolean _beginByQuote,
! StringBuffer _b) {
! int l= _s.length();
! int index= _s.indexOf('\'');
! if (_beginByQuote) {
! if (index < 0) {
_b.append(_s);
return true;
! } else if (index == l - 1) {
_b.append(_s.substring(0, l - 1));
return false;
! } else {
! char c= _s.charAt(index + 1);
! if (c == '\'') {
_b.append(_s.substring(0, index + 1));
return sansCommentaire(_s.substring(index + 2), _beginByQuote, _b);
! } else {
_b.append(_s.substring(0, index));
***************
*** 217,245 ****
}
}
! }
! else
! {
//l'indice du sigle de commentaire
! int indexCom = _s.indexOf('/');
//un ' present
! if (index >= 0)
! {
//Si pas de commentaire ou commentaire apres
! if ((indexCom < 0) || (index < indexCom))
! {
_b.append(_s.substring(0, index));
return sansCommentaire(_s.substring(index + 1), true, _b);
}
}
! if (indexCom >= 0)
! {
_b.append(_s.substring(0, indexCom));
! int com2 = _s.indexOf('/', indexCom + 1);
! if ((com2 < 0) || (com2 == l - 1))
! {
return false;
! }
! else
! {
return sansCommentaire(_s.substring(com2 + 1), false, _b);
}
--- 184,204 ----
}
}
! } else {
//l'indice du sigle de commentaire
! int indexCom= _s.indexOf('/');
//un ' present
! if (index >= 0) {
//Si pas de commentaire ou commentaire apres
! if ((indexCom < 0) || (index < indexCom)) {
_b.append(_s.substring(0, index));
return sansCommentaire(_s.substring(index + 1), true, _b);
}
}
! if (indexCom >= 0) {
_b.append(_s.substring(0, indexCom));
! int com2= _s.indexOf('/', indexCom + 1);
! if ((com2 < 0) || (com2 == l - 1)) {
return false;
! } else {
return sansCommentaire(_s.substring(com2 + 1), false, _b);
}
***************
*** 250,258 ****
}
! private static int equalIndex(String _l)
! {
! int index = _l.indexOf('=');
if (index < 0)
! index = _l.indexOf(':');
return index;
}
--- 209,216 ----
}
! private static int equalIndex(String _l) {
! int index= _l.indexOf('=');
if (index < 0)
! index= _l.indexOf(':');
return index;
}
***************
*** 261,266 ****
* @see org.fudaa.dodico.tr.TrReaderInterface#close()
*/
! public void close() throws IOException
! {
in_.close();
}
--- 219,223 ----
* @see org.fudaa.dodico.tr.TrReaderInterface#close()
*/
! public void close() throws IOException {
in_.close();
}
***************
*** 269,274 ****
* @see org.fudaa.dodico.tr.TrReaderInterface#setIn(java.io.File[])
*/
! public void setFile(File[] _f)
! {
setFile(_f[0]);
--- 226,230 ----
* @see org.fudaa.dodico.tr.TrReaderInterface#setIn(java.io.File[])
*/
! public void setFile(File[] _f) {
setFile(_f[0]);
***************
*** 278,288 ****
* @return
*/
! public DicoCasFileFormatVersion getDicoCasFileFormatVersion()
! {
return ft_;
}
! public FileFormatVersion getFileFormatVersion()
! {
return getDicoCasFileFormatVersion();
}
--- 234,242 ----
* @return
*/
! public DicoCasFileFormatVersion getDicoCasFileFormatVersion() {
return ft_;
}
! public FileFormatVersion getFileFormatVersion() {
return getDicoCasFileFormatVersion();
}
***************
*** 291,297 ****
*
*/
! public long getReadTime()
! {
return readTime_;
}
--- 245,275 ----
*
*/
! public long getReadTime() {
return readTime_;
+ }
+
+ /**
+ *
+ */
+ protected Object _read() {
+ return readCas();
+ }
+
+ /**
+ *
+ */
+ protected FortranInterface getFortranInterface() {
+ return new FortranInterface(){
+ public void close() throws IOException{
+ if(in_!=null) in_.close();
+ }
+ };
+ }
+
+ /**
+ *
+ */
+ public FileFormatVersion getVersion() {
+ return ft_;
}
Index: DicoCasWriter.java
===================================================================
RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/dico/DicoCasWriter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DicoCasWriter.java 18 Aug 2003 11:05:19 -0000 1.2
--- DicoCasWriter.java 22 Aug 2003 15:51:11 -0000 1.3
***************
*** 28,33 ****
* @version $Id$
*/
! public class DicoCasWriter extends FileOpWriterCharSimpleAbstract
! {
DicoCasFileFormatVersion version_;
String commentSep_;
--- 28,32 ----
* @version $Id$
*/
! public class DicoCasWriter extends FileOpWriterCharSimpleAbstract {
DicoCasFileFormatVersion version_;
String commentSep_;
***************
*** 39,117 ****
* @param _ft
*/
! public DicoCasWriter(DicoCasFileFormatVersion _ft)
! {
! version_ = _ft;
! com_ = version_.getCommentChar();
! commentSep_ = com_ + "---------------------------------------------------------------------" + lineSep_;
! enteteFormat_ =
! commentSep_ + com_ + " " + version_.getFileFormat().getID() + " Version ${VERSION} ${DATE}" + lineSep_ + com_ + " ${TITLE}" + lineSep_ + commentSep_;
! enteteRubrique_ = lineSep_ + commentSep_ + com_ + " ${RUBRIQUE}" + lineSep_ + commentSep_;
}
! public FileFormatVersion getFileFormatVersion()
! {
return version_;
}
! public void write(DicoCasInterface _inter, FileOperationSynthese _op)
! {
! DodicoAnalyze.Editor edit = new DodicoAnalyze.Editor();
! writeCas(_inter,edit);
! FileOperationSynthese.initAndClose(_op, edit, this, "Lecture Fichier Cas");
! }
!
! /**
! * @see org.fudaa.dodico.tr.TrWriterInterface#write()
! */
! public void writeCas(DicoCasInterface _inter,DodicoAnalyze.Editor _analyze)
! {
! DicoCasInterface interface_ = _inter;
! if (interface_ == null)
! {
! _analyze.addFatalError(DodicoLib.geti18n("Les données sont nulles"));
return;
}
! if (out_ == null)
! {
! _analyze.addFatalError(DodicoLib.geti18n("Le flux de sortie est nul."));
return;
}
//Hashtable entitesValues = interface_.getInputs();
! Set rest = interface_.getEntiteSet();
! String[] rubriques = version_.getDico().getRubriques();
! try
! {
! String dd = null;
! DicoEntite entNom = version_.getTitreEntite();
! if (entNom != null)
! {
! dd = interface_.getValue(entNom);
}
if (dd == null)
! dd = "nom inconnu";
writeEntete(dd);
if (progress_ != null)
progress_.setProgression(10);
! if ((rubriques == null) || (rubriques.length == 0))
! {
! DicoEntite[] ents = new DicoEntite[rest.size()];
rest.toArray(ents);
! writeRubrique(DodicoLib.geti18n("Inconnu"), ents, interface_,_analyze);
rest.clear();
if (progress_ != null)
progress_.setProgression(90);
}
! int n = rubriques.length;
! int m = n / 2;
! for (int i = 0; i < n; i++)
! {
if (rubriques[i] == null)
System.err.println("rubriques nulles");
! DicoEntite[] entToWrite = DicoEntite.getAndRemoveEntite(rubriques[i], rest);
! writeRubrique(rubriques[i], entToWrite, interface_,_analyze);
! if ((progress_ != null) && (i == m))
! {
progress_.setProgression(55);
}
--- 38,110 ----
* @param _ft
*/
! public DicoCasWriter(DicoCasFileFormatVersion _ft) {
! version_= _ft;
! com_= version_.getCommentChar();
! commentSep_=
! com_
! + "---------------------------------------------------------------------"
! + lineSep_;
! enteteFormat_=
! commentSep_
! + com_
! + " "
! + version_.getFileFormat().getID()
! + " Version ${VERSION} ${DATE}"
! + lineSep_
! + com_
! + " ${TITLE}"
! + lineSep_
! + commentSep_;
! enteteRubrique_=
! lineSep_ + commentSep_ + com_ + " ${RUBRIQUE}" + lineSep_ + commentSep_;
}
! public FileFormatVersion getFileFormatVersion() {
return version_;
}
! public void writeCas(DicoCasInterface _inter) {
! DicoCasInterface interface_= _inter;
! if (interface_ == null) {
! analyze_.addFatalError(DodicoLib.geti18n("Les données sont nulles"));
return;
}
! if (out_ == null) {
! analyze_.addFatalError(DodicoLib.geti18n("Le flux de sortie est nul."));
return;
}
//Hashtable entitesValues = interface_.getInputs();
! Set rest= interface_.getEntiteSet();
! String[] rubriques= version_.getDico().getRubriques();
! try {
! String dd= null;
! DicoEntite entNom= version_.getTitreEntite();
! if (entNom != null) {
! dd= interface_.getValue(entNom);
}
if (dd == null)
! dd= "nom inconnu";
writeEntete(dd);
if (progress_ != null)
progress_.setProgression(10);
! if ((rubriques == null) || (rubriques.length == 0)) {
! DicoEntite[] ents= new DicoEntite[rest.size()];
rest.toArray(ents);
! writeRubrique(DodicoLib.geti18n("Inconnu"), ents, interface_);
rest.clear();
if (progress_ != null)
progress_.setProgression(90);
}
! int n= rubriques.length;
! int m= n / 2;
! for (int i= 0; i < n; i++) {
if (rubriques[i] == null)
System.err.println("rubriques nulles");
! DicoEntite[] entToWrite=
! DicoEntite.getAndRemoveEntite(rubriques[i], rest);
! writeRubrique(rubriques[i], entToWrite, interface_);
! if ((progress_ != null) && (i == m)) {
progress_.setProgression(55);
}
***************
*** 119,126 ****
if (progress_ != null)
progress_.setProgression(95);
! }
! catch (IOException _e)
! {
! DodicoAnalyze.manageException(_e, _analyze);
}
}
--- 112,117 ----
if (progress_ != null)
progress_.setProgression(95);
! } catch (IOException _e) {
! DodicoAnalyze.manageException(_e, analyze_);
}
}
***************
*** 131,143 ****
* @throws IOException
*/
! private void writeEntete(String _nomEtude) throws IOException
! {
! String entete = FuLib.replace(enteteFormat_, "${TITLE}", _nomEtude);
! entete = FuLib.replace(entete, "${VERSION}", version_.getVersionName());
! entete = FuLib.replace(entete, "${DATE}", DateFormat.getDateInstance().format(Calendar.getInstance().getTime()));
! String r = "";
! String com = "" + version_.getCommentChar();
! for (StringTokenizer tk = new StringTokenizer(entete, lineSep_); tk.hasMoreTokens();)
! {
r += formatToMaxChar(tk.nextToken(), com) + lineSep_;
}
--- 122,138 ----
* @throws IOException
*/
! private void writeEntete(String _nomEtude) throws IOException {
! String entete= FuLib.replace(enteteFormat_, "${TITLE}", _nomEtude);
! entete= FuLib.replace(entete, "${VERSION}", version_.getVersionName());
! entete=
! FuLib.replace(
! entete,
! "${DATE}",
! DateFormat.getDateInstance().format(Calendar.getInstance().getTime()));
! String r= "";
! String com= "" + version_.getCommentChar();
! for (StringTokenizer tk= new StringTokenizer(entete, lineSep_);
! tk.hasMoreTokens();
! ) {
r += formatToMaxChar(tk.nextToken(), com) + lineSep_;
}
***************
*** 145,201 ****
}
! private void writeRubrique(String _rubrique, DicoEntite[] _ent, DicoCasInterface inter,DodicoAnalyze.Editor _analyze) throws IOException
! {
! if ((_ent == null) || (_ent.length == 0))
! {
return;
}
! int entiteNomMaxLength = geEntiteNomtMaxLength(_ent) + 1;
! String entete = FuLib.replace(enteteRubrique_, "${RUBRIQUE}", _rubrique);
writeln();
out_.write(entete);
! int n = _ent.length;
DicoEntite ent;
! int maxChar = version_.getMaxCharPerLine();
! for (int i = 0; i < n; i++)
! {
! ent = _ent[i];
! if (!version_.getDico().isKey(ent))
! {
! _analyze.addWarning("Entité inconnue pour ce format" + " " + ent.getNom(), -1);
! }
! else
! {
! String value = inter.getValue(ent);
! if (ent.containsStringDataType())
! {
! value = FuLib.replace(value, "'", "''");
! value = "'" + value + "'";
}
! String initNom = ent.getNom();
! String nom = DodicoLib.adjustSize(entiteNomMaxLength, initNom);
! if (nom.length() + value.length() + 1 > maxChar)
! {
! if (initNom.length() + value.length() + 1 <= maxChar)
! {
writeln(initNom + "=" + value);
! }
! else
! {
! if (initNom.length() + 1 > maxChar)
! {
! System.err.println("Les noms des parametres ne doivent pas dépasser 72 char");
! writeln(version_.getCommentChar() + DodicoLib.geti18n("Ce parametres depasse 72 caractères"));
}
writeln(initNom + "=");
! if (value.length() > maxChar)
! {
! value = formatToMaxChar(value);
}
writeln(value);
}
! }
! else
! {
writeln(nom + "=" + value);
}
--- 140,190 ----
}
! private void writeRubrique(
! String _rubrique,
! DicoEntite[] _ent,
! DicoCasInterface inter)
! throws IOException {
! if ((_ent == null) || (_ent.length == 0)) {
return;
}
! int entiteNomMaxLength= geEntiteNomtMaxLength(_ent) + 1;
! String entete= FuLib.replace(enteteRubrique_, "${RUBRIQUE}", _rubrique);
writeln();
out_.write(entete);
! int n= _ent.length;
DicoEntite ent;
! int maxChar= version_.getMaxCharPerLine();
! for (int i= 0; i < n; i++) {
! ent= _ent[i];
! if (!version_.getDico().isKey(ent)) {
! analyze_.addWarning(
! "Entité inconnue pour ce format" + " " + ent.getNom(),
! -1);
! } else {
! String value= inter.getValue(ent);
! if (ent.containsStringDataType()) {
! value= FuLib.replace(value, "'", "''");
! value= "'" + value + "'";
}
! String initNom= ent.getNom();
! String nom= DodicoLib.adjustSize(entiteNomMaxLength, initNom);
! if (nom.length() + value.length() + 1 > maxChar) {
! if (initNom.length() + value.length() + 1 <= maxChar) {
writeln(initNom + "=" + value);
! } else {
! if (initNom.length() + 1 > maxChar) {
! System.err.println(
! "Les noms des parametres ne doivent pas dépasser 72 char");
! writeln(
! version_.getCommentChar()
! + DodicoLib.geti18n("Ce parametres depasse 72 caractères"));
}
writeln(initNom + "=");
! if (value.length() > maxChar) {
! value= formatToMaxChar(value);
}
writeln(value);
}
! } else {
writeln(nom + "=" + value);
}
***************
*** 209,214 ****
* ligne. Un separateur de ligne ( et pas de prefixe) est ajoute.
*/
! private String formatToMaxChar(String _init)
! {
return formatToMaxChar(_init, "");
}
--- 198,202 ----
* ligne. Un separateur de ligne ( et pas de prefixe) est ajoute.
*/
! private String formatToMaxChar(String _init) {
return formatToMaxChar(_init, "");
}
***************
*** 218,229 ****
* ligne. Un separateur de ligne (et un prefixe optionnel) est ajoute.
*/
! private String formatToMaxChar(String _init, String _pref)
! {
! int maxChar = version_.getMaxCharPerLine()...
[truncated message content] |