import com.google.common.collect.Collections2;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
-import com.google.common.collect.Iterators;
import java.util.ArrayDeque;
import java.util.Collection;
import java.util.Iterator;
import org.opendaylight.yangtools.yang.model.api.PathExpression.DerefSteps;
import org.opendaylight.yangtools.yang.model.api.PathExpression.LocationPathSteps;
import org.opendaylight.yangtools.yang.model.api.PathExpression.Steps;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
import org.opendaylight.yangtools.yang.model.api.SchemaTreeInference;
import org.opendaylight.yangtools.yang.model.api.TypeAware;
import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
* is conceptually a stack, tracking {@link EffectiveStatement}s encountered along traversal.
*
* <p>
- * This is meant to be a replacement concept for the use of {@link SchemaPath} in various places, notably
- * in {@link SchemaContextUtil} methods.
- *
- * <p>
* This class is designed for single-threaded uses and does not make any guarantees around concurrent access.
*/
@Beta
return ret;
}
- /**
- * Create a new stack backed by an effective model, pointing to specified schema node identified by an absolute
- * {@link SchemaPath} and its {@link SchemaPath#getPathFromRoot()} interpreted as a schema node identifier.
- *
- * @param effectiveModel EffectiveModelContext to which this stack is attached
- * @return A new stack
- * @throws NullPointerException {@code effectiveModel} is null
- * @throws IllegalArgumentException if {@code path} cannot be resolved in the effective model or if it is not an
- * absolute path.
- */
- @Deprecated(since = "7.0.0", forRemoval = true)
- public static @NonNull SchemaInferenceStack ofInstantiatedPath(final EffectiveModelContext effectiveModel,
- final SchemaPath path) {
- checkArgument(path.isAbsolute(), "Cannot operate on relative path %s", path);
- final SchemaInferenceStack ret = new SchemaInferenceStack(effectiveModel);
- path.getPathFromRoot().forEach(ret::enterSchemaTree);
- return ret;
- }
-
- /**
- * Create a new stack backed by an effective model, pointing to specified schema node identified by an absolute
- * {@link SchemaPath} and its {@link SchemaPath#getPathFromRoot()}, interpreted as a series of steps along primarily
- * schema tree, with grouping namespace being the alternative lookup.
- *
- * @param effectiveModel EffectiveModelContext to which this stack is attached
- * @return A new stack
- * @throws NullPointerException {@code effectiveModel} is null
- * @throws IllegalArgumentException if {@code path} cannot be resolved in the effective model or if it is not an
- * absolute path.
- */
- @Deprecated(since = "7.0.2", forRemoval = true)
- public static @NonNull SchemaInferenceStack ofSchemaPath(final EffectiveModelContext effectiveModel,
- final SchemaPath path) {
- checkArgument(path.isAbsolute(), "Cannot operate on relative path %s", path);
- final SchemaInferenceStack ret = new SchemaInferenceStack(effectiveModel);
-
- for (QName step : path.getPathFromRoot()) {
- try {
- ret.enterSchemaTree(step);
- } catch (IllegalArgumentException schemaEx) {
- try {
- ret.enterGrouping(step);
- } catch (IllegalArgumentException ex) {
- ex.addSuppressed(schemaEx);
- throw ex;
- }
- }
- }
-
- return ret;
- }
-
@Override
public EffectiveModelContext getEffectiveModelContext() {
return effectiveModel;
return Absolute.of(simplePathFromRoot());
}
- /**
- * Convert current state into a SchemaPath.
- *
- * @return Absolute SchemaPath representing current state
- * @throws IllegalStateException if current state is not instantiated
- * @deprecated This method is meant only for interoperation with SchemaPath-based APIs.
- */
- @Deprecated(since = "5.0.0", forRemoval = true)
- public @NonNull SchemaPath toSchemaPath() {
- return SchemaPath.create(simplePathFromRoot(), true);
- }
-
- /**
- * Return an iterator along {@link SchemaPath#getPathFromRoot()}. This method is a faster equivalent of
- * {@code toSchemaPath().getPathFromRoot().iterator()}.
- *
- * @return An unmodifiable iterator
- * @deprecated Use {@link #toSchemaTreeInference()} instead.
- */
- @Deprecated(since = "5.0.0", forRemoval = true)
- public @NonNull Iterator<QName> schemaPathIterator() {
- return Iterators.unmodifiableIterator(simplePathFromRoot().iterator());
- }
-
@Override
public String toString() {
return MoreObjects.toStringHelper(this).add("path", deque).toString();