gpt4 book ai didi

org.onosproject.yang.compiler.datamodel.YangUses类的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 07:57:31 26 4
gpt4 key购买 nike

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

YangUses介绍

[英]Represents data model node to maintain information defined in YANG uses.
[中]表示数据模型节点,以维护数据模型中定义的信息。

代码示例

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

@Override
public void detectSelfCollision(String identifierName, YangConstructType dataType)
    throws DataModelException {
  if (getName().equals(identifierName)) {
    throw new DataModelException(
        getErrorMsgCollision(COLLISION_DETECTION, getName(),
                   getLineNumber(), getCharPosition(),
                   USES, getFileName()));
  }
}

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

/**
 * Adds all the unresolved type under leaf/leaf-list to the resolution
 * list, after cloning. This makes the resolution to happen after cloning
 * of the grouping. Adds resolution with cloned node holder under which
 * cloned type is present.
 *
 * @param yangUses   YANG uses
 * @param clonedObj  cloned type object
 * @param clonedNode holder node
 * @throws DataModelException data model error
 */
public static void addUnresolvedType(
    YangUses yangUses, Object clonedObj,
    YangNode clonedNode) throws DataModelException {
  List<YangEntityToResolveInfoImpl> infoList;
  if (yangUses != null && yangUses.getCurrentGroupingDepth() == 0) {
    infoList = getTypesToBeResolved(clonedObj, clonedNode, yangUses);
    if (nonEmpty(infoList)) {
      yangUses.addEntityToResolve(infoList);
    }
  }
}

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

throws DataModelException {
YangGrouping referredGrouping = getRefGroup();
                     " uses " + getName() + " in " +
                     getLineNumber() + " at " +
                     getCharPosition() + " in " +
                     getFileName() + "\"");
} else {
  if (checkIsUnresolvedRecursiveUsesInGrouping(referredGrouping)) {
    return null;
    || !(usesParentNode instanceof CollisionDetector)) {
  throw new DataModelException(
      "YANG uses holder construct is wrong " + getName() + " in " +
          getLineNumber() + " at " + getCharPosition() +
          " in " + getFileName() + "\"");
  cloneGroupingTree(referredGrouping, usesParentNode, this, false);
} catch (DataModelException e) {
  throw new DataModelException(e.getMessage());

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

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

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

/**
 * Returns referred typedef/grouping node.
 *
 * @return referred typedef/grouping node
 * @throws DataModelException a violation in data model rule
 */
private T getRefNode() throws DataModelException {
  T entity = getCurEntityToResolveFromStack();
  if (entity instanceof YangType) {
    YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>)
        ((YangType<?>) entity).getDataTypeExtendedInfo();
    return (T) derivedInfo.getReferredTypeDef();
  }
  if (entity instanceof YangUses) {
    return (T) ((YangUses) entity).getRefGroup();
  }
  if (entity instanceof YangIfFeature) {
    return (T) ((YangIfFeature) entity).getReferredFeatureHolder();
  }
  if (entity instanceof YangLeafRef) {
    return (T) ((YangLeafRef) entity).getReferredLeafOrLeafList();
  }
  if (entity instanceof YangBase) {
    return (T) ((YangBase) entity).getReferredIdentity();
  }
  if (entity instanceof YangIdentityRef) {
    return (T) ((YangIdentityRef) entity).getReferredIdentity();
  }
  throw new DataModelException(LINKER_ERROR);
}

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

return node.getName().contentEquals(((YangUses) entity).getName());

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

/**
 * Adds the resolved augment from the cloned uses.
 *
 * @param uses YANG uses
 * @param aug  cloned augment
 * @throws DataModelException data model error
 */
public static void addUnresolvedAugment(YangUses uses, YangAugment aug)
    throws DataModelException {
  if (uses.getCurrentGroupingDepth() == 0) {
    List<YangEntityToResolveInfoImpl> infoList = new LinkedList<>();
    YangEntityToResolveInfoImpl info =
        new YangEntityToResolveInfoImpl<>();
    aug.setResolvableStatus(UNRESOLVED);
    info.setEntityToResolve(aug);
    info = setInformationInEntity(info, aug.getParent(),
                   aug.getCharPosition(),
                   aug.getLineNumber());
    infoList.add(info);
    uses.addEntityToResolve(infoList);
  }
}

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