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