gpt4 book ai didi

org.onosproject.yang.compiler.datamodel.YangSubModule类的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 04:25:31 26 4
gpt4 key购买 nike

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

YangSubModule介绍

[英]Represents data model node to maintain information defined in YANG sub-module.
[中]表示数据模型节点,用于维护子模块中定义的信息。

代码示例

代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel

@Override
public void addReferencesToImportList(Set<YangNode> yangNodeSet)
    throws DataModelException {
  // Run through the imported list to add references.
  for (YangImport yangImport : getImportList()) {
    yangImport.addReferenceToImport(yangNodeSet);
  }
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel

@Override
public void addReferencesToIncludeList(Set<YangNode> yangNodeSet)
    throws DataModelException {
  // Run through the included list to add references.
  for (YangInclude yangInclude : getIncludeList()) {
    YangSubModule subModule = yangInclude.addReferenceToInclude(yangNodeSet);
    // Check if the referred sub-modules parent is self
    if (!Objects.equals(subModule.getBelongsTo().getModuleNode(), getBelongsTo()
        .getModuleNode())) {
      yangInclude.reportIncludeError();
    }
  }
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-linker

/**
 * Returns root prefix.
 *
 * @param root root node
 * @return root prefix
 */
private String getRootsPrefix(YangNode root) {
  if (root instanceof YangModule) {
    return ((YangModule) root).getPrefix();
  } else {
    return ((YangSubModule) root).getPrefix();
  }
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-parser

case SUB_MODULE_DATA: {
  YangSubModule subModule = (YangSubModule) tmpNode;
  subModule.setBelongsTo((YangBelongsTo) tmpBelongstoNode);
  subModule.setPrefix(subModule.getBelongsTo().getPrefix());
  break;

代码示例来源:origin: org.onosproject/onos-yang-compiler-parser

if (subModule.getUnresolvedResolutionList(ResolvableType.YANG_COMPILER_ANNOTATION) != null
    && subModule.getUnresolvedResolutionList(ResolvableType.YANG_COMPILER_ANNOTATION).size() != 0
    && subModule.getChild() != null) {
  throw new ParserException(constructListenerErrorMessage(INVALID_CHILD, MODULE_DATA,
                              ctx.identifier().getText(), EXIT));

代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel

@Override
public void resolveSelfFileLinking(ResolvableType type)
    throws DataModelException {
  // Get the list to be resolved.
  List<YangResolutionInfo> resolutionList = getUnresolvedResolutionList(type);
  // Resolve linking for a resolution list.
  resolveLinkingForResolutionList(resolutionList, this);
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel

@Override
public String getModuleName() {
  return getBelongsTo().getBelongsToModuleName();
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-linker

/**
 * Searches in sub-module node.
 *
 * @param root root node
 * @return target linked node
 */
private YangNode searchInSubModule(YangNode root) {
  List<YangInclude> includeList;
  YangNode tempNode;
  if (root instanceof YangModule) {
    includeList = ((YangModule) root).getIncludeList();
  } else {
    includeList = ((YangSubModule) root).getIncludeList();
  }
  for (YangInclude included : includeList) {
    tempNode = parseData(included.getIncludedNode());
    if (tempNode != null) {
      return tempNode;
    }
  }
  return null;
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-parser

subModule.addToIncludeList((YangInclude) tmpIncludeNode);
break;

代码示例来源:origin: org.onosproject/onos-yang-compiler-parser

subModule.addToImportList((YangImport) tmpImportNode);
break;

代码示例来源:origin: org.onosproject/onos-yang-compiler-parser

case SUB_MODULE_DATA:
  YangSubModule subModule = ((YangSubModule) curData);
  subModule.addExtension(extension);
  break;
default:

代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel

@Override
public void resolveInterFileLinking(ResolvableType type)
    throws DataModelException {
  // Get the list to be resolved.
  List<YangResolutionInfo> resolutionList = getUnresolvedResolutionList(type);
  // Resolve linking for a resolution list.
  linkInterFileReferences(resolutionList, this);
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel

@Override
public void addReferencesToIncludeList(Set<YangNode> yangNodeSet)
    throws DataModelException {
  // Run through the included list to add references.
  for (YangInclude yangInclude : getIncludeList()) {
    YangSubModule subModule = yangInclude
        .addReferenceToInclude(yangNodeSet);
    // Check if the referred sub-modules parent is self
    if (!subModule.getBelongsTo().getModuleNode().equals(this)) {
      yangInclude.reportIncludeError();
    }
  }
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-linker

/**
 * Process linking using include list.
 *
 * @param root         root node
 * @param tempPathName temporary path node name
 * @return linked target node
 */
private YangNode getIncludedNode(YangNode root, String tempPathName) {
  List<YangInclude> includeList;
  if (root instanceof YangModule) {
    includeList = ((YangModule) root).getIncludeList();
  } else {
    includeList = ((YangSubModule) root).getIncludeList();
  }
  for (YangInclude included : includeList) {
    if (verifyChildNode(included.getIncludedNode(), tempPathName)) {
      return included.getIncludedNode();
    }
  }
  return null;
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-linker

/**
 * Process linking using import list.
 *
 * @param root   root node
 * @param nodeId node identifier
 * @return linked target node
 */
private YangNode getImportedNode(YangNode root, YangNodeIdentifier nodeId) {
  List<YangImport> importList;
  if (root instanceof YangModule) {
    importList = ((YangModule) root).getImportList();
  } else {
    importList = ((YangSubModule) root).getImportList();
  }
  for (YangImport imported : importList) {
    if (imported.getPrefixId().equals(nodeId.getPrefix())) {
      return imported.getImportedNode();
    }
  }
  if (nodeId.getName() != null && nodeId.getPrefix()
      .equals(constructsParentsPrefix)) {
    return rootNode;
  }
  return root;
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-parser

/**
 * Returns the prefix of the root node from any node inside it.
 *
 * @param curNode YANG node
 * @return prefix of the root node
 */
private static String getRootPrefix(YangNode curNode) {
  String prefix;
  YangNode node = getRootNode(curNode);
  if (node instanceof YangModule) {
    YangModule yangModule = (YangModule) node;
    prefix = yangModule.getPrefix();
  } else {
    YangSubModule yangSubModule = (YangSubModule) node;
    prefix = yangSubModule.getPrefix();
  }
  return prefix;
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-parser

/**
 * Validates the prefix of the YANG file where leaf-ref is present and
 * puts it in the map of node and prefix in leaf-ref.
 *
 * @param atomicList atomic content list in leaf-ref
 * @param leafRef    YANG leaf-ref
 */
private static void valPrefix(List<YangAtomicPath> atomicList,
               YangLeafRef leafRef) {
  for (YangAtomicPath atomicPath : atomicList) {
    String prefix = atomicPath.getNodeIdentifier().getPrefix();
    YangNode parent = leafRef.getParentNode();
    YangNode rootNode = getRootNode(parent);
    List<YangImport> imports;
    if (rootNode instanceof YangModule) {
      imports = ((YangModule) rootNode).getImportList();
    } else {
      imports = ((YangSubModule) rootNode).getImportList();
    }
    updatePrefixWithNode(rootNode, imports, prefix, leafRef);
  }
}

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