X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/mapping.git/blobdiff_plain/2d2cf77d20dc176ca8fff6cb7993b2bf569d89f7..d5231d68ea145eedd724eb55d1fa56a1c5a7c660:/src/and/Mapping/Algo.java diff --git a/src/and/Mapping/Algo.java b/src/and/Mapping/Algo.java index 142b8a6..ab4a895 100644 --- a/src/and/Mapping/Algo.java +++ b/src/and/Mapping/Algo.java @@ -17,6 +17,8 @@ public abstract class Algo implements Serializable protected Grid gl ; protected Mapping mp ; protected String ids ; + protected String name ; + protected int nb_fault ; /** @@ -28,6 +30,8 @@ public abstract class Algo implements Serializable gl = new Grid() ; mp = new Mapping() ; ids = "" ; + name = "" ; + nb_fault = 0 ; } @@ -42,6 +46,8 @@ public abstract class Algo implements Serializable gl = _gl ; mp = new Mapping() ; ids = "" ; + name = "" ; + nb_fault = 0 ; } @@ -105,10 +111,33 @@ public abstract class Algo implements Serializable */ public void setIdS( String _s ) { - ids = _s ; + if( _s != null ) + { + ids = _s ; + } } + /** + * Set the algorithms parameters when this one is instanciated + * by a class load mechanism. + * @param _params + * @return + */ + public boolean setParams( Object[] _params ) + { + if( _params.length >= 2 ) + { + gr = (Graph) _params[0] ; + gl = (Grid) _params[1]; + } else { + System.err.println( "Not enough parameters!" ) ; + return false ; + } + + return true ; + } + /** * Return the string identifier of the algorithm. * @return The algorithm's identifier @@ -120,21 +149,26 @@ public abstract class Algo implements Serializable /** - * Update the grid status after having done the mapping. + * Set the name of the mapping algorithm. + * @param _n The new name */ - public void updateGrid() + public void setName( String _n ) { - if( mp.getMappedGNodes().size() > 0 ) + if( _n != null ) { - ArrayList temp = mp.getMappedGNodes() ; - for( int i = 0 ; i < temp.size() ; i++ ) - { - gl.getClusterOfNode( temp.get( i ) ).setGNodeStatus( temp.get( i ), true ) ; - - gl.setMappedStatus( temp.get( i ), true ) ; - } + name = _n ; } } + + + /** + * Return the name of the mapping algorithm. + * @return The algorithm's name + */ + public String getName() + { + return name ; + } } /** La programmation est un art, respectons ceux qui la pratiquent !! **/