use of org.eclipse.titanium.markers.spotters.BaseModuleCodeSmellSpotter in project titan.EclipsePlug-ins by eclipse.
the class AnalyzerBuilder method addProblem.
/**
* @param problemType
* the analyzer will use this code smell
* @return this for method chaining
*/
public AnalyzerBuilder addProblem(final CodeSmellType problemType) {
if (exhausted) {
throw new IllegalStateException("One must not use the builder after build() method is called");
}
if (spotters.get(problemType) != null) {
for (final BaseModuleCodeSmellSpotter spotter : spotters.get(problemType)) {
final Queue<Class<? extends IVisitableNode>> subtypes = new ArrayDeque<Class<? extends IVisitableNode>>();
subtypes.addAll(spotter.getStartNode());
while (!subtypes.isEmpty()) {
final Class<? extends IVisitableNode> sub = subtypes.poll();
if (StaticData.TYPE_HIERARCHY.get(sub) != null) {
Collections.addAll(subtypes, StaticData.TYPE_HIERARCHY.get(sub));
}
if (actions.get(sub) == null) {
actions.put(sub, new HashSet<BaseModuleCodeSmellSpotter>());
}
actions.get(sub).add(spotter);
}
}
} else if (projectSpotters.get(problemType) != null) {
for (final BaseProjectCodeSmellSpotter spotter : projectSpotters.get(problemType)) {
projectActions.add(spotter);
}
}
return this;
}
Aggregations