From: Frederic D. <de...@us...> - 2004-06-11 16:32:56
|
Update of /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/fichiers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32356/src/org/fudaa/dodico/fichiers Modified Files: FileFormatSoftware.java FileFormat.java Log Message: Index: FileFormatSoftware.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/fichiers/FileFormatSoftware.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FileFormatSoftware.java 25 Nov 2003 10:11:34 -0000 1.4 --- FileFormatSoftware.java 11 Jun 2004 16:32:16 -0000 1.5 *************** *** 1,4 **** /* - * @file FileFormatSoftware.java * @creation 14 août 2003 * @modification $Date$ --- 1,3 ---- *************** *** 8,11 **** --- 7,11 ---- */ package org.fudaa.dodico.fichiers; + import com.memoire.bu.BuInformationsSoftware; /** *************** *** 14,32 **** */ public class FileFormatSoftware { ! public final static BuInformationsSoftware TELEMAC_IS= ! new BuInformationsSoftware(); ! public final static BuInformationsSoftware REFLUX_IS= ! new BuInformationsSoftware(); static { ! TELEMAC_IS.name= "telemac"; ! TELEMAC_IS.http= "http://telemacsystem.com"; ! TELEMAC_IS.rights= "LNHE"; ! TELEMAC_IS.contact= "in...@te..."; ! REFLUX_IS.name= "reflux"; ! REFLUX_IS.http= ! "http://www.cetmef.equipement.gouv.fr/projets/hydraulique/reflux/bandeau.html"; ! REFLUX_IS.rights= "CETMEF"; ! REFLUX_IS.contact= "pat...@eq..."; } /** * --- 14,36 ---- */ public class FileFormatSoftware { ! ! public final static BuInformationsSoftware TELEMAC_IS = new BuInformationsSoftware(); ! public final static BuInformationsSoftware REFLUX_IS = new BuInformationsSoftware(); ! public final static BuInformationsSoftware RUBAR_IS = new BuInformationsSoftware(); static { ! TELEMAC_IS.name = "telemac"; ! TELEMAC_IS.http = "http://telemacsystem.com"; ! TELEMAC_IS.rights = "LNHE"; ! TELEMAC_IS.contact = "in...@te..."; ! REFLUX_IS.name = "reflux"; ! REFLUX_IS.http = "http://www.cetmef.equipement.gouv.fr/projets/hydraulique/reflux/bandeau.html"; ! REFLUX_IS.rights = "CETMEF"; ! REFLUX_IS.contact = "pat...@eq..."; ! RUBAR_IS.name = "rubar"; ! RUBAR_IS.http = "http://www.lyon.cemagref.fr/"; ! RUBAR_IS.rights = "CEMAGREF"; ! } + /** * *************** *** 35,37 **** super(); } ! } --- 39,41 ---- super(); } ! } \ No newline at end of file Index: FileFormat.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/fichiers/FileFormat.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** FileFormat.java 30 Apr 2004 07:18:51 -0000 1.9 --- FileFormat.java 11 Jun 2004 16:32:16 -0000 1.10 *************** *** 8,11 **** --- 8,12 ---- */ package org.fudaa.dodico.fichiers; + import java.io.File; import java.util.Comparator; *************** *** 15,64 **** import org.fudaa.dodico.commun.DodicoLib; /** - * * @author deniger * @version $Id$ */ public abstract class FileFormat implements Comparable { ! public static final int MODE_ASCII= 0; ! public static final int MODE_BINAIRE= 1; //Le nombre de fichiers demandé par ce format. ! private int nbFile_; ! protected String[] extensions_; ! protected String nom_; ! protected String ID_; ! protected String description_; ! protected int mode_; //le type du fichier projet,maillage,autre,... ! protected int type_; protected BuInformationsSoftware software_; public FileFormat(int _nbFile) { ! if (_nbFile < 1) ! throw new IllegalArgumentException("Nombre de fichier strictement positif"); ! nbFile_= _nbFile; } public int getVersionNb() { return 1; } public String[] getVersions() { return new String[] { getLastVersion()}; } public abstract String getLastVersion(); ! ! public boolean isExtension(String _ext){ ! if(extensions_==null) return false; ! return (DodicoLib.findObject(extensions_, _ext)>=0); } public abstract FileFormatVersion getLastVersionInstance(); /** ! * Si renvoie true, cela signifie que les versions peuvent être ! * castees en FileFormatVersionGrid pour lire un maillage. */ public boolean containsGrid() { return false; } /** * Returns the description. * @return String */ --- 16,83 ---- import org.fudaa.dodico.commun.DodicoLib; /** * @author deniger * @version $Id$ */ public abstract class FileFormat implements Comparable { ! ! public static final int MODE_ASCII = 0; ! public static final int MODE_BINAIRE = 1; //Le nombre de fichiers demandé par ce format. ! private int nbFile_; ! protected String[] extensions_; ! protected String nom_; ! protected String ID_; ! protected String description_; ! protected int mode_; //le type du fichier projet,maillage,autre,... ! protected int type_; protected BuInformationsSoftware software_; + public FileFormat(int _nbFile) { ! if (_nbFile < 1) throw new IllegalArgumentException("Nombre de fichier strictement positif"); ! nbFile_ = _nbFile; } + public int getVersionNb() { return 1; } + public String[] getVersions() { return new String[] { getLastVersion()}; } + public abstract String getLastVersion(); ! ! public boolean isExtension(String _ext) { ! if (extensions_ == null) return false; ! boolean r = (DodicoLib.findObject(extensions_, _ext) >= 0); ! if (!r) return (DodicoLib.findObject(extensions_, _ext.toLowerCase()) >= 0); ! return r; } + /** + * @return la version par defaut + */ public abstract FileFormatVersion getLastVersionInstance(); /** ! * @param _id identifiant permettant de specifier le type de la version ! * @return la version selon l'id ! */ ! public FileFormatVersion getLastVersionInstance(String _id) { ! return getLastVersionInstance(); ! } ! ! /** ! * Si renvoie true, cela signifie que les versions peuvent être castees en FileFormatVersionGrid ! * pour lire un maillage. */ public boolean containsGrid() { return false; } + /** * Returns the description. + * * @return String */ *************** *** 66,74 **** --- 85,96 ---- return description_; } + public String getID() { return ID_; } + /** * Returns the extensions. + * * @return String[] */ *************** *** 76,81 **** --- 98,105 ---- return extensions_; } + /** * Returns the mode. + * * @return int */ *************** *** 83,91 **** --- 107,118 ---- return mode_; } + public int getType() { return type_; } + /** * Returns the nbFile. + * * @return int */ *************** *** 93,98 **** --- 120,127 ---- return nbFile_; } + /** * Returns the nom. + * * @return String */ *************** *** 100,105 **** --- 129,136 ---- return nom_; } + /** * Returns the software. + * * @return BuInformationsSoftware */ *************** *** 107,145 **** return software_; } /** ! * Renvoie a partir du nombre de fichier et des extensions du format les fichiers ! * correspondants (si le nombre de fichier est 1, fichier donne est renvoye). * ! * @return un tableau de taille getNbFile() avec les fichiers existants ! * et correspondant aux extensions. */ public final File[] getFile(File _fInit) { ! File[] r= new File[nbFile_]; ! if (_fInit == null) ! return r; ! if (nbFile_ == 1) ! return new File[] { _fInit }; ! String base= DodicoLib.getSansExtension(_fInit.getAbsolutePath()); ! for (int i= 0; i < nbFile_; i++) { ! r[i]= new File(base + "." + extensions_[i]); } return r; } /** ! * Ce comparateur permet de classer des formats selon leurs nom (ATTENTION 2 ! * formats avec le meme nom seront supposes egaux). */ public static class FileFormatNameComparator implements Comparator { /** ! * Compare 2 FileFormat selon le nom (uniquement). ! */ public int compare(Object o1, Object o2) { if (!(o1 instanceof FileFormat)) ! throw new IllegalArgumentException("o1 doit etre de type FileFormat"); if (!(o2 instanceof FileFormat)) ! throw new IllegalArgumentException("o2 doit etre de type FileFormat"); ! return ((FileFormat)o1).getName().compareTo(((FileFormat)o2).getName()); } } /** * Compare les noms des formats --- 138,178 ---- return software_; } + /** ! * Renvoie a partir du nombre de fichier et des extensions du format les fichiers correspondants ! * (si le nombre de fichier est 1, fichier donne est renvoye). * ! * @return un tableau de taille getNbFile() avec les fichiers existants et correspondant aux ! * extensions. */ public final File[] getFile(File _fInit) { ! File[] r = new File[nbFile_]; ! if (_fInit == null) return r; ! if (nbFile_ == 1) return new File[] { _fInit}; ! String base = DodicoLib.getSansExtension(_fInit.getAbsolutePath()); ! for (int i = 0; i < nbFile_; i++) { ! r[i] = new File(base + "." + extensions_[i]); } return r; } + /** ! * Ce comparateur permet de classer des formats selon leurs nom (ATTENTION 2 formats avec le meme ! * nom seront supposes egaux). */ public static class FileFormatNameComparator implements Comparator { + /** ! * Compare 2 FileFormat selon le nom (uniquement). ! */ public int compare(Object o1, Object o2) { if (!(o1 instanceof FileFormat)) ! throw new IllegalArgumentException("o1 doit etre de type FileFormat"); if (!(o2 instanceof FileFormat)) ! throw new IllegalArgumentException("o2 doit etre de type FileFormat"); ! return ((FileFormat) o1).getName().compareTo(((FileFormat) o2).getName()); } } + /** * Compare les noms des formats *************** *** 147,152 **** public int compareTo(Object o) { if (!(o instanceof FileFormat)) ! throw new IllegalArgumentException("o doit etre de type FileFormat"); ! return getName().compareTo(((FileFormat)o).getName()); } --- 180,185 ---- public int compareTo(Object o) { if (!(o instanceof FileFormat)) ! throw new IllegalArgumentException("o doit etre de type FileFormat"); ! return getName().compareTo(((FileFormat) o).getName()); } *************** *** 157,161 **** return getName(); } - ! } --- 190,193 ---- return getName(); } ! } \ No newline at end of file |