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

x33g5p2x  于2022-02-05 转载在 其他  
字(10.8k)|赞(0)|评价(0)|浏览(128)

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

YangNodeIdentifier.getName介绍

[英]Returns name of the node identifier.
[中]返回节点标识符的名称。

代码示例

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

/**
 * Returns the name of data type.
 *
 * @return the name of data type
 */
public String getDataTypeName() {
  return nodeId.getName();
}

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

/**
 * Returns the name of identity.
 *
 * @return the identity name
 */
@Override
public String getName() {
  return baseIdentity.getName();
}

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

@Override
public String getName() {
  return nodeIdentifier.getName();
}

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

/**
 * Searches for the augment node in imported module when prefix has changed from
 * inter file to inter file.
 *
 * @param nodeId node id
 * @param index  index
 * @return true if found
 */
private boolean searchForAugmentInImportedNode(YangNodeIdentifier nodeId,
                        int index) {
  if (index == absPaths.size()) {
    return false;
  }
  YangNodeIdentifier tempNodeId = absPaths.get(index).getNodeIdentifier();
  return nodeId.getName().equals(tempNodeId.getName());
}

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

/**
 * 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-linker

/**
 * Returns the leaf by searching it in the node by the leaf name. Returns
 * null when the name doesn't match.
 *
 * @param name   leaf name
 * @param holder holder of leaf
 * @return YANG leaf
 */
private static YangLeaf getLeaf(YangNodeIdentifier name,
                YangLeavesHolder holder) {
  List<YangLeaf> listOfLeaf = holder.getListOfLeaf();
  if (listOfLeaf != null) {
    for (YangLeaf yangLeaf : listOfLeaf) {
      if (yangLeaf.getName().equals(name.getName())) {
        return yangLeaf;
      }
    }
  }
  return null;
}

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

/**
 * Returns the leaf-list by searching it in the node by the leaf-list name.
 * Returns null when the name doesn't match.
 *
 * @param name   leaf-list name
 * @param holder holder of leaf-list
 * @return YANG leaf-list
 */
private static YangLeafList getLeafList(YangNodeIdentifier name,
                    YangLeavesHolder holder) {
  List<YangLeafList> listOfLeafList = holder.getListOfLeafList();
  if (listOfLeafList != null) {
    for (YangLeafList yangLeafList : listOfLeafList) {
      if (yangLeafList.getName().equals(name.getName())) {
        return yangLeafList;
      }
    }
  }
  return null;
}

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

/**
 * Searches target leaf in root node.
 *
 * @param node      root node
 * @param curNodeId YANG node identifier
 * @return linked target leaf node holder
 */
private YangNode searchTargetLeaf(YangNode node,
                 YangNodeIdentifier curNodeId) {
  YangLeavesHolder holder = (YangLeavesHolder) node;
  List<YangLeafList> leavesList = holder.getListOfLeafList();
  if (leavesList != null && !leavesList.isEmpty()) {
    for (YangLeafList leafList : leavesList) {
      if (leafList.getName().equals(curNodeId.getName())) {
        return node;
      }
    }
  }
  List<YangLeaf> leaves = holder.getListOfLeaf();
  if (leaves != null && !leaves.isEmpty()) {
    for (YangLeaf leaf : leaves) {
      if (leaf.getName().equals(curNodeId.getName())) {
        return node;
      }
    }
  }
  return null;
}

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

/**
 * Removes deviation target node from cloned data model.
 *
 * @param target     deviation target node
 * @param targetPath deviation target's last node
 */
private void resolveDeviationNotSupported(YangSchemaNode target,
                     YangAtomicPath targetPath) {
  if (target.getName().equals(targetPath.getNodeIdentifier().getName())) {
    deleteUnsupportedNodeFromTree((YangNode) target);
  } else {
    deleteUnsupportedLeafOrLeafList((YangLeavesHolder) target,
                    targetPath.getNodeIdentifier().getName());
  }
}

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

/**
 * Returns the leaf from leaves holder.
 *
 * @param holder root node from where it starts searching
 * @param pLeaf  yang atomic path
 * @return yang leaf from leaves holder
 */
private static YangLeaf getLeaf(YangNode holder, YangAtomicPath pLeaf) {
  YangLeavesHolder leavesHolder = (YangLeavesHolder) holder;
  List<YangLeaf> leaves = leavesHolder.getListOfLeaf();
  if (leaves != null && !leaves.isEmpty()) {
    for (YangLeaf leaf : leaves) {
      if (pLeaf.getNodeIdentifier().getName()
          .equals(leaf.getName())) {
        return leaf;
      }
    }
  }
  return null;
}

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

/**
 * Returns the augment name, after removing the prefix, in each atomic
 * content, which is equal to the root prefix.
 *
 * @param atomics atomic content list
 * @param root    root node
 * @return prefix removed augment name
 */
public static String getPrefixRemovedName(List<YangAtomicPath> atomics,
                     YangNode root) {
  String rootPrefix = getRootPrefix(root);
  StringBuilder builder = new StringBuilder();
  for (YangAtomicPath atomic : atomics) {
    String id;
    String prefix = atomic.getNodeIdentifier().getPrefix();
    String name = atomic.getNodeIdentifier().getName();
    if (rootPrefix.equals(prefix) || prefix == null) {
      id = SLASH_FOR_STRING + name;
    } else {
      id = SLASH_FOR_STRING + prefix + COLON + name;
    }
    builder.append(id);
  }
  return builder.toString();
}

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

private boolean isFeatureDefinedInNode(YangNode node) {
  T entity = getCurEntityToResolveFromStack();
  YangNodeIdentifier ifFeature = ((YangIfFeature) entity).getName();
  List<YangFeature> featureList = ((YangFeatureHolder) node)
      .getFeatureList();
  if (featureList != null && !featureList.isEmpty()) {
    Iterator<YangFeature> iterator = featureList.iterator();
    while (iterator.hasNext()) {
      YangFeature feature = iterator.next();
      if (ifFeature.getName().equals(feature.getName())) {
        ((YangIfFeature) entity).setReferredFeature(feature);
        ((YangIfFeature) entity).setReferredFeatureHolder(node);
        return true;
      }
    }
  }
  return false;
}

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

/**
 * Adds deviate add sub-statements to deviation target node.
 *
 * @param deviateAddList list of deviate add
 * @param target         deviation target node
 * @param targetPath     deviation target's last node
 * @throws DataModelException if there is a data model error
 */
private void resolveDeviateAdd(List<YangDeviateAdd> deviateAddList,
                YangSchemaNode target,
                YangAtomicPath targetPath)
    throws DataModelException {
  for (YangDeviateAdd deviate : deviateAddList) {
    if (target.getName().equals(targetPath.getNodeIdentifier().getName())) {
      updateDeviateAddToTargetNode(target, deviate);
    } else {
      YangSchemaNode leaf = findLeafNode((YangLeavesHolder) target, targetPath
          .getNodeIdentifier().getName());
      updateDeviateAddToTargetNode(leaf, deviate);
    }
  }
}

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

/**
 * Replaces deviate replace sub-statements from deviation target node.
 *
 * @param deviateReplaceList list of deviate replace
 * @param target             deviation target node
 * @param targetPath         deviation target's last node
 * @throws DataModelException if there is a data model error
 */
private void resolveDeviateReplace(List<YangDeviateReplace>
                      deviateReplaceList,
                  YangSchemaNode target,
                  YangAtomicPath targetPath)
    throws DataModelException {
  for (YangDeviateReplace deviate : deviateReplaceList) {
    if (target.getName().equals(targetPath.getNodeIdentifier().getName())) {
      updateDeviateReplaceToTargetNode(target, deviate);
    } else {
      YangSchemaNode leaf = findLeafNode((YangLeavesHolder) target, targetPath
          .getNodeIdentifier().getName());
      updateDeviateReplaceToTargetNode(leaf, deviate);
    }
  }
}

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

/**
 * Removes deviate delete sub-statements from deviation target node.
 *
 * @param deviateDeleteList list of deviate delete
 * @param target            deviation target node
 * @param targetPath        deviation target's last node
 * @throws DataModelException if there is a data model error
 */
private void resolveDeviateDelete(List<YangDeviateDelete>
                     deviateDeleteList,
                 YangSchemaNode target,
                 YangAtomicPath targetPath)
    throws DataModelException {
  for (YangDeviateDelete deviate : deviateDeleteList) {
    if (target.getName().equals(targetPath.getNodeIdentifier().getName())) {
      updateDeviateDeleteToTargetNode(target, deviate);
    } else {
      YangSchemaNode leaf = findLeafNode((YangLeavesHolder) target, targetPath
          .getNodeIdentifier().getName());
      updateDeviateDeleteToTargetNode(leaf, deviate);
    }
  }
}

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

/**
 * Finds the referred feature node at the root level of imported/included node.
 *
 * @param refNode module/sub-module node
 * @return referred feature
 */
private YangNode findRefFeature(YangNode refNode) {
  T entity = getCurEntityToResolveFromStack();
  YangNodeIdentifier ifFeature = ((YangIfFeature) entity).getName();
  List<YangFeature> featureList = ((YangFeatureHolder) refNode)
      .getFeatureList();
  if (featureList != null && !featureList.isEmpty()) {
    for (YangFeature feature : featureList) {
      if (ifFeature.getName().equals(feature.getName())) {
        ((YangIfFeature) entity).setReferredFeature(feature);
        return refNode;
      }
    }
  }
  return null;
}

代码示例来源: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 findRefIdentity(YangNode refNode) {
  YangNode tmpNode = refNode.getChild();
  while (tmpNode != null) {
    if (tmpNode instanceof YangIdentity) {
      if (tmpNode.getName()
          .equals(((YangBase) getCurEntityToResolveFromStack())
                  .getBaseIdentifier().getName())) {
        return tmpNode;
      }
    }
    tmpNode = tmpNode.getNextSibling();
  }
  return null;
}

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

相关文章