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;
16 import org.opendaylight.yangtools.yang.common.QName;
17 import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
18 import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
19 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
20 import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
21 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
22 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
23 import org.opendaylight.yangtools.yang.parser.builder.util.AbstractDocumentedDataNodeContainer;
25 final class ContainerSchemaNodeImpl extends AbstractDocumentedDataNodeContainer implements
26 ContainerSchemaNode, DerivableSchemaNode {
27 private final QName qname;
28 private final SchemaPath path;
32 boolean configuration;
33 ContainerSchemaNode original;
34 ConstraintDefinition constraints;
36 ImmutableSet<AugmentationSchema> augmentations;
37 ImmutableList<UnknownSchemaNode> unknownNodes;
41 public ContainerSchemaNodeImpl(final ContainerSchemaNodeBuilder builder) {
43 this.qname = builder.getQName();
44 this.path = builder.getPath();
48 public QName getQName() {
53 public SchemaPath getPath() {
58 public boolean isAugmenting() {
63 public boolean isAddedByUses() {
68 public Optional<ContainerSchemaNode> getOriginal() {
69 return Optional.fromNullable(original);
73 public boolean isConfiguration() {
78 public ConstraintDefinition getConstraints() {
83 public Set<AugmentationSchema> getAvailableAugmentations() {
88 public boolean isPresenceContainer() {
93 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
98 public int hashCode() {
101 result = prime * result + ((qname == null) ? 0 : qname.hashCode());
102 result = prime * result + ((path == null) ? 0 : path.hashCode());
107 public boolean equals(final Object obj) {
114 if (getClass() != obj.getClass()) {
117 ContainerSchemaNodeImpl other = (ContainerSchemaNodeImpl) obj;
119 if (other.qname != null) {
122 } else if (!qname.equals(other.qname)) {
126 if (other.path != null) {
129 } else if (!path.equals(other.path)) {
136 public String toString() {
137 return "container " + qname.getLocalName();