X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=yang%2Fyang-parser-spi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fparser%2Fspi%2Fmeta%2FStatementFactory.java;h=279e9336965ab8d857723cbdae97557666efaacf;hb=1dec11bcd187ebb6605f87338e9b96d57a91af41;hp=458a188ae18ac67852cb692666b09b7bc7cd6a59;hpb=38b749cf37fea65a935d729674982b99641459be;p=yangtools.git diff --git a/yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/StatementFactory.java b/yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/StatementFactory.java index 458a188ae1..279e933696 100644 --- a/yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/StatementFactory.java +++ b/yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/StatementFactory.java @@ -7,10 +7,21 @@ */ package org.opendaylight.yangtools.yang.parser.spi.meta; +import java.util.Collection; +import java.util.stream.Stream; import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement; import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; +import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current; +/** + * An entity capable of creating {@link DeclaredStatement} and {@link EffectiveStatement} instances for a particular + * type. This interface is usually realized as an implementation-specific combination with {@link StatementSupport}. + * + * @param Argument type + * @param Declared Statement representation + * @param Effective Statement representation + */ public interface StatementFactory, E extends EffectiveStatement> { /** * Create a {@link DeclaredStatement} for specified context. @@ -23,8 +34,39 @@ public interface StatementFactory, E extends E /** * Create a {@link EffectiveStatement} for specified context. * - * @param ctx Statement context - * @return An effective statement instance. + * @param stmt Effective capture of this statement's significant state + * @return An effective statement instance + */ + @NonNull E createEffective(@NonNull Current stmt, + Stream> declaredSubstatements, + Stream> effectiveSubstatements); + + /** + * Create a {@link EffectiveStatement} copy of provided original for specified context. + * + * @param stmt Effective capture of this statement's significant state + * @param original Original effective statement + * @return An effective statement instance + * @throws NullPointerException if any argument is null + */ + @NonNull E copyEffective(@NonNull Current stmt, @NonNull E original); + + /** + * Determine reactor copy behaviour of a statement instance. Implementations classes are required to determine + * their operations with regard to their statements being replicated into different contexts -- potentially sharing + * instantiations. + * + *

+ * Implementations are examine {@code copy} as to whether it would result in the same semantics as {@code current} + * does, provided that {@code current}'s {@code substatements} are properly propagated. + * + * @param copy Copy of current effective context + * @param current Current effective context + * @param substatements Current effective substatements + * @return True if the differences between {@code copy} and {@code current} do not affect this statement's effective + * semantics. + * @throws NullPointerException if any argument is null */ - @NonNull E createEffective(@NonNull StmtContext ctx); + boolean canReuseCurrent(@NonNull Current copy, @NonNull Current current, + @NonNull Collection> substatements); }