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.ChoiceCaseNode;
20 import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
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 ChoiceCaseNodeImpl extends AbstractDocumentedDataNodeContainer implements ChoiceCaseNode, DerivableSchemaNode {
27 private final QName qname;
28 private final SchemaPath path;
31 ChoiceCaseNode original;
32 ConstraintDefinition constraints;
33 ImmutableSet<AugmentationSchema> augmentations;
34 ImmutableList<UnknownSchemaNode> unknownNodes;
36 ChoiceCaseNodeImpl(final QName qname, final SchemaPath path,final ChoiceCaseBuilder builder) {
43 public QName getQName() {
48 public SchemaPath getPath() {
53 public boolean isConfiguration() {
58 public ConstraintDefinition getConstraints() {
63 public boolean isAugmenting() {
68 public boolean isAddedByUses() {
73 public Optional<ChoiceCaseNode> getOriginal() {
74 return Optional.fromNullable(original);
78 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
83 public Set<AugmentationSchema> getAvailableAugmentations() {
88 public int hashCode() {
91 result = prime * result + Objects.hashCode(qname);
92 result = prime * result + Objects.hashCode(path);
97 public boolean equals(final Object obj) {
104 if (getClass() != obj.getClass()) {
107 ChoiceCaseNodeImpl other = (ChoiceCaseNodeImpl) obj;
109 if (other.qname != null) {
112 } else if (!qname.equals(other.qname)) {
116 if (other.path != null) {
119 } else if (!path.equals(other.path)) {
126 public String toString() {
127 StringBuilder sb = new StringBuilder(ChoiceCaseNodeImpl.class.getSimpleName());
132 return sb.toString();