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; }
/** * 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); }
/** * 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); }