]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/ModificationAdapter.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.diagram / src / org / simantics / diagram / synchronization / ModificationAdapter.java
diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/ModificationAdapter.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/ModificationAdapter.java
new file mode 100644 (file)
index 0000000..7ba43dc
--- /dev/null
@@ -0,0 +1,82 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.diagram.synchronization;\r
+\r
+import org.simantics.db.WriteGraph;\r
+\r
+/**\r
+ * @author Tuukka Lehtonen\r
+ */\r
+public class ModificationAdapter implements IModification {\r
+\r
+    public static final Double HIGH_PRIORITY                = 1d;\r
+\r
+    public static final Double REMOVE_EDGE_PRIORITY         = 2d;\r
+    public static final Double REMOVE_BRANCH_PRIORITY       = 3d;\r
+    public static final Double REMOVE_CONNECTION_PRIORITY   = 4d;\r
+    public static final Double REMOVE_NODE_PRIORITY         = 5d;\r
+\r
+    public static final Double ADD_NODE_PRIORITY            = 6d;\r
+    public static final Double ADD_CONNECTION_PRIORITY      = 7d;\r
+    public static final Double ADD_BRANCH_PRIORITY          = 8d;\r
+    public static final Double ADD_EDGE_PRIORITY            = 9d;\r
+    public static final Double SET_CONNECTION_TYPE_PRIORITY = 9.5d;\r
+\r
+    public static final Double LOW_PRIORITY                 = 10d;\r
+\r
+    final Double priority;\r
+\r
+    Throwable exception;\r
+    boolean complete = false;\r
+    protected ModificationAdapter(Double priority) {\r
+        assert priority != null;\r
+        this.priority = priority;\r
+    }\r
+    @Override\r
+    public boolean isComplete() {\r
+        return complete;\r
+    }\r
+    @Override\r
+    public void markComplete() {\r
+        this.complete = true;\r
+    }\r
+    @Override\r
+    public void perform(WriteGraph g) throws Exception {\r
+    }\r
+    @Override\r
+    public void completed() {\r
+    }\r
+    @Override\r
+    public Throwable getException() {\r
+        return exception;\r
+    }\r
+    @Override\r
+    public void setException(Throwable t) {\r
+        this.exception = t;\r
+    }\r
+    //@Override\r
+    //public String toString() {\r
+    //    return getClass().getSimpleName();\r
+    //}\r
+    @Override\r
+    public Double getPriority() {\r
+        return priority;\r
+    }\r
+    @Override\r
+    public int compareTo(IModification arg0) {\r
+        return priority.compareTo(arg0.getPriority());\r
+    }\r
+    @Override\r
+    public String toString() {\r
+        return getClass().getSimpleName() + "$" + System.identityHashCode(this);\r
+    }\r
+}
\ No newline at end of file