Example usage for org.joda.time YearMonthDay equals

List of usage examples for org.joda.time YearMonthDay equals

Introduction

In this page you can find the example usage for org.joda.time YearMonthDay equals.

Prototype

public boolean equals(Object partial) 

Source Link

Document

Compares this ReadablePartial with another returning true if the chronology, field types and values are equal.

Usage

From source file:net.sourceforge.fenixedu.domain.OccupationPeriod.java

License:Open Source License

public boolean matches(final YearMonthDay[] yearMonthDays) {
    if (yearMonthDays == null || yearMonthDays.length < 2) {
        return false;
    }//from w w w . ja  va  2  s  . co m
    final YearMonthDay start = yearMonthDays[0];
    final YearMonthDay end = yearMonthDays[1];
    if (start == null || !start.equals(getStartYearMonthDay()) || end == null
            || !end.equals(getEndYearMonthDay())) {
        return false;
    }
    if (yearMonthDays.length > 2) {
        final int l = yearMonthDays.length;
        final YearMonthDay[] nextYearMonthDays = new YearMonthDay[l - 2];
        System.arraycopy(yearMonthDays, 2, nextYearMonthDays, 0, l - 2);
        return getNextPeriod() != null && getNextPeriod().matches(nextYearMonthDays);
    }
    return getNextPeriod() == null;
}

From source file:net.sourceforge.fenixedu.domain.organizationalStructure.ResearchContract.java

License:Open Source License

public void initResearchContract(Person person, YearMonthDay beginDate, YearMonthDay endDate, ResearchUnit unit,
        Boolean isExternalContract) {

    for (Accountability accountability : person
            .getParentAccountabilities(AccountabilityTypeEnum.RESEARCH_CONTRACT)) {
        ResearchContract contract = (ResearchContract) accountability;
        if (contract.getUnit().equals(unit) && beginDate.equals(contract.getBeginDate())) {
            throw new DomainException("error.contract.already.exists");
        }//  w ww. j  a va  2 s. c om
    }

    super.init(person, beginDate, endDate, unit);
    setExternalContract(isExternalContract);
    setAccountabilityType(AccountabilityType.readByType(AccountabilityTypeEnum.RESEARCH_CONTRACT));
}

From source file:pt.ist.fenix.task.exportData.santanderCardGeneration.CreateAndInitializeExecutionCourses.java

License:Open Source License

private OccupationPeriod findOccupationPeriod(final ExecutionCourse executionCourse, final YearMonthDay left,
        final YearMonthDay right) {
    for (final CurricularCourse curricularCourse : executionCourse.getAssociatedCurricularCoursesSet()) {
        final DegreeCurricularPlan degreeCurricularPlan = curricularCourse.getDegreeCurricularPlan();
        for (final ExecutionDegree executionDegree : degreeCurricularPlan.getExecutionDegreesSet()) {
            if (executionDegree.getExecutionYear() == executionCourse.getExecutionYear()) {
                final OccupationPeriod occupationPeriod = executionDegree
                        .getPeriodLessons(executionCourse.getExecutionPeriod());
                if (left.equals(occupationPeriod.getStartYearMonthDay())
                        && right.equals(occupationPeriod.getEndYearMonthDayWithNextPeriods())) {
                    return occupationPeriod;
                }//from  w  w w  . j  a v  a  2  s  . c om
            }
        }
    }
    return null;
}