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
8 package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.bit;
10 import org.opendaylight.yangtools.yang.common.QName;
11 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
12 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
13 import org.opendaylight.yangtools.yang.model.api.stmt.BitEffectiveStatement;
14 import org.opendaylight.yangtools.yang.model.api.stmt.BitStatement;
15 import org.opendaylight.yangtools.yang.model.api.stmt.PositionEffectiveStatement;
16 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractEffectiveDocumentedNode;
17 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
19 // FIXME: 5.0.0: hide this class
20 public final class BitEffectiveStatementImpl extends AbstractEffectiveDocumentedNode<QName, BitStatement>
21 implements BitEffectiveStatement {
23 private final QName qname;
24 private final SchemaPath schemaPath;
25 private final Long declaredPosition;
27 BitEffectiveStatementImpl(final StmtContext<QName, BitStatement, ?> ctx) {
30 qname = ctx.getStatementArgument();
31 schemaPath = ctx.getSchemaPath().get();
33 Long declaredPositionInit = null;
34 for (final EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements()) {
35 if (effectiveStatement instanceof PositionEffectiveStatement) {
36 declaredPositionInit = ((PositionEffectiveStatement) effectiveStatement).argument();
40 declaredPosition = declaredPositionInit;
43 public Long getDeclaredPosition() {
44 return declaredPosition;
47 public String getName() {
48 return qname.getLocalName();
51 public QName getQName() {
55 public SchemaPath getPath() {
60 public String toString() {
61 return BitEffectiveStatementImpl.class.getSimpleName() + "[name=" + qname.getLocalName() + ", position="
62 + declaredPosition + "]";