+ /**
+ * adds effective statement to collection of substatements
+ *
+ * @throws IllegalStateException
+ * if added in declared phase
+ * @throws NullPointerException
+ * if statement parameter is null
+ *
+ * @param substatement substatement
+ */
+ public void addEffectiveSubstatement(final StatementContextBase<?, ?, ?> substatement) {
+
+ final ModelProcessingPhase inProgressPhase = getRoot().getSourceContext().getInProgressPhase();
+ Preconditions.checkState(inProgressPhase == ModelProcessingPhase.FULL_DECLARATION
+ || inProgressPhase == ModelProcessingPhase.EFFECTIVE_MODEL,
+ "Effective statement cannot be added in declared phase at: %s", getStatementSourceReference());
+
+ effective.add(Preconditions.checkNotNull(substatement,
+ "StatementContextBase effective substatement cannot be null at: %s", getStatementSourceReference()));
+ }
+
+ /**
+ * adds declared statement to collection of substatements
+ *
+ * @throws IllegalStateException
+ * if added in effective phase
+ * @throws NullPointerException
+ * if statement parameter is null
+ *
+ * @param substatement substatement
+ */
+ public void addDeclaredSubstatement(final StatementContextBase<?, ?, ?> substatement) {
+
+ final ModelProcessingPhase inProgressPhase = getRoot().getSourceContext().getInProgressPhase();
+ Preconditions.checkState(inProgressPhase != ModelProcessingPhase.EFFECTIVE_MODEL,
+ "Declared statement cannot be added in effective phase at: %s", getStatementSourceReference());
+
+ declared.add(Preconditions.checkNotNull(substatement,
+ "StatementContextBase declared substatement cannot be null at: %s", getStatementSourceReference()));