X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=yang%2Fyang-parser-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fparser%2Fstmt%2Freactor%2FStatementContextBase.java;h=423a0cabb9ff5936f3c29c0147915f29c31a737e;hb=12880a5876c644243ba46ce8c674f29a7d0c773a;hp=eaf8aeb909e66976c2d5c9b69daf6ffc1c2cb566;hpb=b704d772ac1fb2bb55a5f817d2173274a7f83fab;p=yangtools.git diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/StatementContextBase.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/StatementContextBase.java index eaf8aeb909..423a0cabb9 100644 --- a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/StatementContextBase.java +++ b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/StatementContextBase.java @@ -85,7 +85,7 @@ public abstract class StatementContextBase, E private Multimap phaseListeners = ImmutableMultimap.of(); private Multimap phaseMutation = ImmutableMultimap.of(); - private Collection> effective = ImmutableList.of(); + private Collection> effective = ImmutableList.of(); private Collection> effectOfStatement = ImmutableList.of(); private StatementMap substatements = StatementMap.empty(); @@ -237,13 +237,24 @@ public abstract class StatementContextBase, E @Nonnull @Override - public Collection> declaredSubstatements() { + public Collection> declaredSubstatements() { return substatements.values(); } @Nonnull @Override - public Collection> effectiveSubstatements() { + public Collection> mutableDeclaredSubstatements() { + return substatements.values(); + } + + @Override + public Collection> effectiveSubstatements() { + return mutableEffectiveSubstatements(); + } + + @Nonnull + @Override + public Collection> mutableEffectiveSubstatements() { if (effective instanceof ImmutableCollection) { return effective; } @@ -269,9 +280,9 @@ public abstract class StatementContextBase, E return; } - final Iterator> iterator = effective.iterator(); + final Iterator> iterator = effective.iterator(); while (iterator.hasNext()) { - final StatementContextBase next = iterator.next(); + final StmtContext next = iterator.next(); if (statementDef.equals(next.getPublicDefinition())) { iterator.remove(); } @@ -301,9 +312,9 @@ public abstract class StatementContextBase, E return; } - final Iterator> iterator = effective.iterator(); + final Iterator> iterator = effective.iterator(); while (iterator.hasNext()) { - final StatementContextBase next = iterator.next(); + final Mutable next = iterator.next(); if (statementDef.equals(next.getPublicDefinition()) && statementArg.equals(next.rawStatementArgument())) { iterator.remove(); } @@ -321,9 +332,7 @@ public abstract class StatementContextBase, E * @throws NullPointerException * if statement parameter is null */ - public void addEffectiveSubstatement(final StatementContextBase substatement) { - Preconditions.checkNotNull(substatement, "StatementContextBase effective substatement cannot be null at: %s", - getStatementSourceReference()); + public void addEffectiveSubstatement(final Mutable substatement) { beforeAddEffectiveStatement(1); effective.add(substatement); } @@ -337,7 +346,7 @@ public abstract class StatementContextBase, E * @throws NullPointerException * if statement parameter is null */ - public void addEffectiveSubstatements(final Collection> substatements) { + public void addEffectiveSubstatements(final Collection> substatements) { if (substatements.isEmpty()) { return; } @@ -450,8 +459,10 @@ public abstract class StatementContextBase, E for (final StatementContextBase child : substatements.values()) { finished &= child.tryToCompletePhase(phase); } - for (final StatementContextBase child : effective) { - finished &= child.tryToCompletePhase(phase); + for (final Mutable child : effective) { + if (child instanceof StatementContextBase) { + finished &= ((StatementContextBase) child).tryToCompletePhase(phase); + } } if (finished) {