gpt4 book ai didi

org.onosproject.yangutils.datamodel.YangDerivedInfo类的使用及代码示例

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

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

YangDerivedInfo介绍

[英]Represents the derived information.
[中]表示派生的信息。

代码示例

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

YangType<?> baseType = getReferredTypeDef().getTypeDefBaseType();
YangDataTypes type = baseType.getDataType();
T extended = (T) baseType.getDataTypeExtendedInfo();
  ResolvableStatus resolvableStatus = resolveTypeDerivedInfo(baseType);
  if (resolvableStatus != null) {
    return resolvableStatus;
    return getResolveStatusForRangeRestrictionType(extended);
  } else if (effectiveBuiltInType == STRING) {
    return getResolveStatusForString(extended);
  } else if (effectiveBuiltInType == BINARY) {
    return getResolveStatusForBinary(extended);
  } else if (effectiveBuiltInType == DECIMAL64) {
    return getResolveStatusForDecimal64(extended);
  if (isNullOrEmpty(getLengthRestrictionString()) &&
      isNullOrEmpty(getRangeRestrictionString()) &&
      getPatternRestriction() == null) {
    return RESOLVED;
  } else {
    throw new DataModelException(getErrorMsg(
        "YANG file error: Restrictions can't be applied to a " +
            "given type ", "type.", getLineNumber(),
        getCharPosition(), getFileName() + "\""));
    getLineNumber(), getCharPosition(), getFileName() + "\""));

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

throwError();
if (getReferredTypeDef().getTypeDefBaseType()
    .getResolvableStatus() == INTRA_FILE_RESOLVED) {
  return INTRA_FILE_RESOLVED;
    .getDataTypeExtendedInfo()).getEffectiveBuiltInType();
YangDerivedInfo refDerivedInfo = (YangDerivedInfo<?>) baseType.getDataTypeExtendedInfo();
T extendedInfo = (T) refDerivedInfo.getResolvedExtendedInfo();
  return getResolveStatusForRangeRestrictionType(extendedInfo);
} else if (effectiveBuiltInType == STRING) {
  return getResolveStatusForString(extendedInfo);
} else if (effectiveBuiltInType == BINARY) {
  return getResolveStatusForBinary(extendedInfo);
} else if (effectiveBuiltInType == DECIMAL64) {
  if (extendedInfo == null) {
    resolveRangeRestriction(null);
  } else {
    if (!(extendedInfo instanceof YangRangeRestriction)) {
      throwError();
    resolveRangeRestriction((YangRangeRestriction) extendedInfo);

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

private void throwError() throws DataModelException {
  throw new DataModelException(getErrorMsg(
      "Linker error: Referred typedef restriction info is of invalid ",
      "type.", getLineNumber(), getCharPosition(), getFileName() + "\""));
}

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

/**
 * Resolves the binary restrictions.
 *
 * @param refLr referred length restriction of typedef
 * @throws DataModelException a violation in data model rule
 */
private void resolveBinaryRestriction(YangRangeRestriction refLr)
    throws DataModelException {
  if (rangeRestrictionString != null || patternRestriction != null) {
    throw new DataModelException(getErrorMsg(
        "YANG file error: for binary range restriction or pattern " +
            "restriction is not allowed.", "type.",
        getLineNumber(), getCharPosition(), getFileName()));
  }
  // Get the final resolved length restriction
  YangRangeRestriction lr = resolveLengthRestriction(refLr);
  // Set the length restriction.
  resolvedExtendedInfo = (T) lr;
}

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

if (refLenRestriction == null && isNullOrEmpty(getLengthRestrictionString())) {
  return null;
if (isNullOrEmpty(getLengthRestrictionString())) {
  return refLenRestriction;
      null, getLineNumber(), getCharPosition(), false,
      getLengthRestrictionString(), getFileName());
    processLengthRestriction(refLenRestriction, getLineNumber(),
                 getCharPosition(), true,
                 getLengthRestrictionString(), getFileName());
resolveLengthAndRangeRestriction(refLenRestriction, curLengthRestriction);
return curLengthRestriction;

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

if (!isNullOrEmpty(getRangeRestrictionString())) {
  throw new DataModelException(getErrorMsg(
      "YANG file error: Range restriction should't be present for" +
          " string data type.", ".", getLineNumber(),
      getCharPosition(), getFileName()));
if (refSr == null && isNullOrEmpty(getLengthRestrictionString()) &&
    getPatternRestriction() == null) {
  return;
YangRangeRestriction lr = resolveLengthRestriction(refRr);
YangPatternRestriction pr = resolvePatternRestriction(refPr);
  curSr.setCharPosition(getCharPosition());
  curSr.setFileName(getFileName());
  curSr.setLineNumber(getLineNumber());
  curSr.setLengthRestriction(lr);
  curSr.setPatternRestriction(pr);

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

if (!isNullOrEmpty(getLengthRestrictionString())
    || getPatternRestriction() != null) {
  throw new DataModelException(getErrorMsg(
      "YANG file error: Length/Pattern restriction should't be present" +
          " for int/uint/decimal data type.", "type.", getLineNumber(),
      getCharPosition(), getFileName()));
if (refRangeRestriction == null && isNullOrEmpty(getRangeRestrictionString())) {
  return;
if (isNullOrEmpty(getRangeRestrictionString())) {
  resolvedExtendedInfo = (T) refRangeRestriction;
  return;
      processRangeRestriction(null, getLineNumber(),
                  getCharPosition(), false, getRangeRestrictionString(),
                  effectiveBuiltInType, getFileName());
  resolvedExtendedInfo = (T) curRangeRestriction;
  return;
    processRangeRestriction(refRangeRestriction, getLineNumber(),
                getCharPosition(), true,
                getRangeRestrictionString(),
                effectiveBuiltInType, getFileName());
resolveLengthAndRangeRestriction(refRangeRestriction, curRangeRestriction);
resolvedExtendedInfo = (T) curRangeRestriction;

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

if (extended != null) {
  if (((YangDecimal64) extended).getRangeRestrictedExtendedInfo() == null) {
    resolveRangeRestriction(null);
    if (!(((YangDecimal64) extended)
        .getRangeRestrictedExtendedInfo() instanceof YangRangeRestriction)) {
      throwError();
    resolveRangeRestriction((YangRangeRestriction) (
        (YangDecimal64) extended).getRangeRestrictedExtendedInfo());
  throw new DataModelException(getErrorMsg(
      "Linker error: Unable to find type extended info " +
          "for decimal64.", "type.", getLineNumber(),
      getCharPosition(), getFileName() + "\""));

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

YangDerivedInfo<?> yangDerivedInfo = new YangDerivedInfo<>();
yangDerivedInfo.setLineNumber(ctx.getStart().getLine());
yangDerivedInfo.setCharPosition(ctx.getStart().getCharPositionInLine());
yangDerivedInfo.setFileName(listener.getFileName());
((YangType<YangDerivedInfo>) type).setDataTypeExtendedInfo(yangDerivedInfo);
YangDerivedInfo<?> yangDerivedInfo = new YangDerivedInfo<>();
yangDerivedInfo.setLineNumber(ctx.getStart().getLine());
yangDerivedInfo.setCharPosition(ctx.getStart().getCharPositionInLine());
yangDerivedInfo.setFileName(listener.getFileName());
((YangType<YangDerivedInfo>) type).setDataTypeExtendedInfo(yangDerivedInfo);
YangDerivedInfo<?> yangDerivedInfo = new YangDerivedInfo<>();
yangDerivedInfo.setLineNumber(ctx.getStart().getLine());
yangDerivedInfo.setCharPosition(ctx.getStart().getCharPositionInLine());
yangDerivedInfo.setFileName(listener.getFileName());
((YangType<YangDerivedInfo>) type).setDataTypeExtendedInfo(yangDerivedInfo);
YangDerivedInfo<?> yangDerivedInfo = new YangDerivedInfo<>();
yangDerivedInfo.setLineNumber(ctx.getStart().getLine());
yangDerivedInfo.setCharPosition(ctx.getStart().getCharPositionInLine());
yangDerivedInfo.setFileName(listener.getFileName());
((YangType<YangDerivedInfo>) type).setDataTypeExtendedInfo(yangDerivedInfo);

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

YangDataTypes dataType = ((YangDerivedInfo) getDataTypeExtendedInfo()).getEffectiveBuiltInType();
if (isOfRangeRestrictedType(dataType)) {
  if (((YangDerivedInfo) getDataTypeExtendedInfo()).getResolvedExtendedInfo() == null) {
    getDataObjectFromString(value,
                ((YangDerivedInfo) getDataTypeExtendedInfo())
                    .getEffectiveBuiltInType());
  } else {
    if (!((YangRangeRestriction) ((YangDerivedInfo) getDataTypeExtendedInfo())
        .getResolvedExtendedInfo()).isValidValueString(value)) {
      throw new DataTypeException("YANG file error : Input value \"" + value
                        + "\" is not a valid " + dataType);
      .getResolvedExtendedInfo();
  if (info != null) {
    if (info instanceof YangStringRestriction) {
      .getReferredTypeDef();
  YangType type = prevTypedef.getTypeList().iterator().next();
  YangBits bits = (YangBits) type.getDataTypeExtendedInfo();
      getDataTypeExtendedInfo()).getResolvedExtendedInfo())) {
    throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " +
                      dataType);
  YangTypeDef typedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
  YangType<YangDecimal64> decimal64Type =
      (YangType<YangDecimal64>) typedef.getTypeList().iterator().next();

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

} else {
  YangPatternRestriction patternRestriction = ((YangDerivedInfo<?>) type
      .getDataTypeExtendedInfo()).getPatternRestriction();
  if (patternRestriction == null) {
    patternRestriction = new YangPatternRestriction();
    ((YangDerivedInfo<?>) type.getDataTypeExtendedInfo()).setPatternRestriction(patternRestriction);
    patternRestriction.addPattern(patternArgument);
  } else {
    ((YangDerivedInfo<?>) type.getDataTypeExtendedInfo()).setPatternRestriction(patternRestriction);
    patternRestriction.addPattern(patternArgument);

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

if (refPr == null && getPatternRestriction() == null) {
  return null;
if (getPatternRestriction() == null) {
  return refPr;
  return getPatternRestriction();
  getPatternRestriction().addPattern(pattern);
return getPatternRestriction();

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

case DERIVED:
  return ((YangDerivedInfo) dataType.getDataTypeExtendedInfo())
      .getEffectiveBuiltInType().equals(EMPTY);
  if (type.getDataType() == YangDataTypes.DERIVED) {
    return ((YangDerivedInfo) type.getDataTypeExtendedInfo())
        .getEffectiveBuiltInType().equals(EMPTY);

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

/**
 * Resolves the length/range self and referred restriction, to check whether
 * the all the range interval in self restriction is stricter than the
 * referred typedef's restriction.
 *
 * @param refRestriction referred restriction
 * @param curRestriction self restriction
 */
private void resolveLengthAndRangeRestriction(YangRangeRestriction refRestriction,
                       YangRangeRestriction curRestriction)
    throws DataModelException {
  for (Object curInterval : curRestriction.getAscendingRangeIntervals()) {
    if (!(curInterval instanceof YangRangeInterval)) {
      throw new DataModelException(getErrorMsg(
          "Linker error: Current range intervals not processed correctly.",
          "type.", getLineNumber(), getCharPosition(), getFileName()));
    }
    try {
      refRestriction.isValidInterval((YangRangeInterval)
                          curInterval, getFileName());
    } catch (DataModelException e) {
      throw new DataModelException(getErrorMsg(
          e.getMessage(), "type.", getLineNumber(), getCharPosition(),
          getFileName()));
    }
  }
}

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