@Test public void testMergeNodes() throws Exception { List<Node> fromParents = new ArrayList<>(); fromParents.add(ManifestTestUtils.createNode( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<slstr:min>265.811904</slstr:min>").getFirstChild()); fromParents.add(ManifestTestUtils.createNode( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<slstr:min>265.668622</slstr:min>\n").getFirstChild()); fromParents.add(ManifestTestUtils.createNode( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<slstr:min>265.156859</slstr:min>\n").getFirstChild()); final Document manifest = ManifestTestUtils.createDocument(); final Element manifestElement = manifest.createElement("slstr:min"); new MinMerger().mergeNodes(fromParents, manifestElement, manifest); assertEquals(0, manifestElement.getAttributes().getLength()); assertEquals(1, manifestElement.getChildNodes().getLength()); assertEquals("265.156859", manifestElement.getFirstChild().getNodeValue()); }
@Override public void mergeNodes(List<Node> fromParents, Element toParent, Document toDocument) throws PDUStitchingException { double minValue = Double.POSITIVE_INFINITY; for (Node fromParent : fromParents) { final double value = Double.parseDouble(fromParent.getTextContent()); minValue = Math.min(minValue, value); } addTextToNode(toParent, "" + minValue, toDocument); }
MinMerger extends AbstractElementMerger { @Override public void mergeNodes(List<Node> fromParents, Element toParent, Document toDocument) throws PDUStitchingException { double minValue = Double.POSITIVE_INFINITY; for (Node fromParent : fromParents) { final double value = Double.parseDouble(fromParent.getTextContent()); minValue = Math.min(minValue, value); } addTextToNode(toParent, "" + minValue, toDocument); } }
MinMerger extends AbstractElementMerger { @Override public void mergeNodes(List<Node> fromParents, Element toParent, Document toDocument) throws PDUStitchingException { double minValue = Double.POSITIVE_INFINITY; for (Node fromParent : fromParents) { final double value = Double.parseDouble(fromParent.getTextContent()); minValue = Math.min(minValue, value); } addTextToNode(toParent, "" + minValue, toDocument); }  }
MinMerger extends AbstractElementMerger { @Override public void mergeNodes(List<Node> fromParents, Element toParent, Document toDocument) throws PDUStitchingException { double minValue = Double.POSITIVE_INFINITY; for (Node fromParent : fromParents) { final double value = Double.parseDouble(fromParent.getTextContent()); minValue = Math.min(minValue, value); } addTextToNode(toParent, "" + minValue, toDocument); }  @Override void mergeNodes(List<Node> fromParents, Element toParent, Document toDocument); }
MinMerger extends AbstractElementMerger { @Override public void mergeNodes(List<Node> fromParents, Element toParent, Document toDocument) throws PDUStitchingException { double minValue = Double.POSITIVE_INFINITY; for (Node fromParent : fromParents) { final double value = Double.parseDouble(fromParent.getTextContent()); minValue = Math.min(minValue, value); } addTextToNode(toParent, "" + minValue, toDocument); }  @Override void mergeNodes(List<Node> fromParents, Element toParent, Document toDocument);  }