1 19 20 package org.netbeans.modules.xml.xdm.diff; 21 22 import java.util.ArrayList ; 23 import java.util.List ; 24 import org.netbeans.modules.xml.spi.dom.NodeListImpl; 25 import org.netbeans.modules.xml.xam.dom.ElementIdentity; 26 import org.netbeans.modules.xml.xdm.diff.DiffFinder.SiblingInfo; 27 import org.netbeans.modules.xml.xdm.nodes.Element; 28 import org.netbeans.modules.xml.xdm.nodes.Node; 29 import org.netbeans.modules.xml.xdm.nodes.Text; 30 import org.w3c.dom.NodeList ; 31 32 36 public class NodeIdDiffFinder extends DiffFinder { 37 38 39 public NodeIdDiffFinder() { 40 } 41 42 protected Node findMatch(Element child, List <Node> childNodes, org.w3c.dom.Node parent1) { 43 return findMatchedNode(child, childNodes); 44 } 45 46 protected Node findMatch(Text child, List <Node> childNodes) { 47 return findMatchedNode(child, childNodes); 48 } 49 50 private Node findMatchedNode(Node child, List <Node> childNodes) { 51 if (childNodes != null) { 52 for (int i=0; i<childNodes.size(); i++) { 53 Node otherChild = (Node) childNodes.get(i); 54 if (otherChild.getId() == child.getId()) { 55 return otherChild; 56 } 57 } 58 } 59 return null; 60 } 61 62 } 63 64 | Popular Tags |