static FixedYangInstanceIdentifier create(final Iterable<? extends PathArgument> path, final int hash) { return new FixedYangInstanceIdentifier(ImmutableList.copyOf(path), hash); }
@Override public YangInstanceIdentifier build() { return FixedYangInstanceIdentifier.create(path, hash.build()); } }
@Nonnull @Override public YangInstanceIdentifier getAncestor(final int depth) { checkArgument(depth >= 0, "Negative depth is not allowed"); checkArgument(depth <= path.size(), "Depth %s exceeds maximum depth %s", depth, path.size()); if (depth == path.size()) { return this; } if (depth == path.size() - 1) { // Use the parent cache return getParent(); } return YangInstanceIdentifier.create(path.subList(0, depth)); }
@Nonnull @Override public YangInstanceIdentifier getAncestor(final int depth) { checkArgument(depth >= 0, "Negative depth is not allowed"); checkArgument(depth <= path.size(), "Depth %s exceeds maximum depth %s", depth, path.size()); if (depth == path.size()) { return this; } if (depth == path.size() - 1) { // Use the parent cache return getParent(); } return YangInstanceIdentifier.create(path.subList(0, depth)); }
@Override public YangInstanceIdentifier toOptimized() { return FixedYangInstanceIdentifier.create(getPathArguments()); } }
static FixedYangInstanceIdentifier create(final Iterable<? extends PathArgument> path, final int hash) { return new FixedYangInstanceIdentifier(ImmutableList.copyOf(path), hash); }
@Override public YangInstanceIdentifier build() { return FixedYangInstanceIdentifier.create(path, hash.build()); } }
@Nonnull @Override YangInstanceIdentifier createRelativeIdentifier(final int skipFromRoot) { if (skipFromRoot == path.size()) { return EMPTY_INSTANCE; } final ImmutableList<PathArgument> newPath = path.subList(skipFromRoot, path.size()); final HashCodeBuilder<PathArgument> hash = new HashCodeBuilder<>(); for (PathArgument a : newPath) { hash.addArgument(a); } return new FixedYangInstanceIdentifier(newPath, hash.build()); }
@Override public YangInstanceIdentifier toOptimized() { return FixedYangInstanceIdentifier.create(getPathArguments()); } }
@Nonnull @Override YangInstanceIdentifier createRelativeIdentifier(final int skipFromRoot) { if (skipFromRoot == path.size()) { return EMPTY_INSTANCE; } final ImmutableList<PathArgument> newPath = path.subList(skipFromRoot, path.size()); final HashCodeBuilder<PathArgument> hash = new HashCodeBuilder<>(); for (PathArgument a : newPath) { hash.addArgument(a); } return new FixedYangInstanceIdentifier(newPath, hash.build()); }
private void writeObject(final ObjectOutputStream outputStream) throws IOException { outputStream.defaultWriteObject(); final FixedYangInstanceIdentifier p; if (parent instanceof FixedYangInstanceIdentifier) { p = (FixedYangInstanceIdentifier) parent; } else { p = FixedYangInstanceIdentifier.create(parent.getPathArguments(), parent.hashCode()); } outputStream.writeObject(p); }
private void writeObject(final ObjectOutputStream outputStream) throws IOException { outputStream.defaultWriteObject(); final FixedYangInstanceIdentifier p; if (parent instanceof FixedYangInstanceIdentifier) { p = (FixedYangInstanceIdentifier) parent; } else { p = FixedYangInstanceIdentifier.create(parent.getPathArguments(), parent.hashCode()); } outputStream.writeObject(p); }
public static YangInstanceIdentifier create(final Iterable<? extends PathArgument> path) { if (Iterables.isEmpty(path)) { return EMPTY; } final HashCodeBuilder<PathArgument> hash = new HashCodeBuilder<>(); for (PathArgument a : path) { hash.addArgument(a); } return FixedYangInstanceIdentifier.create(path, hash.build()); }
public static YangInstanceIdentifier create(final Iterable<? extends PathArgument> path) { if (Iterables.isEmpty(path)) { return EMPTY; } final HashCodeBuilder<PathArgument> hash = new HashCodeBuilder<>(); for (PathArgument a : path) { hash.addArgument(a); } return FixedYangInstanceIdentifier.create(path, hash.build()); }