gpt4 book ai didi

org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.getParent()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 15:52:40 27 4
gpt4 key购买 nike

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

YangInstanceIdentifier.getParent介绍

[英]Return the conceptual parent YangInstanceIdentifier, which has one item less in #getPathArguments().
[中]返回概念父InstanceIdentifier,它在#getPathArguments()中少了一项。

代码示例

代码示例来源:origin: opendaylight/controller

@Override
public final void exit(final int depth) {
  Preconditions.checkArgument(depth >= 0);
  YangInstanceIdentifier next = current;
  for (int i = 0; i < depth; ++i) {
    next = next.getParent();
    Preconditions.checkState(next != null);
  }
  current = next;
}

代码示例来源:origin: org.opendaylight.controller/sal-binding-broker-impl

/**
 * @deprecated Use {@link YangInstanceIdentifier#getParent()} instead.
 */
@Deprecated
protected static Optional<YangInstanceIdentifier> getParent(final YangInstanceIdentifier child) {
  return Optional.fromNullable(child.getParent());
}

代码示例来源:origin: org.opendaylight.mdsal/mdsal-binding-dom-adapter

/**
 * Use {@link YangInstanceIdentifier#getParent()} instead.
 */
@Deprecated
protected static Optional<YangInstanceIdentifier> getParent(final YangInstanceIdentifier child) {
  return Optional.ofNullable(child.getParent());
}

代码示例来源:origin: org.opendaylight.controller/sal-clustering-commons

@Override
public final void exit(final int depth) {
  Preconditions.checkArgument(depth >= 0);
  YangInstanceIdentifier next = current;
  for (int i = 0; i < depth; ++i) {
    next = next.getParent();
    Preconditions.checkState(next != null);
  }
  current = next;
}

代码示例来源:origin: io.fd.honeycomb.infra/test-tools

@Nonnull
default Optional<YangInstanceIdentifier> getNodeParent(@Nonnull final YangInstanceIdentifier identifier) {
  return Optional.ofNullable(identifier.getParent());
}

代码示例来源:origin: org.opendaylight.yangtools/yang-data-api

private static int calculateSize(final YangInstanceIdentifier parent) {
  YangInstanceIdentifier current = parent;
  for (int i = 1;; ++i) {
    final Collection<PathArgument> args = current.tryReversePathArguments();
    if (args != null) {
      return i + args.size();
    }
    verify(current instanceof StackedYangInstanceIdentifier);
    current = current.getParent();
  }
}

代码示例来源:origin: opendaylight/controller

@Override
public final void exit() {
  Preconditions.checkState(!current.isEmpty());
  current = Verify.verifyNotNull(current.getParent());
}

代码示例来源:origin: opendaylight/yangtools

private static int calculateSize(final YangInstanceIdentifier parent) {
  YangInstanceIdentifier current = parent;
  for (int i = 1;; ++i) {
    final Collection<PathArgument> args = current.tryReversePathArguments();
    if (args != null) {
      return i + args.size();
    }
    verify(current instanceof StackedYangInstanceIdentifier);
    current = current.getParent();
  }
}

代码示例来源:origin: org.opendaylight.controller/sal-clustering-commons

@Override
public final void exit() {
  Preconditions.checkState(!current.isEmpty());
  current = Verify.verifyNotNull(current.getParent());
}

代码示例来源:origin: org.opendaylight.yangtools/yang-data-api

@Nonnull
@Override
public YangInstanceIdentifier getAncestor(final int depth) {
  checkArgument(depth >= 0, "Steps cannot be negative");
  // Calculate how far up our FixedYangInstanceIdentifier ancestor is
  int stackedDepth = 1;
  YangInstanceIdentifier wlk = getParent();
  while (wlk instanceof StackedYangInstanceIdentifier) {
    wlk = wlk.getParent();
    stackedDepth++;
  }
  // Guaranteed to come from FixedYangInstanceIdentifier
  final int fixedDepth = wlk.getPathArguments().size();
  if (fixedDepth >= depth) {
    return wlk.getAncestor(depth);
  }
  // Calculate our depth and check argument
  final int ourDepth = stackedDepth + fixedDepth;
  checkArgument(depth <= ourDepth, "Depth %s exceeds maximum depth %s", depth, ourDepth);
  // Requested depth is covered by the stack, traverse up for specified number of steps
  final int toWalk = ourDepth - depth;
  YangInstanceIdentifier result = this;
  for (int i = 0; i < toWalk; ++i) {
    result = result.getParent();
  }
  return result;
}

代码示例来源:origin: opendaylight/yangtools

@Nonnull
@Override
public YangInstanceIdentifier getAncestor(final int depth) {
  checkArgument(depth >= 0, "Steps cannot be negative");
  // Calculate how far up our FixedYangInstanceIdentifier ancestor is
  int stackedDepth = 1;
  YangInstanceIdentifier wlk = getParent();
  while (wlk instanceof StackedYangInstanceIdentifier) {
    wlk = wlk.getParent();
    stackedDepth++;
  }
  // Guaranteed to come from FixedYangInstanceIdentifier
  final int fixedDepth = wlk.getPathArguments().size();
  if (fixedDepth >= depth) {
    return wlk.getAncestor(depth);
  }
  // Calculate our depth and check argument
  final int ourDepth = stackedDepth + fixedDepth;
  checkArgument(depth <= ourDepth, "Depth %s exceeds maximum depth %s", depth, ourDepth);
  // Requested depth is covered by the stack, traverse up for specified number of steps
  final int toWalk = ourDepth - depth;
  YangInstanceIdentifier result = this;
  for (int i = 0; i < toWalk; ++i) {
    result = result.getParent();
  }
  return result;
}

代码示例来源:origin: org.opendaylight.bgpcep/bgp-rib-impl

if (!routeTableIdentifier.equals(childIdentifier.getParent().getParent().getParent())) {
  processRoutesTable(child, childIdentifier, tx, routeTableIdentifier);
  break;

代码示例来源:origin: org.opendaylight.controller/sal-distributed-datastore

public static String entityTypeFromEntityPath(YangInstanceIdentifier entityPath){
  YangInstanceIdentifier parent = entityPath;
  while(!parent.isEmpty()) {
    if (EntityType.QNAME.equals(parent.getLastPathArgument().getNodeType())) {
      YangInstanceIdentifier.NodeIdentifierWithPredicates entityTypeLastPathArgument = (YangInstanceIdentifier.NodeIdentifierWithPredicates) parent.getLastPathArgument();
      return (String) entityTypeLastPathArgument.getKeyValues().get(ENTITY_TYPE_QNAME);
    }
    parent = parent.getParent();
  }
  return null;
}

代码示例来源:origin: org.opendaylight.controller/sal-binding-broker-impl

final Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> normalized) {
if (Identifiable.class.isAssignableFrom(path.getTargetType())) {
  YangInstanceIdentifier parentMapPath = normalized.getKey().getParent();
  Preconditions.checkArgument(parentMapPath != null, "Map path %s does not have a parent", path);

代码示例来源:origin: org.opendaylight.mdsal/mdsal-binding2-dom-adapter

final Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> normalized) {
if (IdentifiableItem.class.isAssignableFrom(path.getTargetType())) {
  final YangInstanceIdentifier parentMapPath = normalized.getKey().getParent();
  Preconditions.checkArgument(parentMapPath != null, "Map path %s does not have a parent", path);

代码示例来源:origin: opendaylight/yangtools

private static void applyToCursorAwareModification(final CursorAwareDataTreeModification modification,
    final DataTreeCandidate candidate) {
  final YangInstanceIdentifier candidatePath = candidate.getRootPath();
  if (candidatePath.isEmpty()) {
    try (DataTreeModificationCursor cursor = modification.openCursor()) {
      DataTreeCandidateNodes.applyRootToCursor(cursor, candidate.getRootNode());
    }
  } else {
    try (DataTreeModificationCursor cursor = modification.openCursor(candidatePath.getParent()).get()) {
      DataTreeCandidateNodes.applyRootedNodeToCursor(cursor, candidatePath, candidate.getRootNode());
    }
  }
}

代码示例来源:origin: org.opendaylight.yangtools/yang-data-api

private static void applyToCursorAwareModification(final CursorAwareDataTreeModification modification,
    final DataTreeCandidate candidate) {
  final YangInstanceIdentifier candidatePath = candidate.getRootPath();
  if (candidatePath.isEmpty()) {
    try (DataTreeModificationCursor cursor = modification.openCursor()) {
      DataTreeCandidateNodes.applyRootToCursor(cursor, candidate.getRootNode());
    }
  } else {
    try (DataTreeModificationCursor cursor = modification.openCursor(candidatePath.getParent()).get()) {
      DataTreeCandidateNodes.applyRootedNodeToCursor(cursor, candidatePath, candidate.getRootNode());
    }
  }
}

代码示例来源:origin: org.opendaylight.mdsal/mdsal-binding-dom-adapter

/**
 * Subclasses of this class are required to implement creation of parent nodes based on behaviour of their
 * underlying transaction.
 *
 * @param store an instance of LogicalDatastoreType
 * @param domPath an instance of YangInstanceIdentifier
 * @param path an instance of InstanceIdentifier
 */
protected final void ensureParentsByMerge(final LogicalDatastoreType store, final YangInstanceIdentifier domPath,
    final InstanceIdentifier<?> path) {
  final YangInstanceIdentifier parentPath = domPath.getParent();
  if (parentPath != null) {
    final NormalizedNode<?, ?> parentNode = getCodec().instanceIdentifierToNode(parentPath);
    getDelegate().merge(store, YangInstanceIdentifier.create(parentNode.getIdentifier()), parentNode);
  }
}

代码示例来源:origin: org.opendaylight.mdsal/mdsal-binding2-dom-adapter

/**
 * Subclasses of this class are required to implement creation of parent nodes based on behavior of their
 * underlying transaction.
 *
 * @param store
 *            - an instance of LogicalDatastoreType
 * @param domPath
 *            - an instance of YangInstanceIdentifier
 * @param path
 *            - an instance of InstanceIdentifier
 */
protected final void ensureParentsByMerge(final LogicalDatastoreType store, final YangInstanceIdentifier domPath,
    final InstanceIdentifier<?> path) {
  final YangInstanceIdentifier parentPath = domPath.getParent();
  if (parentPath != null) {
    final NormalizedNode<?, ?> parentNode = getCodec().instanceIdentifierToNode(parentPath);
    getDelegate().merge(store, YangInstanceIdentifier.create(parentNode.getIdentifier()), parentNode);
  }
}

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