Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E12529201 for ; Sat, 26 Nov 2011 16:29:23 +0000 (UTC) Received: (qmail 54754 invoked by uid 500); 26 Nov 2011 16:29:23 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 54693 invoked by uid 500); 26 Nov 2011 16:29:23 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 54686 invoked by uid 99); 26 Nov 2011 16:29:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Nov 2011 16:29:23 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Nov 2011 16:29:20 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 99E9823889D7 for ; Sat, 26 Nov 2011 16:28:59 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1206480 - /commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/tree/MergeCombiner.java Date: Sat, 26 Nov 2011 16:28:59 -0000 To: commits@commons.apache.org From: oheger@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111126162859.99E9823889D7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: oheger Date: Sat Nov 26 16:28:58 2011 New Revision: 1206480 URL: http://svn.apache.org/viewvc?rev=1206480&view=rev Log: Java 1.5 compatibility: Javadocs, raw types, for loops, etc. Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/tree/MergeCombiner.java Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/tree/MergeCombiner.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/tree/MergeCombiner.java?rev=1206480&r1=1206479&r2=1206480&view=diff ============================================================================== --- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/tree/MergeCombiner.java (original) +++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/tree/MergeCombiner.java Sat Nov 26 16:28:58 2011 @@ -16,14 +16,14 @@ */ package org.apache.commons.configuration.tree; +import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; import java.util.List; -import java.util.ArrayList; /** *

- * A specialized implementation of the NodeCombiner interface + * A specialized implementation of the {@code NodeCombiner} interface * that performs a merge from two passed in node hierarchies. *

*

@@ -52,6 +52,7 @@ public class MergeCombiner extends NodeC * @return the union node */ + @Override public ConfigurationNode combine(ConfigurationNode node1, ConfigurationNode node2) { ViewNode result = createViewNode(); @@ -60,10 +61,9 @@ public class MergeCombiner extends NodeC addAttributes(result, node1, node2); // Check if nodes can be combined - List children2 = new LinkedList(node2.getChildren()); - for (Iterator it = node1.getChildren().iterator(); it.hasNext();) + List children2 = new LinkedList(node2.getChildren()); + for (ConfigurationNode child1 : node1.getChildren()) { - ConfigurationNode child1 = (ConfigurationNode) it.next(); ConfigurationNode child2 = canCombine(node1, node2, child1, children2); if (child2 != null) { @@ -77,9 +77,9 @@ public class MergeCombiner extends NodeC } // Add remaining children of node 2 - for (Iterator it = children2.iterator(); it.hasNext();) + for (ConfigurationNode c : children2) { - result.addChild((ConfigurationNode) it.next()); + result.addChild(c); } return result; } @@ -98,9 +98,8 @@ public class MergeCombiner extends NodeC ConfigurationNode node2) { result.appendAttributes(node1); - for (Iterator it = node2.getAttributes().iterator(); it.hasNext();) + for (ConfigurationNode attr : node2.getAttributes()) { - ConfigurationNode attr = (ConfigurationNode) it.next(); if (node1.getAttributeCount(attr.getName()) == 0) { result.addAttribute(attr); @@ -119,23 +118,23 @@ public class MergeCombiner extends NodeC * @return a child of the second node, with which a combination is possible */ protected ConfigurationNode canCombine(ConfigurationNode node1, - ConfigurationNode node2, ConfigurationNode child, List children2) + ConfigurationNode node2, ConfigurationNode child, List children2) { - List attrs1 = child.getAttributes(); - List nodes = new ArrayList(); + List attrs1 = child.getAttributes(); + List nodes = new ArrayList(); - List children = node2.getChildren(child.getName()); - Iterator it = children.iterator(); + List children = node2.getChildren(child.getName()); + Iterator it = children.iterator(); while (it.hasNext()) { - ConfigurationNode node = (ConfigurationNode) it.next(); - Iterator iter = attrs1.iterator(); + ConfigurationNode node = it.next(); + Iterator iter = attrs1.iterator(); while (iter.hasNext()) { - ConfigurationNode attr1 = (ConfigurationNode) iter.next(); - List list2 = node.getAttributes(attr1.getName()); + ConfigurationNode attr1 = iter.next(); + List list2 = node.getAttributes(attr1.getName()); if (list2.size() == 1 - && !attr1.getValue().equals(((ConfigurationNode) list2.get(0)).getValue())) + && !attr1.getValue().equals(list2.get(0).getValue())) { node = null; break; @@ -153,7 +152,7 @@ public class MergeCombiner extends NodeC } if (nodes.size() > 1 && !isListNode(child)) { - Iterator iter = nodes.iterator(); + Iterator iter = nodes.iterator(); while (iter.hasNext()) { children2.remove(iter.next());