1 19 20 package org.apache.cayenne.graph; 21 22 28 public abstract class NodeDiff implements GraphDiff, Comparable { 29 30 protected int diffId; 31 protected Object nodeId; 32 33 public NodeDiff(Object nodeId) { 34 this.nodeId = nodeId; 35 } 36 37 public NodeDiff(Object nodeId, int diffId) { 38 this.nodeId = nodeId; 39 this.diffId = diffId; 40 } 41 42 public boolean isNoop() { 43 return false; 44 } 45 46 public abstract void apply(GraphChangeHandler tracker); 47 48 public abstract void undo(GraphChangeHandler tracker); 49 50 public Object getNodeId() { 51 return nodeId; 52 } 53 54 58 public int getDiffId() { 59 return diffId; 60 } 61 62 66 public void setDiffId(int diffId) { 67 this.diffId = diffId; 68 } 69 70 73 public int compareTo(Object o) { 74 if (!(o instanceof NodeDiff)) { 75 throw new IllegalArgumentException ("Can't compare to " + o); 76 } 77 78 return diffId - ((NodeDiff) o).getDiffId(); 79 } 80 } 81 | Popular Tags |