2 * Copyright (c) 2020 PANTHEON.tech, s.r.o. 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.uses;
10 import static java.util.Objects.requireNonNull;
12 import java.util.Collection;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.opendaylight.yangtools.yang.common.QName;
15 import org.opendaylight.yangtools.yang.model.api.AugmentationSchemaNode;
16 import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
17 import org.opendaylight.yangtools.yang.model.api.UsesNode;
18 import org.opendaylight.yangtools.yang.model.api.stmt.UsesEffectiveStatement;
19 import org.opendaylight.yangtools.yang.model.api.stmt.UsesStatement;
20 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
21 import org.opendaylight.yangtools.yang.model.spi.meta.EffectiveStatementMixins.CopyableMixin;
22 import org.opendaylight.yangtools.yang.model.spi.meta.EffectiveStatementMixins.DocumentedNodeMixin.WithStatus;
23 import org.opendaylight.yangtools.yang.model.spi.meta.EffectiveStatementMixins.WhenConditionMixin;
26 * Empty {@link UsesEffectiveStatement}, at its very simplest form. This is appropriate when all of these are true:
28 * <li>This statement takes effect in the same module as where it was declared, i.e. the arguments match</li>
29 * <li>It has no substatements</li>
33 * This provides minimum footprint, as we share the argument from the declared instance and just keep the flags and
34 * source grouping pointer.
36 class EmptyLocalUsesEffectiveStatement extends DefaultArgument<QName, UsesStatement>
37 implements UsesEffectiveStatement, UsesNode, CopyableMixin<QName, UsesStatement>,
38 WhenConditionMixin<QName, UsesStatement>, WithStatus<QName, UsesStatement> {
39 private final @NonNull GroupingDefinition sourceGrouping;
40 private final int flags;
42 EmptyLocalUsesEffectiveStatement(final UsesStatement declared, final GroupingDefinition sourceGrouping,
45 this.sourceGrouping = requireNonNull(sourceGrouping);
50 public final GroupingDefinition getSourceGrouping() {
51 return sourceGrouping;
55 public final int flags() {
60 public final UsesEffectiveStatement asEffectiveStatement() {
65 public final Collection<? extends AugmentationSchemaNode> getAugmentations() {
66 return filterEffectiveStatements(AugmentationSchemaNode.class);