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

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

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

YangEnum介绍

[英]Represents the ENUM data type information.
[中]表示枚举数据类型信息。

代码示例

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

@Override
  public int compareTo(YangEnum otherEnum) {
    if (namedValue.equals(otherEnum.getNamedValue())) {
      return 0;
    }
    return new Integer(value).compareTo(otherEnum.getValue());
  }
}

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

/**
 * It is called when parser enters grammar rule (enum), it perform
 * validations and updates the data model tree.
 *
 * @param listener listener's object
 * @param ctx      context object of the grammar rule
 */
public static void processEnumEntry(TreeWalkListener listener, GeneratedYangParser.EnumStatementContext ctx) {
  // Check for stack to be non empty.
  checkStackIsNotEmpty(listener, MISSING_HOLDER, ENUM_DATA, ctx.string().getText(), ENTRY);
  YangEnum enumNode = new YangEnum();
  enumNode.setNamedValue(getValidNamedValue(ctx.string().getText()));
  enumNode.setLineNumber(ctx.getStart().getLine());
  enumNode.setCharPosition(ctx.getStart().getCharPositionInLine());
  enumNode.setFileName(listener.getFileName());
  listener.getParsedDataStack().push(enumNode);
}

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

if (curEnum.getValue() == Integer.MAX_VALUE) {
    ParserException parserException = new ParserException("YANG file error : "
        + "An enum value MUST be specified for enum substatements following the one"
    parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
    throw parserException;
  } else if (maxValue <= curEnum.getValue()) {
    maxValue = curEnum.getValue();
    isValuePresent = true;
  maxValue++;
((YangEnum) tmpEnumNode).setValue(maxValue);

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

YangEnumeration yangEnumeration = (YangEnumeration) tmpNode;
for (YangEnum curEnum : yangEnumeration.getEnumSet()) {
  if (value == curEnum.getValue()) {
    listener.getParsedDataStack().push(enumNode);
    return false;

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

throw parserException;
enumNode.setValue(value);
break;

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

while (iterator.hasNext()) {
  YangEnum enumTemp = iterator.next();
  if (enumTemp.getNamedValue().equals(value)) {
    isValidated = true;
    break;

相关文章

YangEnum类方法