gpt4 book ai didi

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

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

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

YangImport介绍

[英]Represents the information about the imported modules.
[中]

代码示例

代码示例来源: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

String importedModuleName = getModuleName();
Date importedModuleRevision = getRevision();
YangNode moduleNode = null;
    if (getRevision() == null) {
      setImportedNode(moduleNode);
      return;
        .getRevision().getRevDate()
        .equals(importedModuleRevision))) {
      setImportedNode(moduleNode);
      return;
exception.setLine(getLineNumber());
exception.setCharPosition(getCharPosition());
exception.setFileName(getFileName());
throw exception;

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

if (yangImp.getPrefixId().equals(prefix)) {
  prefixMap.put(prefix, yangImp.getModuleName());

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

/**
 * It is called when parser receives an input matching the grammar rule
 * (import), perform validations and update the data model tree.
 *
 * @param listener Listener's object
 * @param ctx      context object of the grammar rule
 */
public static void processImportEntry(TreeWalkListener listener, ImportStatementContext ctx) {
  // Check for stack to be non empty.
  checkStackIsNotEmpty(listener, MISSING_HOLDER, IMPORT_DATA, ctx.identifier().getText(), ENTRY);
  String identifier = getValidIdentifier(ctx.identifier().getText(), IMPORT_DATA, ctx);
  YangImport importNode = new YangImport();
  importNode.setModuleName(identifier);
  // Set the line number and character position in line for the belongs to.
  int errorLine = ctx.getStart().getLine();
  int errorPosition = ctx.getStart().getCharPositionInLine();
  importNode.setLineNumber(errorLine);
  importNode.setCharPosition(errorPosition);
  importNode.setFileName(listener.getFileName());
  // Push import node to the stack.
  listener.getParsedDataStack().push(importNode);
}

代码示例来源: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-linker

YangNode importedNode = yangImport.getImportedNode();
if (curNodePriority >= importedNode.getPriority()) {
  importedNode.setPriority(curNodePriority + 1);

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

/**
 * Assigns leafref with new prefixes while cloning.
 *
 * @param importedNodeName imported node name from grouping
 * @param atomicPath       atomic path in leafref
 * @param node             instance of YANG uses where cloning is done
 * @throws DataModelException data model error
 */
private static void assignCurrentLeafedWithNewPrefixes(String importedNodeName, YangAtomicPath atomicPath,
                            YangNode node)
    throws DataModelException {
  while (!(node instanceof YangReferenceResolver)) {
    node = node.getParent();
    if (node == null) {
      throw new DataModelException("Internal datamodel error: Datamodel tree is not correct");
    }
  }
  if (node instanceof YangModule) {
    List<YangImport> importInUsesList = ((YangModule) node).getImportList();
    if (importInUsesList != null && !importInUsesList.isEmpty()) {
      Iterator<YangImport> importInUsesListIterator = importInUsesList.listIterator();
      while (importInUsesListIterator.hasNext()) {
        YangImport importInUsesNode = importInUsesListIterator.next();
        if (importInUsesNode.getModuleName().equals(importedNodeName)) {
          atomicPath.getNodeIdentifier().setPrefix(importInUsesNode.getPrefixId());
        }
      }
    }
  }
}

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

if (yangImport.getPrefixId().contentEquals(getRefPrefix())) {
  YangNode inc = yangImport.getImportedNode();
  YangNode linkedNode = getLinkedNode(inc);
  if (linkedNode == null) {

代码示例来源: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);
  }
}

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