1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.diagram.synchronization;
14 import org.simantics.db.WriteGraph;
17 * @author Tuukka Lehtonen
19 public class ModificationAdapter implements IModification {
21 public static final Double HIGH_PRIORITY = 1d;
23 public static final Double REMOVE_EDGE_PRIORITY = 2d;
24 public static final Double REMOVE_BRANCH_PRIORITY = 3d;
25 public static final Double REMOVE_CONNECTION_PRIORITY = 4d;
26 public static final Double REMOVE_NODE_PRIORITY = 5d;
28 public static final Double ADD_NODE_PRIORITY = 6d;
29 public static final Double ADD_CONNECTION_PRIORITY = 7d;
30 public static final Double ADD_BRANCH_PRIORITY = 8d;
31 public static final Double ADD_EDGE_PRIORITY = 9d;
32 public static final Double SET_CONNECTION_TYPE_PRIORITY = 9.5d;
34 public static final Double LOW_PRIORITY = 10d;
36 final Double priority;
39 boolean complete = false;
40 protected ModificationAdapter(Double priority) {
41 assert priority != null;
42 this.priority = priority;
45 public boolean isComplete() {
49 public void markComplete() {
53 public void perform(WriteGraph g) throws Exception {
56 public void completed() {
59 public Throwable getException() {
63 public void setException(Throwable t) {
67 //public String toString() {
68 // return getClass().getSimpleName();
71 public Double getPriority() {
75 public int compareTo(IModification arg0) {
76 return priority.compareTo(arg0.getPriority());
79 public String toString() {
80 return getClass().getSimpleName() + "$" + System.identityHashCode(this);