Set<ProcessorAndContext> processorsForElementName = newSpecificProcessorsByElementName.get(elementName);
if (processorsForElementName == null) {
processorsForElementName = new HashSet<ProcessorAndContext>(20);
newSpecificProcessorsByElementName.put(elementName, processorsForElementName);
}
processorsForElementName.add(new ProcessorAndContext(processor, context));
}
}
if (processorMatcher instanceof IAttributeNameProcessorMatcher) {
// Processor will be indexed as "specific" for one or more attribute names
final String[] attributeNames = ((IAttributeNameProcessorMatcher) processorMatcher).getAttributeNames(context);
if (attributeNames == null) {
throw new ConfigurationException(
"Processor of class \"" + processor.getClass().getName() + "\" " +
"returned a null attribute name as a part of its applicability specifications.");
}
for (final String attributeName : attributeNames) {
Set<ProcessorAndContext> processorsForAttributeName = newSpecificProcessorsByAttributeName.get(attributeName);
if (processorsForAttributeName == null) {
processorsForAttributeName = new HashSet<ProcessorAndContext>(20);
newSpecificProcessorsByAttributeName.put(attributeName, processorsForAttributeName);
}
processorsForAttributeName.add(new ProcessorAndContext(processor, context));
}
}
if (!(processorMatcher instanceof IElementNameProcessorMatcher) && !(processorMatcher instanceof IAttributeNameProcessorMatcher)) {
final Class<? extends Node> appliesTo = processorMatcher.appliesTo();
Set<ProcessorAndContext> processorsForNodeClass = newNonSpecificProcessorsByNodeClass.get(appliesTo);
if (processorsForNodeClass == null) {
processorsForNodeClass = new HashSet<ProcessorAndContext>(20);
newNonSpecificProcessorsByNodeClass.put(appliesTo, processorsForNodeClass);
}
processorsForNodeClass.add(new ProcessorAndContext(processor, context));
}