3 import java.io.Serializable;
4 import java.util.ArrayList;
8 * Abstract class defining the structure for mapping algorithms
9 * @author Sébastien Miquée
11 public abstract class Algo implements Serializable
13 private static final long serialVersionUID = 1L;
18 protected Mapping mp ;
19 protected String ids ;
20 protected String name ;
21 protected int nb_fault ;
25 * Default constructor.
40 * @param _gr Tasks graph to be mapped
41 * @param _gl Grid graph
43 public Algo( Graph _gr, Grid _gl )
57 public abstract void map() ;
61 * Replace a fallen node by a new one, according to the mapping policy.
62 * @param _dead The fallen node to be replaced
63 * @param _ag The list of all available computing nodes
64 * @return The new node
66 public abstract GNode replaceNode( GNode _dead, ArrayList<GNode> _ag ) ;
70 * Find a new node, which may not takes part into the computation process.
71 * Typically such kind of node is used to create a new spawner or a new super-node,
72 * in order to bring fault tolerance.
73 * @return Another node which will not compute
75 public abstract GNode getOtherGNode( ArrayList<GNode> _ag ) ;
79 * Return mapping done.
80 * @return The mapping done
82 public Mapping getMapping()
89 * Return the grid used in the algorithm.
99 * Return the graph used in the algorithm.
102 public Graph getGraph()
109 * Set the string identifier for the algorithm.
110 * @param _s The algorithm's identifier
112 public void setIdS( String _s )
122 * Set the algorithms parameters when this one is instanciated
123 * by a class load mechanism.
127 public boolean setParams( Object[] _params )
129 if( _params.length >= 2 )
131 gr = (Graph) _params[0] ;
132 gl = (Grid) _params[1];
134 System.err.println( "Not enough parameters!" ) ;
142 * Return the string identifier of the algorithm.
143 * @return The algorithm's identifier
145 public String getIdS()
152 * Set the name of the mapping algorithm.
153 * @param _n The new name
155 public void setName( String _n )
165 * Return the name of the mapping algorithm.
166 * @return The algorithm's name
168 public String getName()
174 /** La programmation est un art, respectons ceux qui la pratiquent !! **/