class Project implements Serializable, Runnable {

    Element getModifications(final boolean buildWasForced) {
        setState(ProjectState.MODIFICATIONSET);

        final ModificationSet modificationSet = projectConfig.getModificationSet();
        if (modificationSet == null) {
            debug("no modification set, nothing to detect.");
            if (buildWasForced) {
                info("no modification set but build was forced");
                return new Element("modifications");
            }
            if (!requiremodification) {
                info("no modification set but no modifications required");
                return new Element("modifications");
            }
            return null;
        }

        final boolean checkNewChangesFirst = checkOnlySinceLastBuild();
        Element modifications;
        if (checkNewChangesFirst) {
            debug("getting changes since last build");
            modifications = modificationSet.retrieveModificationsAsElement(lastBuild, progress);
        } else {
            debug("getting changes since last successful build");
            modifications = modificationSet.retrieveModificationsAsElement(lastSuccessfulBuild, progress);
        }

        if (!modificationSet.isModified()) {
            info("No modifications found, build not necessary.");

            // Sometimes we want to build even though we don't have any
            // modifications:
            //   * last build failed & buildaferfailed="true"
            //   * requiremodifications="false"
            //   * build forced
            if (buildAfterFailed && !wasLastBuildSuccessful) {
                info("Building anyway, since buildAfterFailed is true and last build failed.");
            } else if (!requiremodification) {
                info("Building anyway, since modifications not required");
            } else {
                if (buildWasForced) {
                    info("Building anyway, since build was explicitly forced.");
                } else {
                    return null;
                }
            }
        }

        if (checkNewChangesFirst) {
            debug("new changes found; now getting complete set");
            modifications = modificationSet.retrieveModificationsAsElement(lastSuccessfulBuild, progress);
        }

        return modifications;
    }

    public  Project();

}