コード例 #1
0
 private static Configuration getConfiguration(IProject project) {
   Configuration configuration = null;
   if (!configurations.isEmpty()) {
     System.out.println("1");
     for (Configuration tempConfiguration : configurations) {
       if (tempConfiguration.getProject().equals(project)) configuration = tempConfiguration;
     }
   }
   if (configuration == null) {
     System.out.println("2");
     configuration = loadConfiguration(project);
   }
   if (configuration == null) {
     System.out.println("3");
     configuration = new Configuration(project);
     LinkedList<String> smellIdList = new LinkedList<String>();
     if (allSmells == null) getAllModelSmells();
     double[] limits = new double[allSmells.size()];
     for (ModelSmell smell : allSmells) {
       smellIdList.add(smell.getId());
       System.out.println("add: " + smell.getId());
       if (smell.getFinderClass() instanceof MetricBasedModelSmellFinderClass) {
         limits[allSmells.indexOf(smell)] = 1.0;
         // ((MetricBasedModelSmellFinderClass)smell.getFinderClass()).setLimit(1.0);
       }
     }
     configuration.setSelection(smellIdList);
     configuration.setLimits(limits);
   }
   configurations.add(configuration);
   return configuration;
 }
コード例 #2
0
 /**
  * For a given smell ID this method returns the limit set in the configuration. If it <br>
  * - is not a metric based smell or the limit was not set. It return 0.0.
  *
  * @param project - target project
  * @param smellID - the id of the given smell
  * @return limit set in the projects configuration or 0.0
  */
 public static Double getLimit(IProject project, String smellID) {
   System.out.println("=========>>> EMFModelSmells, getLimit");
   System.out.println("=========>>> EMFModelSmells, id: " + smellID);
   Configuration config = getConfiguration(project);
   Double limit = config.getLimit(smellID);
   System.out.println("===>>> EMF Model Smells: limit: " + limit);
   return limit;
 }
コード例 #3
0
 /**
  * Return the <i>ModelSmell</i> objects for the smells which are active on the <br>
  * - given project.
  *
  * @param project - target project
  * @return - all model smell active for the given project
  */
 public static LinkedList<ModelSmell> getSelectedModelSmells(IProject project) {
   System.out.println("===>>> EMFModelSmells - getSelectedModelSmlls");
   Configuration config = getConfiguration(project);
   return config.getSelectedModelSmells();
 }
コード例 #4
0
 /**
  * Sets the configured data for a project by manipulating the <br>
  * - <i>Configuration</i> object for this project currently <br>
  * - held by EMF Smells. <br>
  * - Also sets the limits for metric based smells.
  *
  * @param project - target project
  * @param selection - array determening the selection of smells
  * @param limits - limits for the smells
  */
 public static void setConfiguration(IProject project, boolean[] selection, double[] limits) {
   System.out.println("===>>> EMFModelSmells, setConfiguiration");
   Configuration configuration = getConfiguration(project);
   configuration.setSelection(selection);
   configuration.setLimits(limits);
 }
コード例 #5
0
 /**
  * Sets the configured data for a project by manipulating the <br>
  * - <i>Configuration</i> object for this project currently <br>
  * - held by EMF Smells.
  *
  * @param project - target project
  * @param selection - array determening the selection of smells
  */
 public static void setConfiguration(IProject project, boolean[] selection) {
   System.out.println("===>>> EMFModelSmells, setConfiguration(2)");
   Configuration configuration = getConfiguration(project);
   configuration.setSelection(selection);
 }