gpt4 book ai didi

org.onosproject.yangutils.datamodel.YangNode.getParent()方法的使用及代码示例

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

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

YangNode.getParent介绍

[英]Returns the parent of node.
[中]返回节点的父节点。

代码示例

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

/**
 * Returns the contained data model parent node.
 *
 * @param currentNode current node which parent contained node is required
 * @return parent node in which the current node is an attribute
 */
public static YangNode getParentNodeInGenCode(YangNode currentNode) {
  /*
   * TODO: recursive parent lookup to support choice/augment/uses. TODO:
   * need to check if this needs to be updated for
   * choice/case/augment/grouping
   */
  return currentNode.getParent();
}

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

/**
 * Processes addition of schema node child to parent map.
 *
 * @param name      name of the node
 * @param namespace namespace of the node
 */
protected void processAdditionOfSchemaNodeToParentMap(String name,
                           YangNamespace namespace) {
  processAdditionOfSchemaNodeToMap(name, namespace, this, getParent());
}

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

/**
 * Returns true if op type info required for node.
 *
 * @return true if op type info required for node
 */
public boolean isOpTypeReq() {
  return this instanceof RpcNotificationContainer ||
      !(this instanceof InvalidOpTypeHolder) &&
          getParent().isOpTypeReq();
}

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

private boolean isListPresentInGrouping() {
  YangNode node = getParent();
  while (node != null) {
    if (node instanceof YangGrouping) {
      return true;
    }
    node = node.getParent();
  }
  return false;
  // TODO When grouping linking is done this method has to be modified.
}

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

/**
 * Returns the root node from the current node.
 *
 * @param node YANG node
 * @return root node
 */
private static YangNode getRootNode(YangNode node) {
  YangNode curNode = node;
  while (!(curNode instanceof YangModule) &&
      !(curNode instanceof YangSubModule)) {
    if (curNode == null) {
      throw new ParserException(INVALID_TREE);
    }
    curNode = curNode.getParent();
  }
  return curNode;
}

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

/**
 * Returns parent node config value, if top node does not specify a config
 * statement then default value true is returned.
 *
 * @param listener listener's object
 * @return true/false parent's config value
 */
public static boolean getParentNodeConfig(TreeWalkListener listener) {
  Parsable curData = listener.getParsedDataStack().peek();
  YangNode parentNode = ((YangNode) curData).getParent();
  if (curData instanceof YangConfig) {
    return ((YangConfig) curData).isConfig();
  } else if (curData instanceof YangRpc || curData instanceof YangOutput
      || curData instanceof YangInput || curData instanceof YangNotification) {
    return false;
  } else if (curData instanceof YangCase && parentNode instanceof YangChoice) {
    return ((YangChoice) parentNode).isConfig();
  } else {
    return true;
  }
}

代码示例来源:origin: org.onosproject/onos-yang-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-datamodel

/**
 * Adds namespace for self, next sibling and first child. This is used
 * after obtaining namespace in case of submodule after performing
 * linking.
 */
public void setNameSpaceAndAddToParentSchemaMap() {
  // Get parent namespace.
  if (getParent() != null) {
    // Get parent namespace and set namespace for self node.
    setNameSpace(getParent().getNameSpace());
    // Process addition of leaf to the child schema map of parent.
    processAdditionOfSchemaNodeToParentMap(getName(), getNameSpace());
  } else {
    // Module/Sub-module
    setNameSpace((YangNamespace) this);
  }
  /*
   * Check if node contains leaf/leaf-list, if yes add namespace for leaf
   * and leaf list.
   */
  if (this instanceof YangLeavesHolder) {
    ((YangLeavesHolder) this).setLeafNameSpaceAndAddToParentSchemaMap();
  }
}

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

} else {
  curTraversal = PARENT;
  curNode = curNode.getParent();

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

updateClonedLeavesUnionEnumRef((YangLeavesHolder) clonedTreeCurNode);
  clonedTreeCurNode = clonedTreeCurNode.getParent();
} else {
  curTraversal = PARENT;
  nextNodeToClone = nextNodeToClone.getParent();

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

if (newSibling.getParent() == null) {
  newSibling.setParent(getParent());

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

if (newChild.getParent() == null) {
  newChild.setParent(this);
} else if (newChild.getParent() != this) {
  throw new DataModelException("Node is already part of a tree " +
                     getName() + " in " +

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

parsable.getYangConstructType());
} else if (addAs == TraversalType.SIBILING) {
  currentNode = currentNode.getParent();
  if (!(currentNode instanceof CollisionDetector)) {
    throw new DataModelException("Node in data model tree does " +

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

.getHolderOfEntityToResolve();
while (!(curNode instanceof YangReferenceResolver)) {
  curNode = curNode.getParent();
  if (curNode == null) {
    throw new DataModelException("Internal datamodel error: Datamodel tree is not correct");

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