Collection<? extends StmtContext<?, ?, ?>> getEffectOfStatement();
+ /**
+ * @return copy of this considering {@link CopyType} (augment, uses)
+ *
+ * @throws org.opendaylight.yangtools.yang.parser.spi.source.SourceException instance of SourceException
+ */
Mutable<A, D, E> createCopy(StatementContextBase<?, ?, ?> newParent, CopyType typeOfCopy);
+ /**
+ * @return copy of this considering {@link CopyType} (augment, uses)
+ *
+ * @throws org.opendaylight.yangtools.yang.parser.spi.source.SourceException instance of SourceException
+ */
Mutable<A, D, E> createCopy(QNameModule newQNameModule, StatementContextBase<?, ?, ?> newParent,
CopyType typeOfCopy);
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.NamespaceStorageNode;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.Registry;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.StorageNodeType;
-import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.source.IncludedModuleContext;
import org.opendaylight.yangtools.yang.parser.spi.source.StatementSourceReference;
this.setRootIdentifier(identifier);
}
- private RootStatementContext(final RootStatementContext<A, D, E> original, final QNameModule newQNameModule,
- final CopyType typeOfCopy) {
- super(original);
-
- sourceContext = Preconditions.checkNotNull(original.sourceContext);
- this.argument = original.argument;
-
- final Collection<? extends Mutable<?, ?, ?>> declared = original.mutableDeclaredSubstatements();
- final Collection<? extends Mutable<?, ?, ?>> effective = original.mutableEffectiveSubstatements();
- final Collection<Mutable<?, ?, ?>> buffer = new ArrayList<>(declared.size() + effective.size());
-
- for (final Mutable<?, ?, ?> stmtContext : declared) {
- if (stmtContext.isSupportedByFeatures()) {
- buffer.add(stmtContext.createCopy(newQNameModule, this, typeOfCopy));
- }
- }
- for (final StmtContext<?, ?, ?> stmtContext : effective) {
- buffer.add(stmtContext.createCopy(newQNameModule, this, typeOfCopy));
- }
-
- addEffectiveSubstatements(buffer);
- }
-
/**
* @return null as root cannot have parent
*/
return argument;
}
- /**
- * @return copy of this considering {@link CopyType} (augment, uses)
- *
- * @throws org.opendaylight.yangtools.yang.parser.spi.source.SourceException instance of SourceException
- */
@Override
public StatementContextBase<A, D, E> createCopy(final StatementContextBase<?, ?, ?> newParent,
final CopyType typeOfCopy) {
- return createCopy(null, newParent, typeOfCopy);
+ throw new UnsupportedOperationException("Root context cannot be copied");
}
- /**
- * @return copy of this considering {@link CopyType} (augment, uses)
- *
- * @throws org.opendaylight.yangtools.yang.parser.spi.source.SourceException instance of SourceException
- */
@Override
public StatementContextBase<A, D, E> createCopy(final QNameModule newQNameModule,
final StatementContextBase<?, ?, ?> newParent, final CopyType typeOfCopy) {
- final RootStatementContext<A, D, E> copy = new RootStatementContext<>(this, newQNameModule, typeOfCopy);
-
- copy.appendCopyHistory(typeOfCopy, this.getCopyHistory());
-
- if (this.getOriginalCtx() != null) {
- copy.setOriginalCtx(this.getOriginalCtx());
- } else {
- copy.setOriginalCtx(this);
- }
- definition().onStatementAdded(copy);
- return copy;
+ throw new UnsupportedOperationException("Root context cannot be copied");
}
@Nonnull