- Including the Javadoc generation in the Makefile;
- Modifying the control on file's path in write/read methods for
graph and grid.
SRC=src
PACK=and
PACKAGE=$(PACK)/Mapping
SRC=src
PACK=and
PACKAGE=$(PACK)/Mapping
- @echo "Compilation of Mapping library ..."
+ @echo "## Compilation of Mapping library ..."
$(JAVAC) -d ./$(BIN) ./$(SRC)/$(PACKAGE)/*.java
$(JAVAC) -d ./$(BIN) ./$(SRC)/$(PACKAGE)/*.java
+jar:clean compile javadoc
- @echo "Creation of Mapping jar ..."
+ @echo "## Creation of Mapping jar ..."
- jar -cvfm $(JAR) Manifest $(EXT) $(JAVADOC) -C $(BIN) $(PACK)/ #$(LIB)
+ jar -cvfm ./$(JAR) Manifest ./$(EXT) ./$(JAVADOC) -C ./$(BIN) ./$(PACK)/
+
+
+javadoc:cleanDoc
+ @echo
+ @echo "## Generating Javadoc ..."
+ @echo
+ javadoc -d ./$(JAVADOC) ./$(SRC)/$(PACKAGE)/*.java
+
- @echo "Cleaning project ..."
+ @echo "## Cleaning project ..."
+ rm -rf ./$(BIN)/* ./$(JAR) ./$(JAVADOC)/*
+cleanDoc:
+ @echo
+ @echo "## Cleaning Javadoc ..."
+ @echo
+ rm -rf ./$(JAVADOC)/*
+
InetAddress addr = InetAddress.getLocalHost() ;
name = new String( addr.getCanonicalHostName() ) ;
} catch( final Exception e ) {
InetAddress addr = InetAddress.getLocalHost() ;
name = new String( addr.getCanonicalHostName() ) ;
} catch( final Exception e ) {
- System.err.println( "Unalbe to retrieve host name !" ) ;
+ System.err.println( "Unalbe to retrieve host's name !" ) ;
e.printStackTrace();
System.exit( 1 ) ;
}
e.printStackTrace();
System.exit( 1 ) ;
}
*/
public static void writeGrid( Grid _gl, String _file, String _path )
{
*/
public static void writeGrid( Grid _gl, String _file, String _path )
{
- if ( ! _file.equals( "" ) && ! _file.endsWith( ".xml" ) )
+ if( _file.equals( "" ) )
+ {
+ System.err.println( "No file's name !\n" ) ;
+ return ;
+ }
+
+ if ( ! _file.endsWith( ".xml" ) )
{
_file = _file + ".xml"; // On ajoute l'extension xml au nom du fichier
}
{
_file = _file + ".xml"; // On ajoute l'extension xml au nom du fichier
}
*/
public static void writeGraph( Graph _gr, String _file, String _path )
{
*/
public static void writeGraph( Graph _gr, String _file, String _path )
{
- if ( ! _file.equals( "" ) && ! _file.endsWith( ".xml" ) )
+ if( _file.equals( "" ) )
+ {
+ System.err.println( "No file's name !\n" ) ;
+ return ;
+ }
+
+ if ( ! _file.endsWith( ".xml" ) )
{
_file = _file + ".xml"; // On ajoute l'extension xml au nom du fichier
}
{
_file = _file + ".xml"; // On ajoute l'extension xml au nom du fichier
}
/**
* Read an application Graph from a file.
* @param _file File's name
/**
* Read an application Graph from a file.
* @param _file File's name
+ * @param _path File's path
* @return The application Graph read
*/
* @return The application Graph read
*/
- public static Graph readGraph( String _file )
+ public static Graph readGraph( String _path, String _file )
- if ( _file.equals( "" ) || ! _file.endsWith( ".xml" ) )
+ if ( _file.equals( "" ) )
- System.err.println( "Bad file !\n" ) ;
+ System.err.println( "No file's name !\n" ) ;
+ if ( ! _file.endsWith( ".xml" ) )
+ {
+ _file = _file + ".xml"; // On ajoute l'extension xml au nom du fichier
+ }
+
+ String path = "" ;
+
+ if( _path.length() != 0 )
+ {
+ path = _path+"/"+_file ;
+ } else {
+ path = new String( "./" + _file ) ;
+ }
+
Graph gr = null ;
XStream xstream = new XStream( new DomDriver() ) ;
try {
Graph gr = null ;
XStream xstream = new XStream( new DomDriver() ) ;
try {
- gr = (Graph) xstream.fromXML( new FileInputStream( _file ) ) ;
+ gr = (Graph) xstream.fromXML( new FileInputStream( path ) ) ;
} catch( FileNotFoundException e ) {
System.err.println( "File not found !\n" ) ;
e.printStackTrace();
return null ;
} catch( ClassCastException e ) {
} catch( FileNotFoundException e ) {
System.err.println( "File not found !\n" ) ;
e.printStackTrace();
return null ;
} catch( ClassCastException e ) {
- System.err.println( "The file does not contain a Graph" ) ;
+ System.err.println( "The file does not contain a valid Graph" ) ;
e.printStackTrace() ;
return null ;
}
e.printStackTrace() ;
return null ;
}
/**
* Read a Grid graph from a file.
* @param _file File's name
/**
* Read a Grid graph from a file.
* @param _file File's name
+ * @param _path File's path
* @return The Grid graph read
*/
* @return The Grid graph read
*/
- public static Grid readGrid( String _file )
- {
- if ( _file.equals( "" ) || ! _file.endsWith( ".xml" ) )
+ public static Grid readGrid( String _path, String _file )
+ {
+ if ( _file.equals( "" ) )
- System.err.println( "Bad file !\n" ) ;
+ System.err.println( "No file's name !\n" ) ;
+ if ( ! _file.endsWith( ".xml" ) )
+ {
+ _file = _file + ".xml"; // On ajoute l'extension xml au nom du fichier
+ }
+
+ String path = "" ;
+
+ if( _path.length() != 0 )
+ {
+ path = _path+"/"+_file ;
+ } else {
+ path = new String( "./" + _file ) ;
+ }
+
Grid gr = null ;
XStream xstream = new XStream( new DomDriver() ) ;
try {
Grid gr = null ;
XStream xstream = new XStream( new DomDriver() ) ;
try {
- gr = (Grid) xstream.fromXML( new FileInputStream( _file ) ) ;
+ gr = (Grid) xstream.fromXML( new FileInputStream( path ) ) ;
} catch( FileNotFoundException e ) {
System.err.println( "File not found !\n" ) ;
e.printStackTrace();
return null ;
} catch( ClassCastException e ) {
} catch( FileNotFoundException e ) {
System.err.println( "File not found !\n" ) ;
e.printStackTrace();
return null ;
} catch( ClassCastException e ) {
- System.err.println( "The file does not contain a Grid" ) ;
+ System.err.println( "The file does not contain a valid Grid" ) ;
e.printStackTrace() ;
return null ;
}
e.printStackTrace() ;
return null ;
}