4 import java.util.ArrayList;
8 * Implementation of JaceP2P default mapping
9 * @author Sébastien Miquée
12 public class DefaultMapping extends Algo
14 private static final long serialVersionUID = 1L;
17 private ArrayList<GTask> atraiter ;
18 private ArrayList<GNode> archi ;
21 * Default constructor.
23 public DefaultMapping()
31 * @param _gr Tasks graph to be mapped
32 * @param _gd Grid graph
34 public DefaultMapping( Graph _gr, Grid _gd, ArrayList<GNode> _gnodes )
45 /** If the mapping is possible ... **/
46 if( gr.getNbGTask() <= gl.getNbGNode() )
48 atraiter = gr.getGraph() ;
50 System.out.println( "*******************************************" ) ;
51 System.out.println( "* Launching the Default Mapping algorithm *" ) ;
52 System.out.println( "*******************************************\n\n" ) ;
54 /** Save the Mapping **/
55 for( int i = 0 ; i < atraiter.size() ; i++ )
57 mp.addMapping( new Association( archi.get( i ), atraiter.get( i ) ) ) ;
61 System.err.println( "\n\n!!! Unable to map application !\n\n" ) ;
64 /** Update in cluster the status of nodes **/
70 public GNode replaceNode( GNode _dead, ArrayList<GNode> _ag )
77 pos = mp.getIdOfAssociation( _dead ) ;
81 System.err.println( "GNode "+_dead+" does not exist in the mapping!" ) ;
89 System.err.println( "Not enought available nodes in gnodes to replace one !" ) ;
94 /** Update in cluster the status of nodes **/
102 public GNode getOtherGNode( ArrayList<GNode> _ag )
106 return _ag.get( 1 ) ;
115 /** La programmation est un art, respectons ceux qui la pratiquent !! **/