Increased version of binding-generator to 0.5.5-SNAPSHOT.
[controller.git] / opendaylight / sal / yang-prototype / yang / yang-model-util / src / main / java / org / opendaylight / controller / yang / model / util / DataNodeIterator.java
diff --git a/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/DataNodeIterator.java b/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/DataNodeIterator.java
deleted file mode 100644 (file)
index d55f849..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.yang.model.util;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.opendaylight.controller.yang.model.api.*;
-
-public class DataNodeIterator implements Iterator<DataSchemaNode> {
-
-    private final DataNodeContainer container;
-    private final List<ListSchemaNode> allLists;
-    private final List<ContainerSchemaNode> allContainers;
-    private final List<ChoiceNode> allChoices;
-    private final List<DataSchemaNode> allChilds;
-
-    public DataNodeIterator(final DataNodeContainer container) {
-        if (container == null) {
-            throw new IllegalArgumentException("Data Node Container MUST be specified and cannot be NULL!");
-        }
-
-        this.allContainers = new ArrayList<>();
-        this.allLists = new ArrayList<>();
-        this.allChilds = new ArrayList<>();
-        this.allChoices = new ArrayList<>();
-
-        this.container = container;
-        traverse(this.container);
-    }
-
-    public List<ContainerSchemaNode> allContainers() {
-        return allContainers;
-    }
-
-    public List<ListSchemaNode> allLists() {
-        return allLists;
-    }
-
-    public List<ChoiceNode> allChoices() {
-        return allChoices;
-    }
-
-    private void traverse(final DataNodeContainer dataNode) {
-        if (dataNode == null) {
-            return;
-        }
-
-        final Set<DataSchemaNode> childNodes = dataNode.getChildNodes();
-        if (childNodes != null) {
-            for (DataSchemaNode childNode : childNodes) {
-                if (childNode.isAugmenting()) {
-                    continue;
-                }
-                allChilds.add(childNode);
-                if (childNode instanceof ContainerSchemaNode) {
-                    final ContainerSchemaNode container = (ContainerSchemaNode) childNode;
-                    allContainers.add(container);
-                    traverse(container);
-                } else if (childNode instanceof ListSchemaNode) {
-                    final ListSchemaNode list = (ListSchemaNode) childNode;
-                    allLists.add(list);
-                    traverse(list);
-                } else if (childNode instanceof ChoiceNode) {
-                    final ChoiceNode choiceNode = (ChoiceNode) childNode;
-                    allChoices.add(choiceNode);
-                    final Set<ChoiceCaseNode> cases = choiceNode.getCases();
-                    if (cases != null) {
-                        for (final ChoiceCaseNode caseNode : cases) {
-                            traverse(caseNode);
-                        }
-                    }
-                }
-            }
-        }
-
-        final Set<GroupingDefinition> groupings = dataNode.getGroupings();
-        if (groupings != null) {
-            for (GroupingDefinition grouping : groupings) {
-                traverse(grouping);
-            }
-        }
-    }
-
-    @Override
-    public boolean hasNext() {
-        if (container.getChildNodes() != null) {
-            final Set<DataSchemaNode> childNodes = container.getChildNodes();
-
-            if ((childNodes != null) && !childNodes.isEmpty()) {
-                return childNodes.iterator().hasNext();
-            }
-        }
-        return false;
-    }
-
-    @Override
-    public DataSchemaNode next() {
-        return allChilds.iterator().next();
-    }
-
-    @Override
-    public void remove() {
-        throw new UnsupportedOperationException();
-    }
-}