import java.util.ArrayList;
+import java.util.Random;
/**
public DefaultMapping()
{
super() ;
+ name = "DefaultMapping" ;
}
{
super( _gr, _gd ) ;
archi = _gnodes ;
+ name = "DefaultMapping" ;
}
@Override
public void map()
{
- /* If the mapping is possible ... */
+ /** If the mapping is possible ... **/
if( gr.getNbGTask() <= gl.getNbGNode() )
{
atraiter = gr.getGraph() ;
{
GNode ret = null ;
- if( _dead != null )
+ if( _dead != null && _ag != null )
{
- return _ag.get( 0 ) ;
+ int pos = 0 ;
+ pos = mp.getIdOfAssociation( _dead ) ;
+
+ if( pos == -1 )
+ {
+ System.err.println( "GNode "+_dead+" does not exist in the mapping!" ) ;
+ return null ;
+ }
+
+ if( _ag.size() > 0 )
+ {
+ Random r = new Random() ;
+ ret = _ag.get( r.nextInt( _ag.size() ) ) ;
+
+ } else {
+ System.err.println( "Not enought available nodes in gnodes to replace one !" ) ;
+ return null ;
+ }
+
+ nb_fault++ ;
}
return ret ;
@Override
- public GNode getOtherGNode() {
- // TODO Auto-generated method stub
- return null;
+ public GNode getOtherGNode( ArrayList<GNode> _ag )
+ {
+ /** Returning the first node in the list **/
+ if( _ag.size() > 0 )
+ {
+ return _ag.get( 0 ) ;
+ }
+
+ return null ;
+ }
+
+
+ @Override
+ public boolean setParams(Object[] _params) {
+ return true ;
}
}