--- /dev/null
+package org.opendaylight.yangtools.yang.data.api.schema;
+
+public interface OrderedLeafSetNode<T> extends LeafSetNode<T>, OrderedNodeContainer<LeafSetEntryNode<T>> {
+
+
+
+
+}
--- /dev/null
+package org.opendaylight.yangtools.yang.data.api.schema;
+
+public interface OrderedMapNode extends MapNode, OrderedNodeContainer<MapEntryNode> {
+
+}
--- /dev/null
+package org.opendaylight.yangtools.yang.data.api.schema;
+
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
+
+public interface OrderedNodeContainer<V extends NormalizedNode<?, ?>> extends MixinNode, NormalizedNode<NodeIdentifier, Iterable<V>> {
+
+ V getChild(int position);
+
+ int getSize();
+
+}
--- /dev/null
+package org.opendaylight.yangtools.yang.data.api.schema;
+
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
+
+public interface UnkeyedListEntryNode extends DataContainerNode<NodeIdentifier> {
+
+}
--- /dev/null
+package org.opendaylight.yangtools.yang.data.api.schema;
+
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
+
+
+public interface UnkeyedListNode extends
+ DataContainerChild<NodeIdentifier, Iterable<UnkeyedListEntryNode>>,
+ OrderedNodeContainer<UnkeyedListEntryNode> {
+
+}
import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
+import org.opendaylight.yangtools.yang.data.api.schema.OrderedMapNode;
+import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListNode;
import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder;
import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder;
import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapEntryNodeSchemaAwareBuilder;
import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapNodeBuilder;
import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapNodeSchemaAwareBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableOrderedLeafSetNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableOrderedMapNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableUnkeyedListEntryNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableUnkeyedListNodeBuilder;
import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
return ImmutableLeafSetNodeBuilder.create();
}
+ public static <T> ListNodeBuilder<T,LeafSetEntryNode<T>> orderedLeafSetBuilder() {
+ return ImmutableOrderedLeafSetNodeBuilder.create();
+ }
+
public static <T> ListNodeBuilder<T,LeafSetEntryNode<T>> leafSetBuilder(final LeafSetNode<T> node) {
return ImmutableLeafSetNodeBuilder.create(node);
}
return ImmutableMapNodeBuilder.create();
}
+ public static CollectionNodeBuilder<MapEntryNode, OrderedMapNode> orderedMapBuilder() {
+ return ImmutableOrderedMapNodeBuilder.create();
+ }
+
+ public static CollectionNodeBuilder<UnkeyedListEntryNode, UnkeyedListNode> unkeyedListBuilder() {
+ return ImmutableUnkeyedListNodeBuilder.create();
+ }
+
public static CollectionNodeBuilder<MapEntryNode, MapNode> mapBuilder(final MapNode node) {
return ImmutableMapNodeBuilder.create(node);
}
return ImmutableChoiceNodeSchemaAwareBuilder.create(schema);
}
+ public static DataContainerNodeAttrBuilder<InstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode> unkeyedListEntryBuilder() {
+ return ImmutableUnkeyedListEntryNodeBuilder.create();
+ }
+
}
--- /dev/null
+/*
+ * 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.yangtools.yang.data.impl.schema.builder.impl;
+
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.opendaylight.yangtools.concepts.Immutable;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
+import org.opendaylight.yangtools.yang.data.api.schema.OrderedLeafSetNode;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.ListNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.NormalizedNodeContainerBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.nodes.AbstractImmutableNormalizedNode;
+
+import com.google.common.base.Optional;
+import com.google.common.collect.Iterables;
+
+public class ImmutableOrderedLeafSetNodeBuilder<T> implements ListNodeBuilder<T, LeafSetEntryNode<T>> {
+
+ private Map<InstanceIdentifier.NodeWithValue, LeafSetEntryNode<T>> value;
+ private InstanceIdentifier.NodeIdentifier nodeIdentifier;
+ private boolean dirty;
+
+ protected ImmutableOrderedLeafSetNodeBuilder() {
+ value = new LinkedHashMap<>();
+ dirty = false;
+ }
+
+ protected ImmutableOrderedLeafSetNodeBuilder(final ImmutableOrderedLeafSetNode<T> node) {
+ value = node.getChildren();
+ nodeIdentifier = node.getIdentifier();
+ dirty = true;
+ }
+
+ public static <T> ListNodeBuilder<T, LeafSetEntryNode<T>> create() {
+ return new ImmutableOrderedLeafSetNodeBuilder<>();
+ }
+
+ public static <T> ListNodeBuilder<T, LeafSetEntryNode<T>> create(final LeafSetNode<T> node) {
+ if (!(node instanceof ImmutableOrderedLeafSetNode<?>)) {
+ throw new UnsupportedOperationException(String.format("Cannot initialize from class %s", node.getClass()));
+ }
+
+ return new ImmutableOrderedLeafSetNodeBuilder<T>((ImmutableOrderedLeafSetNode<T>) node);
+ }
+
+ private void checkDirty() {
+ if (dirty) {
+ value = new LinkedHashMap<>(value);
+ dirty = false;
+ }
+ }
+
+ @Override
+ public ListNodeBuilder<T, LeafSetEntryNode<T>> withChild(final LeafSetEntryNode<T> child) {
+ checkDirty();
+ this.value.put(child.getIdentifier(), child);
+ return this;
+ }
+
+ @Override
+ public ListNodeBuilder<T, LeafSetEntryNode<T>> withoutChild(final PathArgument key) {
+ checkDirty();
+ this.value.remove(key);
+ return this;
+ }
+
+ @Override
+ public OrderedLeafSetNode<T> build() {
+ dirty = true;
+ return new ImmutableOrderedLeafSetNode<>(nodeIdentifier, value);
+ }
+
+ @Override
+ public ListNodeBuilder<T, LeafSetEntryNode<T>> withNodeIdentifier(
+ final InstanceIdentifier.NodeIdentifier nodeIdentifier) {
+ this.nodeIdentifier = nodeIdentifier;
+ return this;
+ }
+
+ @Override
+ public ListNodeBuilder<T, LeafSetEntryNode<T>> withValue(final List<LeafSetEntryNode<T>> value) {
+ checkDirty();
+ for (final LeafSetEntryNode<T> leafSetEntry : value) {
+ withChild(leafSetEntry);
+ }
+ return this;
+ }
+
+
+ @Override
+ public ListNodeBuilder<T, LeafSetEntryNode<T>> withChildValue(final T value, final Map<QName, String> attributes) {
+ final ImmutableLeafSetEntryNodeBuilder<T> b = ImmutableLeafSetEntryNodeBuilder.create();
+ b.withNodeIdentifier(new InstanceIdentifier.NodeWithValue(nodeIdentifier.getNodeType(), value));
+ b.withValue(value);
+ b.withAttributes(attributes);
+ return withChild(b.build());
+ }
+
+ @Override
+ public ListNodeBuilder<T, LeafSetEntryNode<T>> withChildValue(final T value) {
+ return withChildValue(value, Collections.<QName,String>emptyMap());
+ }
+
+ protected final static class ImmutableOrderedLeafSetNode<T> extends
+ AbstractImmutableNormalizedNode<InstanceIdentifier.NodeIdentifier, Iterable<LeafSetEntryNode<T>>> implements
+ Immutable, OrderedLeafSetNode<T> {
+
+ private final Map<InstanceIdentifier.NodeWithValue, LeafSetEntryNode<T>> children;
+
+ ImmutableOrderedLeafSetNode(final InstanceIdentifier.NodeIdentifier nodeIdentifier,
+ final Map<InstanceIdentifier.NodeWithValue, LeafSetEntryNode<T>> children) {
+ super(nodeIdentifier, Iterables.unmodifiableIterable(children.values()));
+ this.children = children;
+ }
+
+ @Override
+ public Optional<LeafSetEntryNode<T>> getChild(final InstanceIdentifier.NodeWithValue child) {
+ return Optional.fromNullable(children.get(child));
+ }
+
+ @Override
+ protected int valueHashCode() {
+ return children.hashCode();
+ }
+
+ private Map<InstanceIdentifier.NodeWithValue, LeafSetEntryNode<T>> getChildren() {
+ return Collections.unmodifiableMap(children);
+ }
+
+ @Override
+ protected boolean valueEquals(final AbstractImmutableNormalizedNode<?, ?> other) {
+ return children.equals(((ImmutableOrderedLeafSetNode<?>) other).children);
+ }
+
+ @Override
+ public LeafSetEntryNode<T> getChild(final int position) {
+ return Iterables.get(getValue(), position);
+ }
+
+ @Override
+ public int getSize() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+ }
+
+ @Override
+ public NormalizedNodeContainerBuilder<NodeIdentifier, PathArgument, LeafSetEntryNode<T>, LeafSetNode<T>> addChild(
+ final LeafSetEntryNode<T> child) {
+ return withChild(child);
+ }
+
+ @Override
+ public NormalizedNodeContainerBuilder<NodeIdentifier, PathArgument, LeafSetEntryNode<T>, LeafSetNode<T>> removeChild(
+ final PathArgument key) {
+ return withoutChild(key);
+ }
+
+}
--- /dev/null
+/*
+ * 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.yangtools.yang.data.impl.schema.builder.impl;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.opendaylight.yangtools.concepts.Immutable;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.OrderedMapNode;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.NormalizedNodeContainerBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.nodes.AbstractImmutableNormalizedNode;
+
+import com.google.common.base.Optional;
+import com.google.common.collect.Iterables;
+
+public class ImmutableOrderedMapNodeBuilder
+ implements CollectionNodeBuilder<MapEntryNode, OrderedMapNode> {
+
+ private Map<InstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> value;
+ private InstanceIdentifier.NodeIdentifier nodeIdentifier;
+ private boolean dirty = false;
+
+ protected ImmutableOrderedMapNodeBuilder() {
+ this.value = new LinkedHashMap<>();
+ this.dirty = false;
+ }
+
+ protected ImmutableOrderedMapNodeBuilder(final ImmutableOrderedMapNode node) {
+ this.value = node.children;
+ this.dirty = true;
+ }
+
+ public static CollectionNodeBuilder<MapEntryNode, OrderedMapNode> create() {
+ return new ImmutableOrderedMapNodeBuilder();
+ }
+
+ public static CollectionNodeBuilder<MapEntryNode, OrderedMapNode> create(final OrderedMapNode node) {
+ if (!(node instanceof ImmutableOrderedMapNode)) {
+ throw new UnsupportedOperationException(String.format("Cannot initialize from class %s", node.getClass()));
+ }
+
+ return new ImmutableOrderedMapNodeBuilder((ImmutableOrderedMapNode) node);
+ }
+
+ private void checkDirty() {
+ if (dirty) {
+ value = new LinkedHashMap<>(value);
+ dirty = false;
+ }
+ }
+
+ @Override
+ public CollectionNodeBuilder<MapEntryNode, OrderedMapNode> withChild(final MapEntryNode child) {
+ checkDirty();
+ this.value.put(child.getIdentifier(), child);
+ return this;
+ }
+
+ @Override
+ public CollectionNodeBuilder<MapEntryNode, OrderedMapNode> withoutChild(final InstanceIdentifier.PathArgument key) {
+ checkDirty();
+ this.value.remove(key);
+ return this;
+ }
+
+ @Override
+ public CollectionNodeBuilder<MapEntryNode, OrderedMapNode> withValue(final List<MapEntryNode> value) {
+ // TODO replace or putAll ?
+ for (final MapEntryNode mapEntryNode : value) {
+ withChild(mapEntryNode);
+ }
+
+ return this;
+ }
+
+ @Override
+ public CollectionNodeBuilder<MapEntryNode, OrderedMapNode> withNodeIdentifier(final InstanceIdentifier.NodeIdentifier nodeIdentifier) {
+ this.nodeIdentifier = nodeIdentifier;
+ return this;
+ }
+
+ @Override
+ public OrderedMapNode build() {
+ dirty = true;
+ return new ImmutableOrderedMapNode(nodeIdentifier, value);
+ }
+
+ @Override
+ public CollectionNodeBuilder<MapEntryNode, OrderedMapNode> addChild(
+ final MapEntryNode child) {
+ return withChild(child);
+ }
+
+
+ @Override
+ public NormalizedNodeContainerBuilder<NodeIdentifier, PathArgument, MapEntryNode, OrderedMapNode> removeChild(
+ final PathArgument key) {
+ return withoutChild(key);
+ }
+
+ protected static final class ImmutableOrderedMapNode extends AbstractImmutableNormalizedNode<InstanceIdentifier.NodeIdentifier, Iterable<MapEntryNode>> implements Immutable,OrderedMapNode {
+
+ private final Map<InstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> children;
+
+ ImmutableOrderedMapNode(final InstanceIdentifier.NodeIdentifier nodeIdentifier,
+ final Map<InstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> children) {
+ super(nodeIdentifier, Iterables.unmodifiableIterable(children.values()));
+ this.children = children;
+ }
+
+ @Override
+ public Optional<MapEntryNode> getChild(final InstanceIdentifier.NodeIdentifierWithPredicates child) {
+ return Optional.fromNullable(children.get(child));
+ }
+
+ @Override
+ protected int valueHashCode() {
+ return children.hashCode();
+ }
+
+ @Override
+ protected boolean valueEquals(final AbstractImmutableNormalizedNode<?, ?> other) {
+ return children.equals(((ImmutableOrderedMapNode) other).children);
+ }
+
+ @Override
+ public MapEntryNode getChild(final int position) {
+ return Iterables.get(getValue(), position);
+ }
+
+ @Override
+ public int getSize() {
+ return children.size();
+ }
+ }
+}
--- /dev/null
+/*
+ * 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.yangtools.yang.data.impl.schema.builder.impl;
+
+import java.util.Map;
+
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
+import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.nodes.AbstractImmutableDataContainerAttrNode;
+
+public class ImmutableUnkeyedListEntryNodeBuilder extends
+ AbstractImmutableDataContainerNodeAttrBuilder<InstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode> {
+
+ protected ImmutableUnkeyedListEntryNodeBuilder() {
+ super();
+ }
+
+ protected ImmutableUnkeyedListEntryNodeBuilder(final ImmutableUnkeyedListEntryNode node) {
+ super(node);
+ }
+
+ public static DataContainerNodeAttrBuilder<InstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode> create() {
+ return new ImmutableUnkeyedListEntryNodeBuilder();
+ }
+
+ public static DataContainerNodeAttrBuilder<InstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode> create(final UnkeyedListEntryNode node) {
+ if (!(node instanceof ImmutableUnkeyedListEntryNode)) {
+ throw new UnsupportedOperationException(String.format("Cannot initialize from class %s", node.getClass()));
+ }
+ return new ImmutableUnkeyedListEntryNodeBuilder((ImmutableUnkeyedListEntryNode) node);
+ }
+
+ @Override
+ public UnkeyedListEntryNode build() {
+ return new ImmutableUnkeyedListEntryNode(getNodeIdentifier(), buildValue(), getAttributes());
+ }
+
+ protected static final class ImmutableUnkeyedListEntryNode extends
+ AbstractImmutableDataContainerAttrNode<InstanceIdentifier.NodeIdentifier> implements UnkeyedListEntryNode {
+
+ ImmutableUnkeyedListEntryNode(
+ final InstanceIdentifier.NodeIdentifier nodeIdentifier,
+ final Map<InstanceIdentifier.PathArgument, DataContainerChild<? extends InstanceIdentifier.PathArgument, ?>> children,
+ final Map<QName, String> attributes) {
+ super(children, nodeIdentifier, attributes);
+ }
+ }
+}
--- /dev/null
+/*
+ * 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.yangtools.yang.data.impl.schema.builder.impl;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.opendaylight.yangtools.concepts.Immutable;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListNode;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.NormalizedNodeContainerBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.nodes.AbstractImmutableNormalizedNode;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
+
+public class ImmutableUnkeyedListNodeBuilder implements CollectionNodeBuilder<UnkeyedListEntryNode, UnkeyedListNode> {
+
+ private List<UnkeyedListEntryNode> value;
+ private InstanceIdentifier.NodeIdentifier nodeIdentifier;
+ private boolean dirty = false;
+
+ protected ImmutableUnkeyedListNodeBuilder() {
+ this.value = new LinkedList<>();
+ this.dirty = false;
+ }
+
+ protected ImmutableUnkeyedListNodeBuilder(final ImmutableUnkeyedListNode node) {
+ this.value = new LinkedList<>();
+ Iterables.addAll(value, node.getValue());
+ this.dirty = true;
+ }
+
+ public static CollectionNodeBuilder<UnkeyedListEntryNode, UnkeyedListNode> create() {
+ return new ImmutableUnkeyedListNodeBuilder();
+ }
+
+ public static CollectionNodeBuilder<UnkeyedListEntryNode, UnkeyedListNode> create(final UnkeyedListNode node) {
+ if (!(node instanceof ImmutableUnkeyedListNode)) {
+ throw new UnsupportedOperationException(String.format("Cannot initialize from class %s", node.getClass()));
+ }
+
+ return new ImmutableUnkeyedListNodeBuilder((ImmutableUnkeyedListNode) node);
+ }
+
+ private void checkDirty() {
+ if (dirty) {
+ value = new LinkedList<>(value);
+ dirty = false;
+ }
+ }
+
+ @Override
+ public CollectionNodeBuilder<UnkeyedListEntryNode, UnkeyedListNode> withChild(final UnkeyedListEntryNode child) {
+ checkDirty();
+ this.value.add(child);
+ return this;
+ }
+
+ @Override
+ public CollectionNodeBuilder<UnkeyedListEntryNode, UnkeyedListNode> withoutChild(
+ final InstanceIdentifier.PathArgument key) {
+ checkDirty();
+ throw new UnsupportedOperationException("Children does not have identifiers.");
+ }
+
+ @Override
+ public CollectionNodeBuilder<UnkeyedListEntryNode, UnkeyedListNode> withValue(final List<UnkeyedListEntryNode> value) {
+ // TODO replace or putAll ?
+ for (final UnkeyedListEntryNode UnkeyedListEntryNode : value) {
+ withChild(UnkeyedListEntryNode);
+ }
+
+ return this;
+ }
+
+ @Override
+ public CollectionNodeBuilder<UnkeyedListEntryNode, UnkeyedListNode> withNodeIdentifier(
+ final InstanceIdentifier.NodeIdentifier nodeIdentifier) {
+ this.nodeIdentifier = nodeIdentifier;
+ return this;
+ }
+
+ @Override
+ public UnkeyedListNode build() {
+ dirty = true;
+ return new ImmutableUnkeyedListNode(nodeIdentifier, ImmutableList.copyOf(value));
+ }
+
+ @Override
+ public CollectionNodeBuilder<UnkeyedListEntryNode, UnkeyedListNode> addChild(final UnkeyedListEntryNode child) {
+ return withChild(child);
+ }
+
+ @Override
+ public NormalizedNodeContainerBuilder<NodeIdentifier, PathArgument, UnkeyedListEntryNode, UnkeyedListNode> removeChild(
+ final PathArgument key) {
+ return withoutChild(key);
+ }
+
+ protected static final class ImmutableUnkeyedListNode extends
+ AbstractImmutableNormalizedNode<InstanceIdentifier.NodeIdentifier, Iterable<UnkeyedListEntryNode>>
+ implements Immutable, UnkeyedListNode {
+
+ private final ImmutableList<UnkeyedListEntryNode> children;
+
+ ImmutableUnkeyedListNode(final InstanceIdentifier.NodeIdentifier nodeIdentifier,
+ final ImmutableList<UnkeyedListEntryNode> children) {
+ super(nodeIdentifier, children);
+ this.children = children;
+ }
+
+ @Override
+ protected int valueHashCode() {
+ return children.hashCode();
+ }
+
+ @Override
+ protected boolean valueEquals(final AbstractImmutableNormalizedNode<?, ?> other) {
+ return children.equals(((ImmutableUnkeyedListNode) other).children);
+ }
+
+ @Override
+ public UnkeyedListEntryNode getChild(final int position) {
+ return children.get(position);
+ }
+
+ @Override
+ public int getSize() {
+ return children.size();
+ }
+ }
+}