gpt4 book ai didi

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

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

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

YangNode.getChild介绍

[英]Returns the first child of node.
[中]返回节点的第一个子节点。

代码示例

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

/**
 * Checks if there is any rpc defined in the module or sub-module.
 *
 * @param rootNode root node of the data model
 * @return status of rpc's existence
 */
public static boolean isRpcChildNodePresent(YangNode rootNode) {
  YangNode childNode = rootNode.getChild();
  while (childNode != null) {
    if (childNode instanceof YangRpc) {
      return true;
    }
    childNode = childNode.getNextSibling();
  }
  return false;
}

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

/**
 * Detects colliding of uses and grouping only with uses and grouping respectively.
 *
 * @param identifierName name for which collision detection is to be checked
 * @param dataType       type of YANG node asking for detecting collision
 * @param node           node instance of calling node
 * @throws DataModelException a violation of data model rules
 */
private static void detectCollidingForUsesGrouping(String identifierName, YangConstructType dataType, YangNode node)
    throws DataModelException {
  node = node.getChild();
  while (node != null) {
    Parsable parsable = (Parsable) node;
    if (node instanceof CollisionDetector
        && parsable.getYangConstructType() == dataType) {
      ((CollisionDetector) node).detectSelfCollision(identifierName, dataType);
    }
    node = node.getNextSibling();
  }
}

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

/**
 * Returns the last node under the unique path.
 *
 * @param uniquePath atomic path list
 * @param node       root node from where it starts searching
 * @param ctx        yang construct's context to get the line number and character position
 * @return last node in the list
 */
private static YangNode getNodeUnderListFromPath(List<YangAtomicPath> uniquePath, YangNode node,
                         ParserRuleContext ctx) {
  Iterator<YangAtomicPath> nodesInReference = uniquePath.listIterator();
  YangNode potentialReferredNode = node.getChild();
  while (nodesInReference.hasNext()) {
    YangAtomicPath nodeInUnique = nodesInReference.next();
    YangNode referredNode = getReferredNodeFromTheUniqueNodes(nodeInUnique.getNodeIdentifier(),
                                 potentialReferredNode);
    if (referredNode == null) {
      ParserException parserException = new ParserException("YANG file error : The target node in unique " +
                                     "reference path is invalid");
      parserException.setLine(ctx.getStart().getLine());
      parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
      throw parserException;
    } else {
      potentialReferredNode = referredNode.getChild();
    }
  }
  return potentialReferredNode;
}

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

if (curTraversal != PARENT && curNode.getChild() != null) {
  curTraversal = CHILD;
  curNode = curNode.getChild();
} else if (curNode.getNextSibling() != null) {
  curTraversal = SIBILING;

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

/**
 * Detects the colliding identifier name in a given YANG node and its child.
 *
 * @param identifierName name for which collision detection is to be checked
 * @param dataType       type of YANG node asking for detecting collision
 * @param node           instance of calling node
 * @throws DataModelException a violation of data model rules
 */
public static void detectCollidingChildUtil(String identifierName, YangConstructType dataType, YangNode node)
    throws DataModelException {
  if (dataType == YangConstructType.USES_DATA || dataType == YangConstructType.GROUPING_DATA) {
    detectCollidingForUsesGrouping(identifierName, dataType, node);
  } else {
    if (node instanceof YangLeavesHolder) {
      YangLeavesHolder leavesHolder = (YangLeavesHolder) node;
      detectCollidingLeaf(leavesHolder.getListOfLeaf(), identifierName);
      detectCollidingLeafList(leavesHolder.getListOfLeafList(), identifierName);
    }
    node = node.getChild();
    while (node != null) {
      Parsable parsable = (Parsable) node;
      if (node instanceof CollisionDetector
          && parsable.getYangConstructType() != YangConstructType.USES_DATA
          && parsable.getYangConstructType() != YangConstructType.GROUPING_DATA) {
        ((CollisionDetector) node).detectSelfCollision(identifierName, dataType);
      }
      node = node.getNextSibling();
    }
  }
}

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

YangNode newNode = null;
nextNodeToClone = nextNodeToClone.getChild();
if (nextNodeToClone == null) {
  return;
    if (curTraversal != PARENT && nextNodeToClone.getChild() != null) {
      curTraversal = CHILD;
      nextNodeToClone = nextNodeToClone.getChild();

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

" in " + leavesHolder.getFileName() + "\"");
YangNode potentialTypeNode = ((YangNode) leavesHolder).getChild();
while (potentialTypeNode != null) {
  String dataTypeName = null;

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

if (newChild.getChild() != null) {
  throw new DataModelException("Child to be added is not atomic, " +
                     "it already has a child " +
if (getChild() == null) {
  setChild(newChild);
} else {
  curNode = getChild();

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

if (newSibling.getChild() != null) {
  throw new DataModelException("Sibling to be added is not atomic, " +
                     "it already has a child " +

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