package net.sourceforge.fenixedu.dataTransferObject.inquiries; import net.sourceforge.fenixedu.dataTransferObject.InfoObject; import net.sourceforge.fenixedu.util.NumberUtils; /** * @author José Pedro Pereira * */ public class InfoInquiriesReportPerCurricularYear3 extends InfoObject implements Comparable { private Integer curricularYear = -1; private Integer totalNumberInquiries = 0; private Integer numberNotStartedInquiries = 0; private Integer numberNotFinishedInquiries = 0; private Integer numberFinishedInquiries = 0; private Integer numberReportedProblems = 0; private Integer numberEligible = 0; private Integer numberNotWillAnswer = 0; private Integer numberMayBeSanctioned = 0; public Integer getNumberReportedProblems() { return numberReportedProblems; } public void setNumberReportedProblems(Integer numberReportedProblems) { this.numberReportedProblems = numberReportedProblems; } public InfoInquiriesReportPerCurricularYear3(Integer curricularYear) { this.curricularYear = curricularYear; } public Integer getNumberFinishedInquiries() { return numberFinishedInquiries; } public void setNumberFinishedInquiries(Integer numberFinishedInquiries) { this.numberFinishedInquiries = numberFinishedInquiries; } public Integer getNumberNotFinishedInquiries() { return numberNotFinishedInquiries; } public void setNumberNotFinishedInquiries(Integer numberNotFinishedInquiries) { this.numberNotFinishedInquiries = numberNotFinishedInquiries; } public Integer getNumberNotStartedInquiries() { return numberNotStartedInquiries; } public void setNumberNotStartedInquiries(Integer numberNotStartedInquiries) { this.numberNotStartedInquiries = numberNotStartedInquiries; } public Integer getTotalNumberInquiries() { return totalNumberInquiries; } public void setTotalNumberInquiries(Integer totalNumberInquiries) { this.totalNumberInquiries = totalNumberInquiries; } public Double getPercentNotStartedInquiries() { double percent = (double) getNumberNotStartedInquiries() / (double) getTotalNumberInquiries(); percent *= 100.; if (Double.isNaN(percent)) return new Double(percent); return NumberUtils.formatNumber(percent, InfoInquiriesReport3.PERCENTS_FLOATING_DECIMAL_PLACES); } public Double getPercentNotFinishedInquiries() { double percent = (double) getNumberNotFinishedInquiries() / (double) getTotalNumberInquiries(); percent *= 100.; if (Double.isNaN(percent)) return new Double(percent); return NumberUtils.formatNumber(percent, InfoInquiriesReport3.PERCENTS_FLOATING_DECIMAL_PLACES); } public Double getPercentFinishedInquiries() { double percent = (double) getNumberFinishedInquiries() / (double) getTotalNumberInquiries(); percent *= 100.; if (Double.isNaN(percent)) return new Double(percent); return NumberUtils.formatNumber(percent, InfoInquiriesReport3.PERCENTS_FLOATING_DECIMAL_PLACES); } public Double getPercentReportedProblems() { double percent = (double) getNumberReportedProblems() / (double) (getNumberFinishedInquiries() + getNumberNotFinishedInquiries()); percent *= 100.; if (Double.isNaN(percent)) return new Double(percent); return NumberUtils.formatNumber(percent, InfoInquiriesReport3.PERCENTS_FLOATING_DECIMAL_PLACES); } public Double getPercentFinishedOrOngoing() { double percent = (double) (getNumberFinishedInquiries() + getNumberNotFinishedInquiries()) / (double) getTotalNumberInquiries(); percent *= 100; if (Double.isNaN(percent)) return new Double(percent); return NumberUtils.formatNumber(percent, InfoInquiriesReport3.PERCENTS_FLOATING_DECIMAL_PLACES); } public int compareTo(Object o) { if (o instanceof InfoInquiriesReportPerCurricularYear3) { InfoInquiriesReportPerCurricularYear3 other = (InfoInquiriesReportPerCurricularYear3) o; return this.getCurricularYear() - other.getCurricularYear(); } return 1; } public void addTotalNumberInquiries(int i) { setTotalNumberInquiries(getTotalNumberInquiries() + i); } public void addNumberFinishedInquiries(int i) { setNumberFinishedInquiries(getNumberFinishedInquiries() + i); } public void addNumberEligible(int i) { setNumberEligible(getNumberEligible() + i); } public void addNumberReportedProblems(int i) { setNumberReportedProblems(getNumberReportedProblems() + i); } public void addNumberNotFinishedInquiries(int i) { setNumberNotFinishedInquiries(getNumberNotFinishedInquiries() + i); } public void addNumberNotStartedInquiries(int i) { setNumberNotStartedInquiries(getNumberNotStartedInquiries() + i); } /** * @return the curricularYear */ public Integer getCurricularYear() { return curricularYear; } /** * @param curricularYear * the curricularYear to set */ public void setCurricularYear(Integer curricularYear) { this.curricularYear = curricularYear; } /** * @return the numberEligible */ public Integer getNumberEligible() { return numberEligible; } public Double getPercentEligible() { double percent = (double) getNumberEligible() / (double) (getNumberFinishedInquiries()); percent *= 100.; if (Double.isNaN(percent)) return new Double(percent); return NumberUtils.formatNumber(percent, InfoInquiriesReport3.PERCENTS_FLOATING_DECIMAL_PLACES); } /** * @param numberEligible * the numberEligible to set */ public void setNumberEligible(Integer numberEligible) { this.numberEligible = numberEligible; } public void addNumberNotWillAnswer(int i) { setNumberNotWillAnswer(getNumberNotWillAnswer() + i); } /** * @return the numberNotWillAnswer */ public int getNumberNotWillAnswer() { return numberNotWillAnswer; } /** * @param numberNotWillAnswer * the numberNotWillAnswer to set */ public void setNumberNotWillAnswer(int numberNotWillAnswer) { this.numberNotWillAnswer = numberNotWillAnswer; } public Double getPercentNotWillAnswer() { double percent = (double) getNumberNotWillAnswer() / (double) getNumberFinishedInquiries(); percent *= 100.; if (Double.isNaN(percent)) return new Double(percent); return NumberUtils.formatNumber(percent, InfoInquiriesReport3.PERCENTS_FLOATING_DECIMAL_PLACES); } /** * @return the numberMayBeSanctioned */ public Integer getNumberMayBeSanctioned() { return numberMayBeSanctioned; } /** * @param numberMayBeSanctioned * the numberMayBeSanctioned to set */ public void setNumberMayBeSanctioned(Integer numberMayBeSanctioned) { this.numberMayBeSanctioned = numberMayBeSanctioned; } public void addNumberMayBeSanctioned(Integer i) { setNumberMayBeSanctioned(getNumberMayBeSanctioned() + i); } public Double getPercentMayBeSanctioned() { double percent = (double) getNumberMayBeSanctioned() / (double) getTotalNumberInquiries(); percent *= 100.; if (Double.isNaN(percent)) return new Double(percent); return NumberUtils.formatNumber(percent, InfoInquiriesReport3.PERCENTS_FLOATING_DECIMAL_PLACES); } }