当前位置: 首页>>代码示例>>Java>>正文


Java EffectiveStatement类代码示例

本文整理汇总了Java中org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement的典型用法代码示例。如果您正苦于以下问题:Java EffectiveStatement类的具体用法?Java EffectiveStatement怎么用?Java EffectiveStatement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EffectiveStatement类属于org.opendaylight.yangtools.yang.model.api.meta包,在下文中一共展示了EffectiveStatement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onStatementDefinitionDeclared

import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; //导入依赖的package包/类
@Override
public void onStatementDefinitionDeclared(
        final Mutable<QName, ExtensionStatement, EffectiveStatement<QName, ExtensionStatement>> stmt) {
    super.onStatementDefinitionDeclared(stmt);

    QName stmtName = stmt.getStatementArgument();
    if (OpenConfigStatements.OPENCONFIG_VERSION.getStatementName().isEqualWithoutRevision(stmtName)) {
        stmtName = stmtName.withoutRevision();
    }

    stmt.addContext(ExtensionNamespace.class, stmtName, stmt);

    final StmtContext<QName, ?, ?> argument = StmtContextUtils.findFirstDeclaredSubstatement(stmt,
        ArgumentStatement.class);
    final StmtContext<Boolean, ?, ?> yinElement = StmtContextUtils.findFirstDeclaredSubstatement(stmt,
        YinElementStatement.class);

    stmt.addToNs(StatementDefinitionNamespace.class, stmt.getStatementArgument(),
        new ModelDefinedStatementSupport(new ModelDefinedStatementDefinition(stmt.getStatementArgument(),
            argument != null ? argument.getStatementArgument() : null,
                    yinElement != null ? yinElement.getStatementArgument() : false)));
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:23,代码来源:ExtensionStatementSupport.java

示例2: BitEffectiveStatementImpl

import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; //导入依赖的package包/类
BitEffectiveStatementImpl(final StmtContext<QName, BitStatement, ?> ctx) {
    super(ctx);

    qname = ctx.getStatementArgument();
    schemaPath = ctx.getSchemaPath().get();

    final List<UnknownSchemaNode> unknownSchemaNodesInit = new ArrayList<>();
    Long declaredPositionInit = null;
    for (final EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements()) {
        if (effectiveStatement instanceof PositionEffectiveStatement) {
            declaredPositionInit = ((PositionEffectiveStatement) effectiveStatement).argument();
        }
        if (effectiveStatement instanceof UnknownSchemaNode) {
            unknownSchemaNodesInit.add((UnknownSchemaNode) effectiveStatement);
        }
    }

    declaredPosition = declaredPositionInit;
    unknownSchemaNodes = ImmutableList.copyOf(unknownSchemaNodesInit);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:21,代码来源:BitEffectiveStatementImpl.java

示例3: onLinkageDeclared

import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; //导入依赖的package包/类
@Override
public final void onLinkageDeclared(
        final Mutable<String, SubmoduleStatement, EffectiveStatement<String, SubmoduleStatement>> stmt) {
    final SourceIdentifier submoduleIdentifier = RevisionSourceIdentifier.create(stmt.getStatementArgument(),
        StmtContextUtils.getLatestRevision(stmt.declaredSubstatements()));

    final StmtContext<?, SubmoduleStatement, EffectiveStatement<String, SubmoduleStatement>>
        possibleDuplicateSubmodule = stmt.getFromNamespace(SubmoduleNamespace.class, submoduleIdentifier);
    if (possibleDuplicateSubmodule != null && possibleDuplicateSubmodule != stmt) {
        throw new SourceException(stmt.getStatementSourceReference(), "Submodule name collision: %s. At %s",
                stmt.getStatementArgument(), possibleDuplicateSubmodule.getStatementSourceReference());
    }

    stmt.addContext(SubmoduleNamespace.class, submoduleIdentifier, stmt);

    final String belongsToModuleName = firstAttributeOf(stmt.declaredSubstatements(), BelongsToStatement.class);
    final StmtContext<?, ?, ?> prefixSubStmtCtx = findFirstDeclaredSubstatement(stmt, 0,
            BelongsToStatement.class, PrefixStatement.class);
    SourceException.throwIfNull(prefixSubStmtCtx, stmt.getStatementSourceReference(),
            "Prefix of belongsTo statement is missing in submodule [%s]", stmt.getStatementArgument());

    final String prefix = (String) prefixSubStmtCtx.getStatementArgument();

    stmt.addToNs(BelongsToPrefixToModuleName.class, prefix, belongsToModuleName);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:26,代码来源:AbstractSubmoduleStatementSupport.java

示例4: transformEffective

import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; //导入依赖的package包/类
@SuppressWarnings("checkstyle:illegalCatch")
private EffectiveSchemaContext transformEffective() throws ReactorException {
    checkState(finishedPhase == ModelProcessingPhase.EFFECTIVE_MODEL);
    final List<DeclaredStatement<?>> rootStatements = new ArrayList<>(sources.size());
    final List<EffectiveStatement<?, ?>> rootEffectiveStatements = new ArrayList<>(sources.size());

    try {
        for (final SourceSpecificContext source : sources) {
            final RootStatementContext<?, ?, ?> root = source.getRoot();
            try {
                rootStatements.add(root.buildDeclared());
                rootEffectiveStatements.add(root.buildEffective());
            } catch (final RuntimeException ex) {
                throw propagateException(source, ex);
            }
        }
    } finally {
        RecursiveObjectLeaker.cleanup();
    }

    sealMutableStatements();
    return EffectiveSchemaContext.create(rootStatements, rootEffectiveStatements);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:24,代码来源:BuildGlobalContext.java

示例5: EnumEffectiveStatementImpl

import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; //导入依赖的package包/类
EnumEffectiveStatementImpl(final StmtContext<String, EnumStatement, ?> ctx) {
    super(ctx);

    name = ctx.rawStatementArgument();

    final List<UnknownSchemaNode> unknownSchemaNodesInit = new ArrayList<>();
    Integer declaredValueInit = null;
    for (final EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements()) {
        if (effectiveStatement instanceof ValueEffectiveStatement) {
            declaredValueInit = ((ValueEffectiveStatement) effectiveStatement).argument();
        }
        if (effectiveStatement instanceof UnknownSchemaNode) {
            unknownSchemaNodesInit.add((UnknownSchemaNode) effectiveStatement);
        }
    }

    declaredValue = declaredValueInit;
    unknownSchemaNodes = ImmutableList.copyOf(unknownSchemaNodesInit);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:20,代码来源:EnumEffectiveStatementImpl.java

示例6: DeviationEffectiveStatementImpl

import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; //导入依赖的package包/类
DeviationEffectiveStatementImpl(final StmtContext<SchemaNodeIdentifier, DeviationStatement, ?> ctx) {
    super(ctx);
    this.targetPath = ctx.getStatementArgument().asSchemaPath();

    this.deviateDefinitions = ImmutableList.copyOf(allSubstatementsOfType(DeviateDefinition.class));

    description = findFirstEffectiveSubstatementArgument(DescriptionEffectiveStatement.class).orElse(null);
    reference = findFirstEffectiveSubstatementArgument(ReferenceEffectiveStatement.class).orElse(null);

    List<UnknownSchemaNode> unknownSchemaNodesInit = new ArrayList<>();
    for (final EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements()) {
        if (effectiveStatement instanceof UnknownSchemaNode) {
            unknownSchemaNodesInit.add((UnknownSchemaNode) effectiveStatement);
        }
    }
    unknownSchemaNodes = ImmutableList.copyOf(unknownSchemaNodesInit);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:18,代码来源:DeviationEffectiveStatementImpl.java

示例7: onPreLinkageDeclared

import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; //导入依赖的package包/类
@Override
public final void onPreLinkageDeclared(final Mutable<String, ModuleStatement,
        EffectiveStatement<String, ModuleStatement>> stmt) {
    final String moduleName = stmt.getStatementArgument();

    final URI moduleNs = firstAttributeOf(stmt.declaredSubstatements(), NamespaceStatement.class);
    SourceException.throwIfNull(moduleNs, stmt.getStatementSourceReference(),
        "Namespace of the module [%s] is missing", stmt.getStatementArgument());
    stmt.addToNs(ModuleNameToNamespace.class, moduleName, moduleNs);

    final String modulePrefix = firstAttributeOf(stmt.declaredSubstatements(), PrefixStatement.class);
    SourceException.throwIfNull(modulePrefix, stmt.getStatementSourceReference(),
        "Prefix of the module [%s] is missing", stmt.getStatementArgument());
    stmt.addToNs(ImpPrefixToNamespace.class, modulePrefix, moduleNs);

    stmt.addContext(PreLinkageModuleNamespace.class, moduleName, stmt);

    final Optional<Revision> revisionDate = StmtContextUtils.getLatestRevision(stmt.declaredSubstatements());
    final QNameModule qNameModule = QNameModule.create(moduleNs, revisionDate.orElse(null)).intern();

    stmt.addToNs(ModuleCtxToModuleQName.class, stmt, qNameModule);
    stmt.setRootIdentifier(RevisionSourceIdentifier.create(stmt.getStatementArgument(), revisionDate));
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:24,代码来源:AbstractModuleStatementSupport.java

示例8: InstanceIdentifierTypeEffectiveStatementImpl

import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; //导入依赖的package包/类
InstanceIdentifierTypeEffectiveStatementImpl(
        final StmtContext<String, TypeStatement, EffectiveStatement<String, TypeStatement>> ctx,
        final InstanceIdentifierTypeDefinition baseType) {
    super(ctx);

    final InstanceIdentifierTypeBuilder builder =
            RestrictedTypes.newInstanceIdentifierBuilder(baseType,
                AbstractTypeStatementSupport.typeEffectiveSchemaPath(ctx));

    for (EffectiveStatement<?, ?> stmt : effectiveSubstatements()) {
        if (stmt instanceof RequireInstanceEffectiveStatement) {
            builder.setRequireInstance(((RequireInstanceEffectiveStatement)stmt).argument());
        }
        if (stmt instanceof UnknownSchemaNode) {
            builder.addUnknownSchemaNode((UnknownSchemaNode)stmt);
        }
    }

    typeDefinition = builder.build();
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:21,代码来源:InstanceIdentifierTypeEffectiveStatementImpl.java

示例9: isAnyDefaultValueMarkedWithIfFeature

import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; //导入依赖的package包/类
private static boolean isAnyDefaultValueMarkedWithIfFeature(final TypeEffectiveStatement<?> typeStmt,
        final Set<String> defaultValues) {
    final Iterator<? extends EffectiveStatement<?, ?>> iter = typeStmt.effectiveSubstatements().iterator();
    while (iter.hasNext() && !defaultValues.isEmpty()) {
        final EffectiveStatement<?, ?> effectiveSubstatement = iter.next();
        if (YangStmtMapping.BIT.equals(effectiveSubstatement.statementDefinition())) {
            final QName bitQName = (QName) effectiveSubstatement.argument();
            if (defaultValues.remove(bitQName.getLocalName()) && containsIfFeature(effectiveSubstatement)) {
                return true;
            }
        } else if (YangStmtMapping.ENUM.equals(effectiveSubstatement.statementDefinition())
                && defaultValues.remove(effectiveSubstatement.argument())
                && containsIfFeature(effectiveSubstatement)) {
            return true;
        } else if (effectiveSubstatement instanceof TypeEffectiveStatement && isAnyDefaultValueMarkedWithIfFeature(
                (TypeEffectiveStatement<?>) effectiveSubstatement, defaultValues)) {
            return true;
        }
    }

    return false;
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:23,代码来源:EffectiveStmtUtils.java

示例10: createSubstatement

import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; //导入依赖的package包/类
/**
 * Create a new substatement at the specified offset.
 *
 * @param offset Substatement offset
 * @param def definition context
 * @param ref source reference
 * @param argument statement argument
 * @return A new substatement
 */
@SuppressWarnings("checkstyle:methodTypeParameterName")
public final <CA, CD extends DeclaredStatement<CA>, CE extends EffectiveStatement<CA, CD>>
        StatementContextBase<CA, CD, CE> createSubstatement(final int offset,
                final StatementDefinitionContext<CA, CD, CE> def, final StatementSourceReference ref,
                final String argument) {
    final ModelProcessingPhase inProgressPhase = getRoot().getSourceContext().getInProgressPhase();
    Preconditions.checkState(inProgressPhase != ModelProcessingPhase.EFFECTIVE_MODEL,
            "Declared statement cannot be added in effective phase at: %s", getStatementSourceReference());

    final Optional<StatementSupport<?, ?, ?>> implicitParent = definition.getImplicitParentFor(def.getPublicView());
    if (implicitParent.isPresent()) {
        return createImplicitParent(offset, implicitParent.get(), ref, argument).createSubstatement(offset, def,
                ref, argument);
    }

    final StatementContextBase<CA, CD, CE> ret = new SubstatementContext<>(this, def, ref, argument);
    substatements = substatements.put(offset, ret);
    def.onStatementAdded(ret);
    return ret;
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:30,代码来源:StatementContextBase.java

示例11: createEffective

import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; //导入依赖的package包/类
@Override
public AnyxmlEffectiveStatement createEffective(
        final StmtContext<QName, AnyxmlStatement, AnyxmlEffectiveStatement> ctx) {
    final AnyxmlEffectiveStatement delegateStatement = delegate().createEffective(ctx);
    final Map<StatementDefinition, Mutable<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement,
        EffectiveStatement<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement>>> schemaLocations =
            ctx.getAllFromCurrentStmtCtxNamespace(AnyxmlSchemaLocationNamespace.class);
    if (schemaLocations != null && !schemaLocations.isEmpty()) {
        final SchemaNodeIdentifier anyXmlSchemaNodeIdentifier = schemaLocations.values().iterator().next()
                .getStatementArgument();
        final Optional<ContainerSchemaNode> anyXmlSchema = getAnyXmlSchema(ctx, anyXmlSchemaNodeIdentifier);
        if (anyXmlSchema.isPresent()) {
            return new YangModeledAnyxmlEffectiveStatementImpl(delegateStatement, anyXmlSchema.get());
        }
    }

    return delegateStatement;
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:19,代码来源:AnyxmlStatementSupportOverride.java

示例12: onStatementDefinitionDeclared

import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; //导入依赖的package包/类
@Override
public void onStatementDefinitionDeclared(
        final Mutable<QName, BaseStatement, EffectiveStatement<QName, BaseStatement>> baseStmtCtx) {
    final Mutable<?, ?, ?> baseParentCtx = baseStmtCtx.getParentContext();
    if (StmtContextUtils.producesDeclared(baseParentCtx, IdentityStatement.class)) {

        final QName baseIdentityQName = baseStmtCtx.getStatementArgument();
        final ModelActionBuilder baseIdentityAction = baseStmtCtx.newInferenceAction(
            ModelProcessingPhase.STATEMENT_DEFINITION);
        final Prerequisite<StmtContext<?, ?, ?>> requiresPrereq = baseIdentityAction.requiresCtx(baseStmtCtx,
            IdentityNamespace.class, baseIdentityQName, ModelProcessingPhase.STATEMENT_DEFINITION);
        final Prerequisite<StmtContext.Mutable<?, ?, ?>> mutatesPrereq = baseIdentityAction.mutatesCtx(
            baseParentCtx, ModelProcessingPhase.STATEMENT_DEFINITION);

        baseIdentityAction.apply(new InferenceAction() {
            @Override
            public void apply(final InferenceContext ctx) {
                List<StmtContext<?, ?, ?>> derivedIdentities = baseStmtCtx.getFromNamespace(
                    DerivedIdentitiesNamespace.class, baseStmtCtx.getStatementArgument());
                if (derivedIdentities == null) {
                    derivedIdentities = new ArrayList<>(1);
                    baseStmtCtx.addToNs(DerivedIdentitiesNamespace.class, baseIdentityQName, derivedIdentities);
                }
                derivedIdentities.add(baseParentCtx);
            }

            @Override
            public void prerequisiteFailed(final Collection<? extends Prerequisite<?>> failed) {
                throw new InferenceException(baseStmtCtx.getStatementSourceReference(),
                    "Unable to resolve identity %s and base identity %s",
                    baseParentCtx.getStatementArgument(), baseStmtCtx.getStatementArgument());
            }
        });
    }
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:36,代码来源:BaseStatementSupport.java

示例13: onFullDefinitionDeclared

import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; //导入依赖的package包/类
@Override
public final void onFullDefinitionDeclared(
        final Mutable<String, TypeStatement, EffectiveStatement<String, TypeStatement>> stmt) {
    super.onFullDefinitionDeclared(stmt);

    // if it is yang built-in type, no prerequisite is needed, so simply return
    if (BUILT_IN_TYPES.containsKey(stmt.getStatementArgument())) {
        return;
    }

    final QName typeQName = StmtContextUtils.qnameFromArgument(stmt, stmt.getStatementArgument());
    final ModelActionBuilder typeAction = stmt.newInferenceAction(ModelProcessingPhase.EFFECTIVE_MODEL);
    final Prerequisite<StmtContext<?, ?, ?>> typePrereq = typeAction.requiresCtx(stmt, TypeNamespace.class,
            typeQName, ModelProcessingPhase.EFFECTIVE_MODEL);
    typeAction.mutatesEffectiveCtx(stmt.getParentContext());

    /*
     * If the type does not exist, throw new InferenceException.
     * Otherwise perform no operation.
     */
    typeAction.apply(new InferenceAction() {
        @Override
        public void apply(final InferenceContext ctx) {
            // Intentional NOOP
        }

        @Override
        public void prerequisiteFailed(final Collection<? extends Prerequisite<?>> failed) {
            InferenceException.throwIf(failed.contains(typePrereq), stmt.getStatementSourceReference(),
                "Type [%s] was not found.", typeQName);
        }
    });
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:34,代码来源:AbstractTypeStatementSupport.java

示例14: tryToFindUnknownStatement

import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static Mutable<?, ?, EffectiveStatement<?, ?>> tryToFindUnknownStatement(final String localName,
        final Mutable<?, ?, EffectiveStatement<?, ?>> current) {
    final Collection<? extends StmtContext<?, ?, ?>> unknownSubstatements = StmtContextUtils.findAllSubstatements(
        current, UnknownStatement.class);
    for (final StmtContext<?, ?, ?> unknownSubstatement : unknownSubstatements) {
        if (localName.equals(unknownSubstatement.rawStatementArgument())) {
            return (Mutable<?, ?, EffectiveStatement<?, ?>>) unknownSubstatement;
        }
    }
    return null;
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:13,代码来源:SchemaNodeIdentifierBuildNamespace.java

示例15: resolveUsesNode

import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; //导入依赖的package包/类
public static void resolveUsesNode(
        final Mutable<QName, UsesStatement, EffectiveStatement<QName, UsesStatement>> usesNode,
        final StmtContext<?, ?, ?> targetNodeStmtCtx) {
    for (final Mutable<?, ?, ?> subStmtCtx : usesNode.mutableDeclaredSubstatements()) {
        if (StmtContextUtils.producesDeclared(subStmtCtx, RefineStatement.class)
                && areFeaturesSupported(subStmtCtx)) {
            performRefine(subStmtCtx, targetNodeStmtCtx);
        }
    }
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:11,代码来源:UsesStatementImpl.java


注:本文中的org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。