class DurationMerger extends AbstractElementMerger {

    @Override
    public void mergeNodes(List<Node> fromParents, Element toParent, Document toDocument) throws PDUStitchingException {
        int duration = 0;
        for (Node node : fromParents) {
            try {
                duration += Integer.parseInt(node.getTextContent());
            } catch (NumberFormatException nfe) {
                throw new PDUStitchingException("Could not parse duration: " + nfe.getMessage());
            }
        }
        addTextToNode(toParent, String.valueOf(duration), toDocument);
    }

}