gpt4 book ai didi

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

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

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

YangNode.getNextSibling介绍

[英]Returns the next sibling of node.
[中]返回节点的下一个同级。

代码示例

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

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

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

/**
 * Returns the node that matches with the name of the node in path.
 *
 * @param nodeInUnique          node name in path
 * @param potentialReferredNode node under which it has to match
 * @return referred node
 */
private static YangNode getReferredNodeFromTheUniqueNodes(YangNodeIdentifier nodeInUnique, YangNode
    potentialReferredNode) {
  while (potentialReferredNode != null) {
    // Check if the potential referred node is the actual referred node
    if (potentialReferredNode.getName().equals(nodeInUnique.getName())) {
      return potentialReferredNode;
    }
    potentialReferredNode = potentialReferredNode.getNextSibling();
  }
  return null;
}

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

/**
 * Validates the data on exiting the corresponding parse tree node.
 *
 * @throws DataModelException a violation of data model rules
 */
@Override
public void validateDataOnExit()
    throws DataModelException {
  if (defaultValueInString != null && !defaultValueInString.isEmpty()) {
    YangNode node = getChild();
    boolean matched = false;
    // Check whether default string matches the case
    while (node != null) {
      if (node instanceof YangCase) {
        if (defaultValueInString.equals(node.getName())) {
          matched = true;
          break;
        }
      }
      node = node.getNextSibling();
    }
    if (!matched) {
      throw new DataModelException(
          "YANG file error: default string \"" +
              defaultValueInString + "\" not matching choice \"" +
              getName() + "\" case.");
    }
  }
}

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

@Override
public void detectCollidingChild(String idName, YangConstructType type)
    throws DataModelException {
  if (getParent() instanceof YangCase && type != CASE_DATA) {
    ((CollisionDetector) getParent()).detectCollidingChild(idName, type);
  }
  YangNode node = getChild();
  while (node != null) {
    if (node instanceof CollisionDetector) {
      ((CollisionDetector) node).detectSelfCollision(idName, type);
    }
    node = node.getNextSibling();
  }
}

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

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

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

@Override
public void detectSelfCollision(String identifierName,
                YangConstructType dataType)
    throws DataModelException {
  if (dataType == CHOICE_DATA) {
    if (getName().equals(identifierName)) {
      throw new DataModelException(
          getErrorMsgCollision(COLLISION_DETECTION, getName(),
                     getLineNumber(), getCharPosition(),
                     CHOICE, getFileName()));
    }
    return;
  }
  YangNode node = getChild();
  while (node != null) {
    if (node instanceof CollisionDetector) {
      ((CollisionDetector) node)
          .detectSelfCollision(identifierName, dataType);
    }
    node = node.getNextSibling();
  }
}

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

if (newChild.getNextSibling() != null) {
  throw new DataModelException("Child to be added is not atomic, " +
                     "it already has a next " +
  while (curNode.getNextSibling() != null) {
    curNode = curNode.getNextSibling();
  if (curNode.getNextSibling() == null) {
    curNode.setNextSibling(newChild);
    newChild.setPreviousSibling(curNode);

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

return;
potentialTypeNode = potentialTypeNode.getNextSibling();

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

} else if (nextNodeToClone.getNextSibling() != null) {
  nextNodeToClone = nextNodeToClone.getNextSibling();
} else {
  curTraversal = PARENT;

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

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

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