1 11 12 package org.eclipse.core.internal.databinding.observable.tree; 13 14 18 public abstract class TreeDiffNode { 19 20 23 public final static int NO_CHANGE = 0x00; 24 25 28 public final static int ADDED = 0x01; 29 30 33 public final static int REMOVED = 0x02; 34 35 38 public final static int REPLACED = 0x03; 39 40 43 public static final TreeDiffNode[] NO_CHILDREN = new TreeDiffNode[0]; 44 45 48 public static final int INDEX_UNKNOWN = -1; 49 50 53 public abstract int getChangeType(); 54 55 58 public abstract Object getOldElement(); 59 60 64 public abstract Object getNewElement(); 65 66 69 public abstract int getIndex(); 70 71 77 public abstract TreeDiffNode[] getChildren(); 78 79 protected void doAccept(TreeDiffVisitor visitor, TreePath parentPath) { 80 TreePath currentPath = parentPath.createChildPath(getNewElement()); 81 boolean recurse = visitor.visit(this, currentPath); 82 if (recurse) { 83 TreeDiffNode[] children = getChildren(); 84 for (int i = 0; i < children.length; i++) { 85 TreeDiffNode child = children[i]; 86 child.doAccept(visitor, currentPath); 87 } 88 } 89 } 90 91 } 92 | Popular Tags |