aboutsummaryrefslogtreecommitdiffstats
path: root/rba.tool.core/src/rba/tool/core/sort/SortValueManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'rba.tool.core/src/rba/tool/core/sort/SortValueManager.java')
-rw-r--r--rba.tool.core/src/rba/tool/core/sort/SortValueManager.java56
1 files changed, 56 insertions, 0 deletions
diff --git a/rba.tool.core/src/rba/tool/core/sort/SortValueManager.java b/rba.tool.core/src/rba/tool/core/sort/SortValueManager.java
new file mode 100644
index 0000000..17fbb37
--- /dev/null
+++ b/rba.tool.core/src/rba/tool/core/sort/SortValueManager.java
@@ -0,0 +1,56 @@
+package rba.tool.core.sort;
+
+import org.eclipse.core.resources.IProject;
+
+import rba.tool.core.console.ConsoleManager;
+import rba.tool.core.z3.Z3CodeManager;
+
+public class SortValueManager {
+
+ public static SortValueManager INSTANCE = new SortValueManager();
+
+ private static final String CONSOLE_TITLE = "#### Execution of Constraint ####";
+
+ private SortValue areaZorderSortValue = new SortValue();
+
+ private SortValue visibilitySortValue = new SortValue();;
+
+ private SortValue csPrioritySortValue = new SortValue();;
+
+ private static final String NOTIFIER_ID = "rba.tool.core.CalculateSortValue";
+
+ public boolean updateSortValue(IProject project) {
+
+ try {
+ ISortValueCalculation calc = Z3CodeManager.INSTNACE.getSortCaluculator(project);
+ calc.setUp();
+ areaZorderSortValue.setSortValue(calc.calculateArea_zorder());
+ visibilitySortValue.setSortValue(calc.calculateAllocatable_visibility());
+ csPrioritySortValue.setSortValue(calc.calculateContentState_priority());
+ calc.close();
+
+ } catch (RuntimeException e) {
+ ConsoleManager.INSTANCE.output(CONSOLE_TITLE, NOTIFIER_ID);
+ ConsoleManager.INSTANCE.output(e.getMessage(), NOTIFIER_ID);
+ ConsoleManager.INSTANCE.output("##################", NOTIFIER_ID);
+
+ areaZorderSortValue.clear();
+ visibilitySortValue.clear();
+ csPrioritySortValue.clear();
+ return false;
+ }
+ return true;
+ }
+
+ public SortValue getAreaZorderSortValue() {
+ return areaZorderSortValue;
+ }
+
+ public SortValue getAllocatableVisibilitySortValue() {
+ return visibilitySortValue;
+ }
+
+ public SortValue getCsPrioritySortValue() {
+ return csPrioritySortValue;
+ }
+}