gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-16 02:19:31 30 4
gpt4 key购买 nike

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

YangDeviation介绍

[英]Represents deviation data represented in YANG.
[中]表示以YANG表示的偏差数据。

代码示例

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

@Override
public void detectSelfCollision(String identifierName,
                YangConstructType dataType)
    throws DataModelException {
  if (getName().equals(identifierName)) {
    throw new DataModelException(
        "YANG file error: Duplicate input identifier detected, " +
            "same as input \"" +
            getName() + " in " +
            getLineNumber() + " at " +
            getCharPosition() +
            " in " + getFileName() + "\"");
  }
}

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

YangDeviation deviation = new YangDeviation(DEVIATION_NODE, null);
deviation.setName(deviationArg);
deviation.setLineNumber(line);
deviation.setCharPosition(charPositionInLine);
deviation.setFileName(listener.getFileName());
deviation.setTargetNode(targetNode);
if (!ctx.deviateNotSupportedStatement().isEmpty()) {
  deviation.setDeviateNotSupported(true);
    new YangResolutionInfoImpl<>(deviation, deviation.getParent(),
                   line, charPositionInLine);
addToResolution(info, ctx);

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

List<YangAtomicPath> path = deviation.getTargetNode();
YangAtomicPath targetPath = path.get(path.size() - 1);
YangSchemaNode target = findDeviationTarget(entityToResolve, root,
                      xPathLinker);
if (deviation.isDeviateNotSupported()) {
  resolveDeviationNotSupported(target, targetPath);
} else {
  List<YangDeviateAdd> deviateAddList = deviation.getDeviateAdd();
      .getDeviateDelete();
  if (deviateDeleteList != null && !deviateDeleteList.isEmpty()) {
    resolveDeviateDelete(deviateDeleteList, target, targetPath);
      .getDeviateReplace();
  if (deviateReplaceList != null && !deviateReplaceList.isEmpty()) {
    resolveDeviateReplace(deviateReplaceList, target, targetPath);

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

YangDeviation firstDeviation = (YangDeviation) deviationList.get(0)
    .getEntityToResolveInfo().getEntityToResolve();
YangAtomicPath atomic = firstDeviation.getTargetNode().get(0);
prefix = atomic.getNodeIdentifier().getPrefix();
YangDeviation deviation = (YangDeviation) deviationIterator.next()
    .getEntityToResolveInfo().getEntityToResolve();
List<YangAtomicPath> targetNode = deviation.getTargetNode();
YangAtomicPath atomicPath = targetNode.get(0);
if (!atomicPath.getNodeIdentifier().getPrefix().equals(prefix)) {

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

YangNode dstNode = deviation.getParent();

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

/**
 * Performs validation and updates the data model tree. It is called when
 * parser receives an input matching the grammar rule(deviate add).
 *
 * @param listener listener's object
 * @param ctx      context object of the grammar rule
 */
public static void processDeviateAddEntry(TreeWalkListener listener,
                     GeneratedYangParser.DeviateAddStatementContext ctx) {
  // Check for stack to be non empty.
  checkStackIsNotEmpty(listener, MISSING_HOLDER, DEVIATE_ADD, null, ENTRY);
  // TODO : Validate sub-statements cardinality
  Parsable curData = listener.getParsedDataStack().peek();
  if (curData instanceof YangDeviation) {
    YangDeviation curNode = (YangDeviation) curData;
    YangDeviateAdd deviationAdd = new YangDeviateAdd();
    curNode.addDeviateAdd(deviationAdd);
    listener.getParsedDataStack().push(deviationAdd);
  } else {
    throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER,
                                DEVIATE_ADD,
                                null,
                                ENTRY));
  }
}

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

/**
 * Performs validation and updates the data model tree. It is called when
 * parser receives an input matching the grammar rule(deviate delete).
 *
 * @param listener listener's object
 * @param ctx      context object of the grammar rule
 */
public static void processDeviateDeleteEntry(TreeWalkListener listener,
                       GeneratedYangParser
                           .DeviateDeleteStatementContext ctx) {
  // Check for stack to be non empty.
  checkStackIsNotEmpty(listener, MISSING_HOLDER, DEVIATE_DELETE,
             null, ENTRY);
  // TODO : Validate sub-statements cardinality
  Parsable curData = listener.getParsedDataStack().peek();
  if (curData instanceof YangDeviation) {
    YangDeviation curNode = (YangDeviation) curData;
    YangDeviateDelete deviateDelete = new YangDeviateDelete();
    curNode.addDeviatedelete(deviateDelete);
    listener.getParsedDataStack().push(deviateDelete);
  } else {
    throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER,
                                DEVIATE_DELETE,
                                null,
                                ENTRY));
  }
}

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

/**
 * Performs validation and updates the data model tree. It is called when
 * parser receives an input matching the grammar rule(deviate replace).
 *
 * @param listener listener's object
 * @param ctx      context object of the grammar rule
 */
public static void processDeviateReplaceEntry(TreeWalkListener listener,
                       GeneratedYangParser
                           .DeviateReplaceStatementContext ctx) {
  // Check for stack to be non empty.
  checkStackIsNotEmpty(listener, MISSING_HOLDER, DEVIATE_REPLACE,
             null, ENTRY);
  // TODO : Validate sub-statements cardinality
  Parsable curData = listener.getParsedDataStack().peek();
  if (curData instanceof YangDeviation) {
    YangDeviation curNode = (YangDeviation) curData;
    YangDeviateReplace deviationReplace = new YangDeviateReplace();
    curNode.addDeviateReplace(deviationReplace);
    listener.getParsedDataStack().push(deviationReplace);
  } else {
    throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, DEVIATE_REPLACE,
                                null, ENTRY));
  }
}

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

/**
 * Returns the cloned node of deviation target node.
 *
 * @param entityToResolve entity to resolve
 * @param root            root node
 * @param xPathLinker     xpath Linker
 * @throws DataModelException if there is a data model error
 */
private YangSchemaNode findDeviationTarget(T entityToResolve,
                      YangReferenceResolver root,
                      YangXpathLinker<T> xPathLinker)
    throws DataModelException {
  YangNode targetNode;
  YangDeviation deviation = (YangDeviation) entityToResolve;
  List<YangAtomicPath> path = deviation.getTargetNode();
  targetNode = xPathLinker.processXpathLinking(path, (YangNode) root,
                         DEVIATION_LINKING);
  if (targetNode != null) {
    YangNode clonedNode = cloneDeviatedModuleNode(targetNode, deviation);
    return xPathLinker.parsePath(clonedNode);
  } else {
    throw new LinkerException(getErrorMsg(
        FAILED_TO_FIND_DEVIATION, deviation.getName(),
        deviation.getLineNumber(), deviation.getCharPosition(),
        deviation.getFileName()));
  }
}

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