gpt4 book ai didi

org.opendaylight.yangtools.yang.parser.rfc7950.repo.YangModelDependencyInfo类的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 06:49:31 26 4
gpt4 key购买 nike

本文整理了Java中org.opendaylight.yangtools.yang.parser.rfc7950.repo.YangModelDependencyInfo类的一些代码示例,展示了YangModelDependencyInfo类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YangModelDependencyInfo类的具体详情如下:
包路径:org.opendaylight.yangtools.yang.parser.rfc7950.repo.YangModelDependencyInfo
类名称:YangModelDependencyInfo

YangModelDependencyInfo介绍

[英]Helper transfer object which holds basic and dependency information for YANG model.

There are two concrete implementations of this interface:

  • ModuleDependencyInfo - Dependency information for module
  • SubmoduleDependencyInfo - Dependency information for submodule
    [中]Helper transfer对象,它保存YANG模型的基本信息和依赖信息。
    该接口有两个具体实现:
    *ModuleDependencyInfo-模块的依赖项信息
    *SubmoduleDependencyInfo-子模块的依赖项信息

代码示例

代码示例来源:origin: org.opendaylight.yangtools/yang-parser-rfc7950

private static @NonNull YangModelDependencyInfo parseModuleContext(final StatementContext module,
    final SourceIdentifier source) {
  final String name = safeStringArgument(source, module, "module name");
  final String latestRevision = getLatestRevision(module, source);
  final Optional<SemVer> semVer = Optional.ofNullable(findSemanticVersion(module, source));
  final ImmutableSet<ModuleImport> imports = parseImports(module, source);
  final ImmutableSet<ModuleImport> includes = parseIncludes(module, source);
  return new ModuleDependencyInfo(name, latestRevision, imports, includes, semVer);
}

代码示例来源:origin: org.opendaylight.yangtools/yang-parser-rfc7950

private static @NonNull SemVerSourceIdentifier getSemVerSourceId(final @NonNull YangModelDependencyInfo depInfo) {
    return depInfo.getFormattedRevision() == null
        ? SemVerSourceIdentifier.create(depInfo.getName(), depInfo.getSemanticVersion().orElse(null))
            : SemVerSourceIdentifier.create(depInfo.getName(), depInfo.getRevision(),
              depInfo.getSemanticVersion().orElse(null));
  }
}

代码示例来源:origin: org.opendaylight.yangtools/yang-parser-rfc7950

private static @NonNull YangModelDependencyInfo parseSubmoduleContext(final StatementContext submodule,
    final SourceIdentifier source) {
  final String name = safeStringArgument(source, submodule, "submodule name");
  final String belongsTo = parseBelongsTo(submodule, source);
  final String latestRevision = getLatestRevision(submodule, source);
  final ImmutableSet<ModuleImport> imports = parseImports(submodule, source);
  final ImmutableSet<ModuleImport> includes = parseIncludes(submodule, source);
  return new SubmoduleDependencyInfo(name, latestRevision, belongsTo, imports, includes);
}

代码示例来源:origin: org.opendaylight.yangtools/yang-parser-rfc7950

private static @NonNull SourceIdentifier getSourceId(final @NonNull YangModelDependencyInfo depInfo) {
  final String name = depInfo.getName();
  return depInfo.getFormattedRevision() == null ? RevisionSourceIdentifier.create(name)
      : RevisionSourceIdentifier.create(name, depInfo.getRevision());
}

代码示例来源:origin: org.opendaylight.yangtools/yang-parser-rfc7950

private static ImmutableSet<ModuleImport> parseImports(final StatementContext module,
    final SourceIdentifier source) {
  final Set<ModuleImport> result = new HashSet<>();
  for (final StatementContext subStatementContext : module.statement()) {
    if (IMPORT.equals(subStatementContext.keyword().getText())) {
      final String importedModuleName = safeStringArgument(source, subStatementContext,
        "imported module name");
      final String revisionDateStr = getRevisionDateString(subStatementContext, source);
      final Revision revisionDate = Revision.ofNullable(revisionDateStr).orElse(null);
      final SemVer importSemVer = findSemanticVersion(subStatementContext, source);
      result.add(new ModuleImportImpl(importedModuleName, revisionDate, importSemVer));
    }
  }
  return ImmutableSet.copyOf(result);
}

代码示例来源:origin: org.opendaylight.yangtools/yang-parser-rfc7950

private static ImmutableSet<ModuleImport> parseIncludes(final StatementContext module,
    final SourceIdentifier source) {
  final Set<ModuleImport> result = new HashSet<>();
  for (final StatementContext subStatementContext : module.statement()) {
    if (INCLUDE.equals(subStatementContext.keyword().getText())) {
      final String revisionDateStr = getRevisionDateString(subStatementContext, source);
      final String IncludeModuleName = safeStringArgument(source, subStatementContext,
        "included submodule name");
      final Revision revisionDate = Revision.ofNullable(revisionDateStr).orElse(null);
      result.add(new ModuleImportImpl(IncludeModuleName, revisionDate));
    }
  }
  return ImmutableSet.copyOf(result);
}

代码示例来源:origin: org.opendaylight.yangtools/yang-parser-rfc7950

/**
 * Create a new instance of AST representation for a abstract syntax tree, performing minimal semantic analysis
 * to acquire dependency information.
 *
 * @param symbolicName
 *            Symbolic name
 * @param identifier
 *            SourceIdentifier of YANG schema source.
 * @param tree
 *            ANTLR abstract syntax tree
 * @return A new representation instance.
 * @throws YangSyntaxErrorException
 *             if we fail to extract dependency information.
 */
static @NonNull ASTSchemaSource create(final @NonNull SourceIdentifier identifier,
    final @Nullable String symbolicName, final @NonNull ParserRuleContext tree)
        throws YangSyntaxErrorException {
  final YangModelDependencyInfo depInfo = YangModelDependencyInfo.fromAST(identifier, tree);
  final SourceIdentifier id = getSourceId(depInfo);
  final SemVerSourceIdentifier semVerId;
  if (identifier instanceof SemVerSourceIdentifier && !depInfo.getSemanticVersion().isPresent()) {
    semVerId = (SemVerSourceIdentifier) identifier;
  } else {
    semVerId = getSemVerSourceId(depInfo);
  }
  return new ASTSchemaSource(id, semVerId, tree, depInfo, symbolicName);
}

代码示例来源:origin: org.opendaylight.yangtools/yang-parser-impl

final Set<ModuleImport> dependencies = dep.getDependencies();
for (final SourceIdentifier id : pending) {
  final YangModelDependencyInfo dep = depInfo.get(id);
  for (final ModuleImport mi : dep.getDependencies()) {
    if (!isKnown(pending, mi) && !isKnown(resolved, mi)) {
      imports.put(id, mi);

代码示例来源:origin: org.opendaylight.yangtools/yang-parser-rfc7950

private static String safeStringArgument(final SourceIdentifier source, final StatementContext stmt,
    final String desc) {
  final StatementSourceReference ref = getReference(source, stmt);
  final ArgumentContext arg = stmt.argument();
  checkArgument(arg != null, "Missing %s at %s", desc, ref);
  return ArgumentContextUtils.stringFromStringContext(arg, YangVersion.VERSION_1, ref);
}

代码示例来源:origin: opendaylight/yangtools

final Set<ModuleImport> dependencies = dep.getDependencies();
for (final SourceIdentifier id : pending) {
  final YangModelDependencyInfo dep = depInfo.get(id);
  for (final ModuleImport mi : dep.getDependencies()) {
    if (!isKnown(pending, mi) && !isKnown(resolved, mi)) {
      imports.put(id, mi);

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com