]> gerrit.simantics Code Review - simantics/interop.git/commitdiff
Merge branch 'master' of
authorMarko Luukkainen <marko.luukkainen@vtt.fi>
Tue, 21 Feb 2017 10:44:14 +0000 (12:44 +0200)
committerMarko Luukkainen <marko.luukkainen@vtt.fi>
Tue, 21 Feb 2017 10:44:14 +0000 (12:44 +0200)
ssh://luukkainen@www.simantics.org:29418/simantics/interop

Conflicts:
org.simantics.interop.update/src/org/simantics/interop/update/model/AddDeleteUpdateOp.java
org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateOperations.java
org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateTree.java

1  2 
org.simantics.interop.update/src/org/simantics/interop/update/model/AddDeleteUpdateOp.java
org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateOperations.java
org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateTree.java

index e32ebd0fcac31c3efad201b453187c71aa0a4dc8,c01297e60bcab214bd0321dacd412cae85b76480..04d15844ae89f6fe14b41b3f4a12293b40147daf
@@@ -17,7 -17,7 +17,11 @@@ import org.simantics.layer0.Layer0
  
  public abstract class AddDeleteUpdateOp extends UpdateOp {
        
++<<<<<<< HEAD
 +      protected boolean add;
++=======
+       boolean add;
++>>>>>>> branch 'master' of ssh://luukkainen@www.simantics.org:29418/simantics/interop
        
        public AddDeleteUpdateOp(GraphChanges changes) {
                super(changes);
index 9c929c59cc4f267d14d1cc5f867d05fce23c00d6,a324763272318d31fd08e2fa9272291dca5a33a5..74acf180cb455c952a14f1a7dcd21a866bed5ea6
@@@ -89,15 -86,6 +89,15 @@@ public abstract  class UpdateOperation
                operations.add(op);
        }
        
-                       operations.remove(oldOp);
 +      protected void replaceOp(Resource r, UpdateOp op) {
 +              UpdateOp oldOp = opMap.remove(r);
 +              if (oldOp != null) {
++                      operations.remove(op);
 +              }
 +              opMap.put(r, op);
 +              operations.add(op);
 +      }
 +      
        protected UpdateOp getOP(Resource r) {
                return opMap.get(r);
        }
index b627774b50b0784dd1d498b6e12388994af1d46a,516ccd3f4194853238f5f4839b4e9c7aa5d8c019..5af784eba193427f77b465a156c4f1bffece4358
@@@ -37,41 -37,41 +37,79 @@@ public abstract class UpdateTree 
                return rootNode;
        }
        
++<<<<<<< HEAD
 +      protected abstract UpdateNode createNode(Status status, Resource r);
 +      protected abstract UpdateNode createNode(Status status, UpdateOp op);
 +      
 +      private UpdateNode createNode(Resource r1, Resource r2) {
 +              UpdateNode node = null;
 +              if (r1 != null && r2 != null) {
 +                      node =  createNode(Status.EXIST, r1);
 +                      nodes.put(r1, node);
 +                      nodes.put(r2, node);
 +              } else if (r1 != null) {
 +                      node = createNode(Status.DELETED ,updateOps.getUpdateOp(r1));
 +                      nodes.put(r1, node);
 +              } else if (r2 != null) {
 +                      node = createNode(Status.NEW, updateOps.getUpdateOp(r2));
 +                      nodes.put(r2, node);
 +              }
 +              return node;
 +      }
 +      
 +      public UpdateNode addNode(ReadGraph g, Resource r1, Resource r2) throws DatabaseException {
 +              if (r1 != null && r2 != null) {
 +                      return null;
 +              }
 +              if (nodes.containsKey(r1))
 +                      return nodes.get(r1);
 +              if (nodes.containsKey(r2))
 +                      return nodes.get(r2);
 +              
 +              UpdateNode node = createNode(r1, r2);
 +              connectParent(g,node);
 +              return node;
 +              
 +      }
 +      
 +      protected boolean connectParent(ReadGraph g, UpdateNode node) throws DatabaseException {
++=======
+       protected abstract UpdateNode createNode(Status staus, Resource r);
+       protected abstract UpdateNode createNode(Status staus, UpdateOp op);
+       
+       private UpdateNode createNode(Resource r1, Resource r2) {
+               UpdateNode node = null;
+               if (r1 != null && r2 != null) {
+                       node =  createNode(Status.EXIST, r1);
+                       nodes.put(r1, node);
+                       nodes.put(r2, node);
+               } else if (r1 != null) {
+                       node = createNode(Status.DELETED ,updateOps.getUpdateOp(r1));
+                       nodes.put(r1, node);
+               } else if (r2 != null) {
+                       node = createNode(Status.NEW, updateOps.getUpdateOp(r2));
+                       nodes.put(r2, node);
+               }
+               return node;
+       }
+       
+       public UpdateNode addNode(ReadGraph g, Resource r1, Resource r2) throws DatabaseException {
+               if (r1 != null && r2 != null) {
+                       return null;
+               }
+               if (nodes.containsKey(r1))
+                       return nodes.get(r1);
+               if (nodes.containsKey(r2))
+                       return nodes.get(r2);
+               
+               UpdateNode node = createNode(r1, r2);
+               connectParent(g,node);
+               return node;
+               
+       }
+       
+       private boolean connectParent(ReadGraph g, UpdateNode node) throws DatabaseException {
++>>>>>>> branch 'master' of ssh://luukkainen@www.simantics.org:29418/simantics/interop
                UpdateNode parent = null;
                while (true) {
                        Resource parentResource = node.getParentResource(g);