*/
package org.opendaylight.yangtools.yang.parser.stmt.reactor;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.common.YangConstants;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
-
import com.google.common.base.Preconditions;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableMap;
import javax.annotation.Nullable;
import org.opendaylight.yangtools.concepts.Mutable;
import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.common.YangConstants;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
import org.opendaylight.yangtools.yang.parser.spi.ExtensionNamespace;
private ModelProcessingPhase inProgressPhase;
private ModelProcessingPhase finishedPhase;
- private QNameToStatementDefinitionMap qNameToStmtDefMap = new QNameToStatementDefinitionMap();
- private PrefixToModuleMap prefixToModuleMap = new PrefixToModuleMap();
+ private final QNameToStatementDefinitionMap qNameToStmtDefMap = new QNameToStatementDefinitionMap();
+ private final PrefixToModuleMap prefixToModuleMap = new PrefixToModuleMap();
- SourceSpecificContext(BuildGlobalContext currentContext,StatementStreamSource source) {
+ SourceSpecificContext(final BuildGlobalContext currentContext,final StatementStreamSource source) {
this.source = source;
this.currentContext = currentContext;
}
- StatementDefinitionContext<?,?,?> getDefinition(QName name) {
+ StatementDefinitionContext<?,?,?> getDefinition(final QName name) {
return currentContext.getStatementDefinition(name);
}
- ContextBuilder<?, ?, ?> createDeclaredChild(StatementContextBase<?, ?, ?> current, QName name, StatementSourceReference ref) {
+ ContextBuilder<?, ?, ?> createDeclaredChild(final StatementContextBase<?, ?, ?> current, final QName name, final StatementSourceReference ref) {
StatementDefinitionContext<?,?,?> def = getDefinition(name);
//extensions
}
@SuppressWarnings({ "rawtypes", "unchecked" })
- private ContextBuilder<?,?, ?> createDeclaredRoot(StatementDefinitionContext<?,?,?> def, StatementSourceReference ref) {
+ private ContextBuilder<?,?, ?> createDeclaredRoot(final StatementDefinitionContext<?,?,?> def, final StatementSourceReference ref) {
return new ContextBuilder(def,ref) {
@Override
return root.buildEffective();
}
- void startPhase(ModelProcessingPhase phase) {
+ void startPhase(final ModelProcessingPhase phase) {
@Nullable ModelProcessingPhase previousPhase = phase.getPreviousPhase();
Preconditions.checkState(Objects.equals(previousPhase, finishedPhase));
Preconditions.checkState(modifiers.get(previousPhase).isEmpty());
}
@Override
- public <K, V, N extends IdentifierNamespace<K, V>> void addToLocalStorage(Class<N> type, K key, V value) {
+ public <K, V, N extends IdentifierNamespace<K, V>> void addToLocalStorage(final Class<N> type, final K key, final V value) {
if(ImportedNamespaceContext.class.isAssignableFrom(type)) {
importedNamespaces.add((NamespaceStorageNode) value);
}
}
@Override
- public <K, V, N extends IdentifierNamespace<K, V>> V getFromLocalStorage(Class<N> type, K key) {
+ public <K, V, N extends IdentifierNamespace<K, V>> V getFromLocalStorage(final Class<N> type, final K key) {
final V potentialLocal = getRoot().getFromLocalStorage(type, key);
if(potentialLocal != null) {
return potentialLocal;
}
@Override
- public <K, V, N extends IdentifierNamespace<K, V>> NamespaceBehaviour<K, V, N> getNamespaceBehaviour(Class<N> type) {
+ public <K, V, N extends IdentifierNamespace<K, V>> NamespaceBehaviour<K, V, N> getNamespaceBehaviour(final Class<N> type) {
return currentContext.getNamespaceBehaviour(type);
}
return currentContext;
}
- PhaseCompletionProgress tryToCompletePhase(ModelProcessingPhase phase) throws SourceException {
+ PhaseCompletionProgress tryToCompletePhase(final ModelProcessingPhase phase) throws SourceException {
Collection<ModifierImpl> currentPhaseModifiers = modifiers.get(phase);
boolean hasProgressed = hasProgress(currentPhaseModifiers);
boolean phaseCompleted = root.tryToCompletePhase(phase);
- hasProgressed = hasProgress(currentPhaseModifiers);
+ hasProgressed = (hasProgress(currentPhaseModifiers) | hasProgressed);
if(phaseCompleted && (currentPhaseModifiers.isEmpty())) {
finishedPhase = phase;
}
- private boolean hasProgress(Collection<ModifierImpl> currentPhaseModifiers) {
+ private static boolean hasProgress(final Collection<ModifierImpl> currentPhaseModifiers) {
Iterator<ModifierImpl> modifier = currentPhaseModifiers.iterator();
boolean hasProgressed = false;
}
- ModelActionBuilder newInferenceAction(ModelProcessingPhase phase) {
+ ModelActionBuilder newInferenceAction(final ModelProcessingPhase phase) {
ModifierImpl action = new ModifierImpl(phase);
modifiers.put(phase, action);
return action;
+ finishedPhase + "]";
}
- SourceException failModifiers(ModelProcessingPhase identifier) {
+ SourceException failModifiers(final ModelProcessingPhase identifier) {
InferenceException sourceEx = new InferenceException("Fail to infer source relationships", root.getStatementSourceReference());