2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.yangtools.yang.parser.builder.impl;
11 import com.google.common.base.Optional;
12 import com.google.common.collect.ImmutableList;
13 import com.google.common.collect.ImmutableSet;
14 import java.util.List;
15 import java.util.Objects;
17 import org.opendaylight.yangtools.yang.common.QName;
18 import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
19 import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
20 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
21 import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
22 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
23 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
24 import org.opendaylight.yangtools.yang.parser.builder.util.AbstractDocumentedDataNodeContainer;
26 final class ContainerSchemaNodeImpl extends AbstractDocumentedDataNodeContainer implements
27 ContainerSchemaNode, DerivableSchemaNode {
28 private final QName qname;
29 private final SchemaPath path;
33 boolean configuration;
34 ContainerSchemaNode original;
35 ConstraintDefinition constraints;
37 ImmutableSet<AugmentationSchema> augmentations;
38 ImmutableList<UnknownSchemaNode> unknownNodes;
42 public ContainerSchemaNodeImpl(final ContainerSchemaNodeBuilder builder) {
44 this.qname = builder.getQName();
45 this.path = builder.getPath();
49 public QName getQName() {
54 public SchemaPath getPath() {
59 public boolean isAugmenting() {
64 public boolean isAddedByUses() {
69 public Optional<ContainerSchemaNode> getOriginal() {
70 return Optional.fromNullable(original);
74 public boolean isConfiguration() {
79 public ConstraintDefinition getConstraints() {
84 public Set<AugmentationSchema> getAvailableAugmentations() {
89 public boolean isPresenceContainer() {
94 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
99 public int hashCode() {
100 final int prime = 31;
102 result = prime * result + Objects.hashCode(qname);
103 result = prime * result + Objects.hashCode(path);
108 public boolean equals(final Object obj) {
115 if (getClass() != obj.getClass()) {
118 ContainerSchemaNodeImpl other = (ContainerSchemaNodeImpl) obj;
120 if (other.qname != null) {
123 } else if (!qname.equals(other.qname)) {
127 if (other.path != null) {
130 } else if (!path.equals(other.path)) {
137 public String toString() {
138 return "container " + qname.getLocalName();