import static java.util.Objects.requireNonNull;
-import com.google.common.collect.ImmutableList;
import java.util.Collection;
+import java.util.List;
import java.util.Optional;
-import java.util.stream.Stream;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
-import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
+import org.opendaylight.yangtools.yang.parser.spi.meta.CopyHistory;
+import org.opendaylight.yangtools.yang.parser.spi.meta.CopyType;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ModelProcessingPhase;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.StorageNodeType;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.source.StatementSourceReference;
* designated source.
*/
final class ReplicaStatementContext<A, D extends DeclaredStatement<A>, E extends EffectiveStatement<A, D>>
- extends StatementContextBase<A, D, E> {
+ extends ReactorStmtCtx<A, D, E> {
private final StatementContextBase<?, ?, ?> parent;
- private final StatementContextBase<A, D, E> source;
+ private final ReactorStmtCtx<A, D, E> source;
- ReplicaStatementContext(final StatementContextBase<?, ?, ?> parent, final StatementContextBase<A, D, E> source) {
+ ReplicaStatementContext(final StatementContextBase<?, ?, ?> parent, final ReactorStmtCtx<A, D, E> source) {
super(source);
this.parent = requireNonNull(parent);
this.source = requireNonNull(source);
if (source.isSupportedToBuildEffective()) {
source.incRef();
+ // FIXME: is this call really needed? it is inherited from source
setFullyDefined();
- } else {
- setIsSupportedToBuildEffective(false);
}
}
}
@Override
- public boolean isConfiguration() {
- return source.isConfiguration();
+ public EffectiveConfig effectiveConfig() {
+ return source.effectiveConfig();
}
@Override
- public D buildDeclared() {
- return source.buildDeclared();
+ public D declared() {
+ return source.declared();
}
@Override
}
@Override
- boolean hasEmptySubstatements() {
- return source.hasEmptySubstatements();
+ public ModelProcessingPhase getCompletedPhase() {
+ return source.getCompletedPhase();
}
@Override
- Iterable<StatementContextBase<?, ?, ?>> effectiveChildrenToComplete() {
- return ImmutableList.of();
+ public CopyHistory history() {
+ return source.history();
}
@Override
- int sweepSubstatements() {
- if (fullyDefined()) {
- source.decRef();
- }
- return 0;
+ public Collection<? extends StmtContext<?, ?, ?>> getEffectOfStatement() {
+ return List.of();
}
@Override
- public Optional<StmtContext<A, D, E>> getPreviousCopyCtx() {
- throw new UnsupportedOperationException();
+ ReplicaStatementContext<A, D, E> replicaAsChildOf(final StatementContextBase<?, ?, ?> newParent) {
+ return source.replicaAsChildOf(newParent);
}
@Override
- public void removeStatementFromEffectiveSubstatements(final StatementDefinition statementDef) {
- throw new UnsupportedOperationException();
+ public Optional<? extends Mutable<?, ?, ?>> copyAsChildOf(final Mutable<?, ?, ?> newParent, final CopyType type,
+ final QNameModule targetModule) {
+ return source.copyAsChildOf(newParent, type, targetModule);
}
@Override
- public void removeStatementFromEffectiveSubstatements(final StatementDefinition statementDef,
- final String statementArg) {
- throw new UnsupportedOperationException();
+ ReactorStmtCtx<?, ?, ?> asEffectiveChildOf(final StatementContextBase<?, ?, ?> newParent, final CopyType type,
+ final QNameModule targetModule) {
+ final ReactorStmtCtx<?, ?, ?> ret = source.asEffectiveChildOf(newParent, type, targetModule);
+ return ret == null ? null : this;
}
@Override
- public void addEffectiveSubstatement(final Mutable<?, ?, ?> substatement) {
+ StatementDefinitionContext<A, D, E> definition() {
+ return source.definition();
+ }
+
+ @Override
+ void markNoParentRef() {
+ // No-op
+ }
+
+ @Override
+ int sweepSubstatements() {
+ if (fullyDefined()) {
+ source.decRef();
+ }
+ return 0;
+ }
+
+ @Override
+ public <K, V, T extends K, U extends V, N extends ParserNamespace<K, V>> void addToNs(final Class<@NonNull N> type,
+ final T key, final U value) {
throw new UnsupportedOperationException();
}
@Override
- void addEffectiveSubstatementsImpl(final Collection<? extends Mutable<?, ?, ?>> statements) {
+ public Optional<StmtContext<A, D, E>> getPreviousCopyCtx() {
throw new UnsupportedOperationException();
}
@Override
- Stream<? extends StmtContext<?, ?, ?>> streamDeclared() {
+ public <K, KT extends K, N extends StatementNamespace<K, ?, ?>> void addContext(final Class<@NonNull N> namespace,
+ final KT key, final StmtContext<?, ?, ?> stmt) {
throw new UnsupportedOperationException();
}
@Override
- Stream<? extends StmtContext<?, ?, ?>> streamEffective() {
+ public void addAsEffectOfStatement(final Collection<? extends StmtContext<?, ?, ?>> ctxs) {
throw new UnsupportedOperationException();
}
@Override
- StatementContextBase<A, D, E> reparent(final StatementContextBase<?, ?, ?> newParent) {
+ public Mutable<?, ?, ?> childCopyOf(final StmtContext<?, ?, ?> stmt, final CopyType type,
+ final QNameModule targetModule) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override boolean doTryToCompletePhase(final ModelProcessingPhase phase) {
throw new UnsupportedOperationException();
}
*/
@Override
@Deprecated
- Optional<SchemaPath> schemaPath() {
+ public SchemaPath schemaPath() {
return substatementGetSchemaPath();
}