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.common.Uint32;
12 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
13 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
14 import org.opendaylight.yangtools.yang.model.api.stmt.BitEffectiveStatement;
15 import org.opendaylight.yangtools.yang.model.api.stmt.BitStatement;
16 import org.opendaylight.yangtools.yang.model.api.stmt.PositionEffectiveStatement;
17 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractEffectiveDocumentedNode;
18 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
20 // FIXME: 5.0.0: hide this class
21 public final class BitEffectiveStatementImpl extends AbstractEffectiveDocumentedNode<QName, BitStatement>
22 implements BitEffectiveStatement {
24 private final QName qname;
25 private final SchemaPath schemaPath;
26 private final Uint32 declaredPosition;
28 BitEffectiveStatementImpl(final StmtContext<QName, BitStatement, ?> ctx) {
31 qname = ctx.getStatementArgument();
32 schemaPath = ctx.getSchemaPath().get();
34 Uint32 declaredPositionInit = null;
35 for (final EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements()) {
36 if (effectiveStatement instanceof PositionEffectiveStatement) {
37 declaredPositionInit = ((PositionEffectiveStatement) effectiveStatement).argument();
41 declaredPosition = declaredPositionInit;
44 public Uint32 getDeclaredPosition() {
45 return declaredPosition;
48 public String getName() {
49 return qname.getLocalName();
52 public QName getQName() {
56 public SchemaPath getPath() {
61 public String toString() {
62 return BitEffectiveStatementImpl.class.getSimpleName() + "[name=" + qname.getLocalName() + ", position="
63 + declaredPosition + "]";