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 com.google.common.collect.ImmutableList;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.common.SchemaNodeIdentifier.Descendant;
15 import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
16 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
17 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
18 import org.opendaylight.yangtools.yang.model.api.stmt.UsesEffectiveStatement;
19 import org.opendaylight.yangtools.yang.model.api.stmt.UsesStatement;
22 * A full-blown instance of {@link UsesEffectiveStatement}. Used when the argument does not match the declared instance
23 * and we also have a refine substatement.
26 final class FullCopiedUsesEffectiveStatement extends SimpleCopiedUsesEffectiveStatement {
27 private volatile Map<Descendant, SchemaNode> refines;
29 FullCopiedUsesEffectiveStatement(final UsesStatement declared, final QName argument,
30 final GroupingDefinition sourceGrouping, final int flags,
31 final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
32 super(declared, argument, sourceGrouping, flags, substatements);
36 public Map<Descendant, SchemaNode> getRefines() {
37 final Map<Descendant, SchemaNode> local;
38 return (local = refines) != null ? local : loadRefines();
41 private synchronized @NonNull Map<Descendant, SchemaNode> loadRefines() {
42 Map<Descendant, SchemaNode> local = refines;
44 refines = local = UsesStatementSupport.indexRefines(effectiveSubstatements());