gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-19 13:57:31 25 4
gpt4 key购买 nike

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

YangStringRestriction介绍

[英]Represents the restriction for string data type.
[中]表示字符串数据类型的限制。

代码示例

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

refRr = refSr.getLengthRestriction();
refPr = refSr.getPatternRestriction();
curSr = new YangStringRestriction();
curSr.setCharPosition(getCharPosition());
curSr.setFileName(getFileName());
curSr.setLineNumber(getLineNumber());
curSr.setLengthRestriction(lr);
curSr.setPatternRestriction(pr);

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

/**
 * Validates if the given value is correct as per the length restriction.
 *
 * @param valueInString value
 * @return true, if the value is confirming to length restriction, false otherwise
 */
boolean isValidStringOnLengthRestriction(String valueInString) {
  if (lengthRestriction == null || lengthRestriction.getAscendingRangeIntervals() == null
      || lengthRestriction.getAscendingRangeIntervals().isEmpty()) {
    // Length restriction is optional
    return true;
  }
  ListIterator<YangRangeInterval<YangUint64>> rangeListIterator =
      lengthRestriction.getAscendingRangeIntervals().listIterator();
  boolean isMatched = false;
  while (rangeListIterator.hasNext()) {
    YangRangeInterval rangeInterval = rangeListIterator.next();
    rangeInterval.setCharPosition(getCharPosition());
    rangeInterval.setLineNumber(getLineNumber());
    rangeInterval.setFileName(getFileName());
    BigInteger startValue = ((YangUint64) rangeInterval.getStartValue()).getValue();
    BigInteger endValue = ((YangUint64) rangeInterval.getEndValue()).getValue();
    if (valueInString.length() >= startValue.intValue() &&
        valueInString.length() <= endValue.intValue()) {
      isMatched = true;
      break;
    }
  }
  return isMatched;
}

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

YangStringRestriction stringRestriction = (YangStringRestriction) type.getDataTypeExtendedInfo();
  if (stringRestriction == null) {
    stringRestriction = new YangStringRestriction();
    stringRestriction.setFileName(listener.getFileName());
    stringRestriction.setCharPosition(ctx.getStart().getCharPositionInLine());
    stringRestriction.setLineNumber(ctx.getStart().getLine());
    type.setDataTypeExtendedInfo(stringRestriction);
  stringRestriction.setLengthRestriction(lengthRestriction);
} else {
  type.setDataTypeExtendedInfo(lengthRestriction);

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

YangStringRestriction stringRestriction = (YangStringRestriction) type.getDataTypeExtendedInfo();
if (stringRestriction == null) {
  stringRestriction = new YangStringRestriction();
  stringRestriction.setFileName(listener.getFileName());
  stringRestriction.setCharPosition(ctx.getStart().getCharPositionInLine());
  stringRestriction.setLineNumber(ctx.getStart().getLine());
  type.setDataTypeExtendedInfo(stringRestriction);
  stringRestriction.addPattern(patternArgument);
} else {
  stringRestriction.addPattern(patternArgument);

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