package test.article.recs.utils; import java.util.HashMap; import java.util.Map; import java.util.Random; import schedframe.scheduling.tasks.TaskInterface; public class TaskToApp { private static int ABINIT = 20; private static int C_RAY = 40; private static int TAR = 60; private static int LIN_3GB = 70; private static int LIN_TINY = 80; private static int FFT = 100; private static Random rand = new Random(5); private static Map mapping = new HashMap(); public AppType getAppType(TaskInterface task){ AppType appType = null; if(mapping.get(task.getJobId())!= null){ appType = mapping.get(task.getJobId()); }else{ appType = randomAppType(); mapping.put(task.getJobId(), appType); }return appType; } private AppType randomAppType(){ AppType appType = null; int n = rand.nextInt(100); if(n < ABINIT) { appType = AppType.abinit; }else if(n < C_RAY){ appType = AppType.c_ray; }else if(n < TAR){ appType = AppType.tar; } else if (n < LIN_3GB){ appType = AppType.lin_3gb; } else if (n < LIN_TINY){ appType = AppType.lin_tiny; } else if (n < FFT){ appType = AppType.fft; } return appType; } }