gpt4 book ai didi

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

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

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

YangChoice介绍

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

代码示例

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

@Override
public void detectSelfCollision(String identifierName,
                YangConstructType dataType)
    throws DataModelException {
  if (dataType == CHOICE_DATA) {
    if (getName().equals(identifierName)) {
      throw new DataModelException(
          getErrorMsgCollision(COLLISION_DETECTION, getName(),
                     getLineNumber(), getCharPosition(),
                     CHOICE, getFileName()));
    }
    return;
  }
  YangNode node = getChild();
  while (node != null) {
    if (node instanceof CollisionDetector) {
      ((CollisionDetector) node)
          .detectSelfCollision(identifierName, dataType);
    }
    node = node.getNextSibling();
  }
}

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

@Override
public void setNameSpaceAndAddToParentSchemaMap() {
  // Get parent namespace and set namespace for self node.
  setNameSpace(getParent().getNameSpace());
}

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

@Override
public void detectCollidingChild(String idName, YangConstructType type)
    throws DataModelException {
  if (getParent() instanceof YangCase && type != CASE_DATA) {
    ((CollisionDetector) getParent()).detectCollidingChild(idName, type);
  }
  YangNode node = getChild();
  while (node != null) {
    if (node instanceof CollisionDetector) {
      ((CollisionDetector) node).detectSelfCollision(idName, type);
    }
    node = node.getNextSibling();
  }
}

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

choiceNode.setName(identifier);
choiceNode.setLineNumber(line);
choiceNode.setCharPosition(charPositionInLine);
choiceNode.setFileName(listener.getFileName());
  choiceNode.setConfig(parentConfig);

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

@Override
public void addToChildSchemaMap(YangSchemaNodeIdentifier id,
                YangSchemaNodeContextInfo context)
    throws DataModelException {
  getYsnContextInfoMap().put(id, context);
  YangSchemaNodeContextInfo contextInfo =
      new YangSchemaNodeContextInfo();
  contextInfo.setSchemaNode(context.getSchemaNode());
  contextInfo.setContextSwitchedNode(this);
  getParent().addToChildSchemaMap(id, contextInfo);
}

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

/**
 * Validates the data on exiting the corresponding parse tree node.
 *
 * @throws DataModelException a violation of data model rules
 */
@Override
public void validateDataOnExit()
    throws DataModelException {
  if (defaultValueInString != null && !defaultValueInString.isEmpty()) {
    YangNode node = getChild();
    boolean matched = false;
    // Check whether default string matches the case
    while (node != null) {
      if (node instanceof YangCase) {
        if (defaultValueInString.equals(node.getName())) {
          matched = true;
          break;
        }
      }
      node = node.getNextSibling();
    }
    if (!matched) {
      throw new DataModelException(
          "YANG file error: default string \"" +
              defaultValueInString + "\" not matching choice \"" +
              getName() + "\" case.");
    }
  }
}

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

/**
 * Returns parent node config value, if top node does not specify a config
 * statement then default value true is returned.
 *
 * @param listener listener's object
 * @return true/false parent's config value
 */
public static boolean getParentNodeConfig(TreeWalkListener listener) {
  Parsable curData = listener.getParsedDataStack().peek();
  YangNode parentNode = ((YangNode) curData).getParent();
  if (curData instanceof YangConfig) {
    return ((YangConfig) curData).isConfig();
  } else if (curData instanceof YangRpc || curData instanceof YangOutput
      || curData instanceof YangInput || curData instanceof YangNotification) {
    return false;
  } else if (curData instanceof YangCase && parentNode instanceof YangChoice) {
    return ((YangChoice) parentNode).isConfig();
  } else {
    return true;
  }
}

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

((YangChoice) listener.getParsedDataStack().peek()).addChild(caseNode);
} catch (DataModelException e) {
  throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,

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