gpt4 book ai didi

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

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

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

YangNode.getNextSibling介绍

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

代码示例

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

/**
 * Returns the YANG uses node list.
 *
 * @param node parent node
 * @return YANG uses list
 */
private List<YangUses> getUsesNode(YangNode node) {
  YangNode curNode = node.getChild();
  List<YangUses> usesList = new LinkedList<>();
  while (curNode != null) {
    if (curNode instanceof YangUses) {
      usesList.add((YangUses) curNode);
    }
    curNode = curNode.getNextSibling();
  }
  return usesList;
}

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

/**
 * Searches for output in given RPC node.
 *
 * @param rpc YANG RPC node
 * @return output node
 */
public static YangNode findRpcOutput(YangNode rpc) {
  YangNode child = rpc.getChild();
  while (child != null) {
    if (!(child instanceof YangOutput)) {
      child = child.getNextSibling();
      continue;
    }
    return child;
  }
  return null;
}

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

/**
 * Returns list of augment nodes.
 *
 * @param node root node
 * @return list of augment nodes
 */
public List<YangAugment> getListOfYangAugment(YangNode node) {
  node = node.getChild();
  List<YangAugment> augments = new ArrayList<>();
  while (node != null) {
    if (node instanceof YangAugment) {
      augments.add((YangAugment) node);
    }
    node = node.getNextSibling();
  }
  return augments;
}

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

/**
 * Gets the list of augments from the uses.
 *
 * @param uses YANG uses
 * @return list of YANG augment
 */
private List<YangAugment> getAugList(YangUses uses) {
  List<YangAugment> augList = new LinkedList<>();
  YangNode child = uses.getChild();
  while (child != null) {
    if (child instanceof YangAugment) {
      augList.add((YangAugment) child);
    }
    child = child.getNextSibling();
  }
  return augList;
}

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

/**
 * Searches for input in given RPC node.
 *
 * @param rpc YANG RPC node
 * @return input node
 */
public static YangNode findRpcInput(YangNode rpc) {
  YangNode child = rpc.getChild();
  while (child != null) {
    if (!(child instanceof YangInput)) {
      child = child.getNextSibling();
      continue;
    }
    return child;
  }
  return null;
}

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

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

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

/**
 * Returns referred node.
 *
 * @param nodeId     node identifier
 * @param potRefNode potential referred node
 * @return potential referred node
 */
private static YangNode getNode(YangNodeIdentifier nodeId,
                YangNode potRefNode) {
  while (potRefNode != null) {
    if (potRefNode.getName().equals(nodeId.getName())) {
      return potRefNode;
    }
    potRefNode = potRefNode.getNextSibling();
  }
  return null;
}

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

/**
 * Verifies for child nodes in sub module.
 *
 * @param node submodule node
 * @param name name of child node
 * @return true if child node found
 */
private boolean verifyChildNode(YangNode node, String name) {
  node = node.getChild();
  while (node != null) {
    if (node.getName().equals(name)) {
      return true;
    }
    node = node.getNextSibling();
  }
  return false;
}

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

/**
 * Add the unresolved data under the root leve grouping to be resolved, since it will be used in interfile uses.
 *
 * @param referenceResolver module / sub-module
 */
public static void resolveGroupingInDefinationScope(YangReferenceResolver referenceResolver) {
  YangNode potentialInterFileGrouping = ((YangNode) referenceResolver).getChild();
  while (potentialInterFileGrouping != null) {
    if (potentialInterFileGrouping instanceof YangGrouping) {
      addGroupingResolvableEntitiesToResolutionList((YangGrouping) potentialInterFileGrouping);
    }
    potentialInterFileGrouping = potentialInterFileGrouping.getNextSibling();
  }
}

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

/**
 * Returns the node from the parent node by matching it with the atomic
 * name. If no child node matches the name then it returns null.
 *
 * @param curNode    current node
 * @param identifier atomic name
 * @return node to be traversed
 */
private static YangNode getNode(YangNode curNode,
                YangNodeIdentifier identifier) {
  YangNode node = curNode;
  while (node != null) {
    if (node.getName().equals(identifier.getName())) {
      return node;
    }
    node = node.getNextSibling();
  }
  return null;
}

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

/**
 * Checks for the augment name name collision. If there are augments with
 * the same name present, then the new augment will be set with a logical
 * node.
 *
 * @param root augment parent node
 * @param aug  YANG augment node
 */
public static void checkAugNameCollision(YangNode root, YangAugment aug) {
  YangNode child = root.getChild();
  while (child != null) {
    if (child instanceof YangAugment) {
      if (child.getName().equals(aug.getName())) {
        aug.setLogicalNode((YangAugment) child);
      }
    }
    child = child.getNextSibling();
  }
}

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

private static void processHierarchyChild(YangNode node,
                     Map<YangNode, List<YangNode>> map) {
  YangNode child = node.getChild();
  if (child != null) {
    List<YangNode> nodes = new ArrayList<>();
    while (child != null) {
      nodes.add(child);
      child.setParent(null);
      child = child.getNextSibling();
      if (child != null) {
        child.getPreviousSibling().setNextSibling(null);
        child.setPreviousSibling(null);
      }
    }
    map.put(node, nodes);
  }
  node.setChild(null);
}

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

@Override
  public YangSchemaNode addSchema(YangSchemaNode containedSchema) throws
      IllegalArgumentException {
    YangNode nodeToClone = (YangNode) containedSchema;
    try {
      cloneSubTree(nodeToClone.getParent(), this, null,
             false, nodeToClone);
    } catch (DataModelException e) {
      throw new IllegalArgumentException(e);
    }
    YangNode child = getChild();
    // Contained Schema Name
    String name = containedSchema.getName();
    while (child.getName() != name) {
      child = child.getNextSibling();
    }
    return child;
  }
}

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

/**
 * Finds the referred identity node at the root level of imported/included node.
 *
 * @param refNode module/sub-module node
 * @return referred identity
 */
private YangNode findRefIdentityRef(YangNode refNode) {
  YangNode tmpNode = refNode.getChild();
  while (tmpNode != null) {
    if (tmpNode instanceof YangIdentity) {
      if (tmpNode.getName()
          .equals(((YangIdentityRef) getCurEntityToResolveFromStack())
                  .getBaseIdentity().getName())) {
        return tmpNode;
      }
    }
    tmpNode = tmpNode.getNextSibling();
  }
  return null;
}

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

/**
 * Checks if the augment node is a duplicate node. If the augment is
 * duplicate, then it adds all its children to the logical node.
 *
 * @param augment YANG augment
 * @return true if it is a duplicate node; false otherwise
 */
public static boolean isDuplicateNode(YangAugment augment) {
  YangAugment logical = augment.getLogicalNode();
  if (logical == null) {
    return false;
  }
  YangNode lastChild = logical;
  YangNode child = logical.getChild();
  while (child != null) {
    lastChild = child;
    child = child.getNextSibling();
  }
  addChildToLogicalNode(logical, augment, lastChild);
  addLeafAndLeafList(logical, augment);
  return true;
}

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

/**
 * Detects node collision of augment children nodes, leaves and leaf-lists
 * with target node's children nodes.
 *
 * @param aug YANG augment's child
 * @param tgt target node's child
 * @param aL  augment leaves
 * @param aLl augment leaf lists
 */
private static void detectNodeCollision(YangNode aug, YangNode tgt,
                    List<YangLeaf> aL,
                    List<YangLeafList> aLl) {
  while (tgt != null) {
    detectCollision(tgt.getName(), aug.getName(), aug, TARGET_NODE);
    detectLeafCollision(tgt.getName(), tgt, aL);
    detectLeafListCollision(tgt.getName(), tgt, aLl);
    tgt = tgt.getNextSibling();
  }
}

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