class CulpritFinder {

    List<BuildProblemData> getRelevantBuildProblems()
    {
        SettingNames settingNames = new SettingNames();

        if (triggerOnBuildProblem.equals(settingNames.getNoTrigger())) {
            Loggers.SERVER.debug("[SinCity] build problems do not trigger");
            return new ArrayList<BuildProblemData>();
        }

        final List<BuildProblemData> thisBuildProblems = newBuild.getFailureReasons();
        Loggers.SERVER.debug("[SinCity] this build's problems: " + thisBuildProblems);

        if (triggerOnBuildProblem.equals(settingNames.getTriggerOnAll())) {
            Loggers.SERVER.debug("[SinCity] reporting all build problems");
            return thisBuildProblems;
        }

        final List<BuildProblemData> previousBuildProblems = oldBuild == null
                ? new ArrayList<BuildProblemData>()
                : oldBuild.getFailureReasons();
        Loggers.SERVER.debug("[SinCity] previous build's problems: " + previousBuildProblems);

        // OK, so we're only interested in *new* build problems; subtract "this minus previous"; however, use
        // BuildProblemDataWithCustomComparator to correctly assess the equality of artifact dependency failures (see
        // comments in that class)
        final List<BuildProblemDataWithCustomComparator> newProblemsWithCustomComparator = new ArrayList<BuildProblemDataWithCustomComparator>();
        for (BuildProblemData thisBuildProblem : thisBuildProblems)
            newProblemsWithCustomComparator.add(new BuildProblemDataWithCustomComparator(thisBuildProblem));

        for (BuildProblemData previousBuildProblem : previousBuildProblems)
            newProblemsWithCustomComparator.remove(new BuildProblemDataWithCustomComparator(previousBuildProblem));

        final List<BuildProblemData> newProblems = new ArrayList<BuildProblemData>();
        for (BuildProblemDataWithCustomComparator newProblemWithCustomSeparator : newProblemsWithCustomComparator)
            newProblems.add(newProblemWithCustomSeparator.getBuildProblemData());

        Loggers.SERVER.debug("[SinCity] new build problems: " + newProblems);
        Loggers.SERVER.debug("[SinCity] reporting new build problems");

        return newProblems;
    }

    public  CulpritFinder(@NotNull SBuild newBuild,
                         @Nullable SFinishedBuild oldBuild,
                         @NotNull String triggerOnBuildProblem,
                         @NotNull String triggerOnTestFailure,
                         @NotNull BuildCustomizerFactory buildCustomizerFactory,
                         @NotNull BuildQueue buildQueue,
                         boolean putBuildsToQueueTop,
                         @NotNull String triggeredBy);

}