+ /**
+ * Associate a value with a key within a namespace.
+ *
+ * @param type Namespace type
+ * @param key Key
+ * @param value value
+ * @param <K> namespace key type
+ * @param <V> namespace value type
+ * @param <N> namespace type
+ * @param <T> key type
+ * @param <U> value type
+ * @throws NamespaceNotAvailableException when the namespace is not available.
+ */
+ @Override
+ public final <K, V, T extends K, U extends V, N extends IdentifierNamespace<K, V>> void addToNs(
+ final Class<@NonNull N> type, final T key, final U value) {
+ addToNamespace(type, key, value);
+ }
+
+ @Override
+ public abstract Collection<? extends StatementContextBase<?, ?, ?>> mutableDeclaredSubstatements();
+
+ /**
+ * Return a value associated with specified key within a namespace.
+ *
+ * @param type Namespace type
+ * @param key Key
+ * @param <K> namespace key type
+ * @param <V> namespace value type
+ * @param <N> namespace type
+ * @param <T> key type
+ * @return Value, or null if there is no element
+ * @throws NamespaceNotAvailableException when the namespace is not available.
+ */
+ @Override
+ public final <K, V, T extends K, N extends IdentifierNamespace<K, V>> V getFromNamespace(
+ final Class<@NonNull N> type, final T key) {
+ return getBehaviourRegistry().getNamespaceBehaviour(type).getFrom(this, key);
+ }
+
+ static final Collection<? extends Mutable<?, ?, ?>> mutableEffectiveSubstatements(
+ final List<StatementContextBase<?, ?, ?>> effective) {
+ return effective instanceof ImmutableCollection ? effective : Collections.unmodifiableCollection(effective);
+ }
+
+ private static List<StatementContextBase<?, ?, ?>> shrinkEffective(
+ final List<StatementContextBase<?, ?, ?>> effective) {
+ return effective.isEmpty() ? ImmutableList.of() : effective;