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

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

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

YangIfFeature介绍

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

代码示例

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

@Override
  public Object resolve() throws DataModelException {
    YangFeature feature = getReferredFeature();

    // check whether feature has if-feature
    List<YangIfFeature> ifFeatureList = feature.getIfFeatureList();
    if (ifFeatureList != null && !ifFeatureList.isEmpty()) {
      Iterator<YangIfFeature> ifFeatureIterator = ifFeatureList.iterator();
      while (ifFeatureIterator.hasNext()) {
        YangIfFeature ifFeature = ifFeatureIterator.next();
        if (ifFeature.getResolvableStatus() != ResolvableStatus.RESOLVED) {
          setResolvableStatus(ResolvableStatus.INTRA_FILE_RESOLVED);
          return null;
        }
      }
    }
    return null;
  }
}

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

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

IF_FEATURE_DATA, ctx);
YangIfFeature ifFeature = new YangIfFeature();
ifFeature.setName(nodeIdentifier);
ifFeature.setResolvableStatus(UNRESOLVED);
ifFeature.setLineNumber(ctx.getStart().getLine());
ifFeature.setCharPosition(ctx.getStart().getCharPositionInLine());
ifFeature.setFileName(listener.getFileName());
YangIfFeatureHolder ifFeatureHolder;

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

((YangIfFeature) entity).setResolvableStatus(UNDEFINED);
return;

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

/**
 * Returns if there is any unresolved if-feature in feature.
 *
 * @param node module/submodule node
 */
private void addUnResolvedIfFeatureToStack(YangNode node) {
  YangFeature refFeature = ((YangIfFeature) getCurEntityToResolveFromStack())
      .getReferredFeature();
  List<YangIfFeature> ifFeatureList = refFeature.getIfFeatureList();
  if (ifFeatureList != null && !ifFeatureList.isEmpty()) {
    Iterator<YangIfFeature> ifFeatureIterator = ifFeatureList.iterator();
    while (ifFeatureIterator.hasNext()) {
      addEntityToStack((T) ifFeatureIterator.next(), node);
    }
  }
}

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

/**
 * Returns the referenced prefix of entity under resolution.
 *
 * @return referenced prefix of entity under resolution
 * @throws DataModelException a violation in data model rule
 */
private String getRefPrefix()
    throws DataModelException {
  T entity = getCurEntityToResolveFromStack();
  if (entity instanceof YangType) {
    return ((YangType<?>) entity).getPrefix();
  }
  if (entity instanceof YangUses) {
    return ((YangUses) entity).getPrefix();
  }
  if (entity instanceof YangIfFeature) {
    return ((YangIfFeature) entity).getPrefix();
  }
  if (entity instanceof YangBase) {
    return ((YangBase) entity).getBaseIdentifier()
        .getPrefix();
  }
  if (entity instanceof YangIdentityRef) {
    return ((YangIdentityRef) entity).getPrefix();
  }
  throw new DataModelException(LINKER_ERROR);
}

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

相关文章