Ejemplo n.º 1
0
 private void setTOrder(int t) {
   try {
     ResourcesPlugin.getWorkspace().getRoot().setPersistentProperty(T_INTERACTION, t + "");
   } catch (CoreException e) {
     FMCorePlugin.getDefault().logError(e);
   }
 }
Ejemplo n.º 2
0
 public boolean isImplied() {
   if (isImplied == null) {
     FMCorePlugin.getDefault().reportBug(278);
     return false;
   }
   return isImplied;
 }
Ejemplo n.º 3
0
 private void setMax(int max) {
   try {
     ResourcesPlugin.getWorkspace().getRoot().setPersistentProperty(MAX, max + "");
   } catch (CoreException e) {
     FMCorePlugin.getDefault().logError(e);
   }
 }
Ejemplo n.º 4
0
 private static void setTest(boolean test) {
   try {
     ResourcesPlugin.getWorkspace().getRoot().setPersistentProperty(TEST, test + "");
   } catch (CoreException e) {
     FMCorePlugin.getDefault().logError(e);
   }
 }
Ejemplo n.º 5
0
 private static void setOrder(String order) {
   try {
     ResourcesPlugin.getWorkspace().getRoot().setPersistentProperty(ORDER, order);
   } catch (CoreException e) {
     FMCorePlugin.getDefault().logError(e);
   }
 }
Ejemplo n.º 6
0
 private static void setGenerate(String generate) {
   try {
     ResourcesPlugin.getWorkspace().getRoot().setPersistentProperty(GENERATE, generate);
   } catch (CoreException e) {
     FMCorePlugin.getDefault().logError(e);
   }
 }
Ejemplo n.º 7
0
 /** Saves the toggle state of the dialog at persistent properties */
 protected static void setTWise(String algorithm, int t) {
   try {
     ResourcesPlugin.getWorkspace().getRoot().setPersistentProperty(T_WISE, algorithm + "|" + t);
   } catch (CoreException e) {
     FMCorePlugin.getDefault().logError(e);
   }
 }
Ejemplo n.º 8
0
 /** Gets the toggle state from persistent properties */
 protected static String getTWise() {
   try {
     return ResourcesPlugin.getWorkspace().getRoot().getPersistentProperty(T_WISE);
   } catch (CoreException e) {
     FMCorePlugin.getDefault().logError(e);
   }
   return null;
 }
Ejemplo n.º 9
0
 private String getMax() {
   String returnValue = "";
   try {
     returnValue = ResourcesPlugin.getWorkspace().getRoot().getPersistentProperty(MAX);
   } catch (CoreException e) {
     FMCorePlugin.getDefault().logError(e);
   }
   return returnValue != null ? returnValue : "";
 }
 public void writeToFile(File file) {
   FileOutputStream output = null;
   try {
     if (!file.exists()) file.createNewFile();
     output = new FileOutputStream(file);
     output.write(writeToString().getBytes(Charset.availableCharsets().get("UTF-8")));
     output.flush();
   } catch (IOException e) {
     FMCorePlugin.getDefault().logError(e);
   } finally {
     try {
       if (output != null) {
         output.close();
       }
     } catch (IOException e) {
       FMCorePlugin.getDefault().logError(e);
     }
   }
 }
Ejemplo n.º 11
0
  public Comparison compare(FeatureModel oldModel, FeatureModel newModel) {
    this.oldModel = oldModel;
    this.newModel = newModel;
    try {
      addedFeatures = calculateAddedFeatures(oldModel, newModel);
      deletedFeatures = calculateAddedFeatures(newModel, oldModel);

      HashMap<Object, Node> oldMap = NodeCreator.calculateReplacingMap(oldModel);
      HashMap<Object, Node> newMap = NodeCreator.calculateReplacingMap(newModel);
      optimizeReplacingMaps(oldMap, newMap);

      oldRoot = NodeCreator.createNodes(oldModel, oldMap);
      newRoot = NodeCreator.createNodes(newModel, newMap);

      oldRoot = createFalseStatementForConcreteVariables(addedFeatures, oldRoot);
      newRoot = createFalseStatementForConcreteVariables(deletedFeatures, newRoot);

      oldRootUpdated = removeIdenticalNodes(oldRoot, newRoot);
      newRootUpdated = removeIdenticalNodes(newRoot, oldRoot);

      removedProducts = new ExampleCalculator(oldModel, timeout);
      implies = implies(oldRoot, newRootUpdated, removedProducts);

      addedProducts = new ExampleCalculator(newModel, timeout);
      isImplied = implies(newRoot, oldRootUpdated, addedProducts);

      if (implies)
        if (isImplied) result = Comparison.REFACTORING;
        else result = Comparison.GENERALIZATION;
      else if (isImplied) result = Comparison.SPECIALIZATION;
      else result = Comparison.ARBITRARY;
    } catch (OutOfMemoryError e) {
      result = Comparison.OUTOFMEMORY;
    } catch (TimeoutException e) {
      result = Comparison.TIMEOUT;
    } catch (Exception e) {
      if (FMCorePlugin.getDefault() != null) FMCorePlugin.getDefault().logError(e);
      else e.printStackTrace();
      result = Comparison.ERROR;
    }
    return result;
  }
Ejemplo n.º 12
0
 @Override
 public Configuration clone() {
   if (!this.getClass().equals(Configuration.class)) {
     try {
       return (Configuration) super.clone();
     } catch (CloneNotSupportedException e) {
       FMCorePlugin.getDefault().logError(e);
     }
   }
   return new Configuration(this);
 }
Ejemplo n.º 13
0
 private static String getOrder() {
   try {
     final String generate = ResourcesPlugin.getWorkspace().getRoot().getPersistentProperty(ORDER);
     if (generate == null) {
       return DEFAULT;
     }
     return generate;
   } catch (CoreException e) {
     FMCorePlugin.getDefault().logError(e);
   }
   return DEFAULT;
 }
Ejemplo n.º 14
0
 private static String getGenerate() {
   try {
     final String generate =
         ResourcesPlugin.getWorkspace().getRoot().getPersistentProperty(GENERATE);
     if (generate == null) {
       return ALL_VALID_CONFIGURATIONS;
     }
     return generate;
   } catch (CoreException e) {
     FMCorePlugin.getDefault().logError(e);
   }
   return ALL_VALID_CONFIGURATIONS;
 }
Ejemplo n.º 15
0
 /** Gets the toggle state from persistent properties */
 protected static int getT_Interaction() {
   try {
     final String generate =
         ResourcesPlugin.getWorkspace().getRoot().getPersistentProperty(T_INTERACTION);
     if (generate == null) {
       return 2;
     }
     return Integer.parseInt(generate);
   } catch (CoreException e) {
     FMCorePlugin.getDefault().logError(e);
   }
   return 2;
 }
Ejemplo n.º 16
0
 private static boolean getTest() {
   try {
     final String test = ResourcesPlugin.getWorkspace().getRoot().getPersistentProperty(TEST);
     if ("true".equals(test)) {
       return true;
     }
     if ("false".equals(test)) {
       return false;
     }
     return true;
   } catch (CoreException e) {
     FMCorePlugin.getDefault().logError(e);
   }
   return false;
 }