Example usage for org.joda.time LocalTime isEqual

List of usage examples for org.joda.time LocalTime isEqual

Introduction

In this page you can find the example usage for org.joda.time LocalTime isEqual.

Prototype

public boolean isEqual(ReadablePartial partial) 

Source Link

Document

Is this partial the same as the specified partial.

Usage

From source file:aiai.ai.yaml.env.TimePeriods.java

License:Open Source License

public boolean isActive(LocalTime curr, TimePeriod period) {
    return curr.isEqual(period.start) || curr.isEqual(period.end)
            || (curr.isAfter(period.start) && curr.isBefore(period.end));
}

From source file:com.hotwire.test.steps.search.air.AirSearchModelWebApp.java

License:Open Source License

private void compareValues(LocalTime a, LocalTime b, boolean doAscendingOrderBy) {
    LOGGER.info("Compare " + b + (doAscendingOrderBy ? " <= " : " >= ") + a);
    if (doAscendingOrderBy) {
        assertThat(a.isEqual(b) || a.isAfter(b))
                .as("Expected (" + a + " <= " + b + ") to be true but got false instead.").isTrue();
    } else {//ww w  .  j ava2 s. c  o m
        // Descending order.
        assertThat(a.isEqual(b) || a.isBefore(b))
                .as("Expected (" + a + " >= " + b + ") to be true but got false instead.").isTrue();
    }
}

From source file:com.karthikb351.vitinfo2.fragment.schedule.ScheduleListAdapter.java

License:Open Source License

private void compareTimeAndUpdate(ScheduleView scheduleView, String startTime, String endTime) {

    // Formatting strings to get the nearest hours
    startTime = formatTime(startTime);/*from   www.  j  a  v  a  2s  .  c  om*/
    endTime = formatTime(endTime);

    // Comparing time
    LocalTime nowTime = LocalTime.now(DateTimeZone.UTC);
    LocalTime floorTime = new LocalTime(startTime);
    LocalTime ceilTime = new LocalTime(endTime);

    // To correct the timezone difference
    nowTime = nowTime.plusHours(5);
    nowTime = nowTime.plusMinutes(30);

    boolean lowerCheck = nowTime.isAfter(floorTime) || nowTime.isEqual(floorTime);
    boolean upperCheck = nowTime.isBefore(ceilTime);
    boolean upperOverCheck = nowTime.isAfter(ceilTime) || nowTime.isEqual(ceilTime);

    if (lowerCheck && upperCheck) {
        scheduleView.setState(TimeLineView.STATE_CURRENT);
    } else if (lowerCheck && upperOverCheck) {
        scheduleView.setState(TimeLineView.STATE_FINISHED);
    } else {
        scheduleView.setState(TimeLineView.STATE_SCHEDULED);
    }
}

From source file:lt.norma.crossbow.contracts.Exchange.java

License:Open Source License

/**
 * Is specified time inside trading hours of the exchange.
 * //from   w  w  w  .ja  v  a2s  .  c o  m
 * @param time
 *           time to be checked
 * @return true if the specified time equals to or is after trading start time, and is before
 *         trading end time.
 */
public boolean isTradingHours(LocalTime time) {
    if (doesClose) {
        return (time.isEqual(tradingStarts) || time.isAfter(tradingStarts)) && time.isBefore(tradingEnds);
    } else {
        return time.isEqual(tradingStarts) || time.isAfter(tradingStarts);
    }
}

From source file:org.datacleaner.beans.DateAndTimeAnalyzerColumnDelegate.java

License:Open Source License

public synchronized void run(final Date value, final InputRow row, final int distinctCount) {
    _numRows += distinctCount;//from www.j  a  v a 2 s .  c  o m
    if (value == null) {
        _annotationFactory.annotate(row, distinctCount, _nullAnnotation);
    } else {
        final long timestamp = value.getTime();

        for (int i = 0; i < distinctCount; i++) {
            if (_statistics instanceof DescriptiveStatistics) {
                ((DescriptiveStatistics) _statistics).addValue(timestamp);
            } else {
                ((SummaryStatistics) _statistics).addValue(timestamp);
            }
        }

        LocalDate localDate = new LocalDate(value);
        LocalTime localTime = new LocalTime(value);
        if (_minDate == null) {
            // first non-null value
            _minDate = localDate;
            _maxDate = localDate;
            _minTime = localTime;
            _maxTime = localTime;
        } else {
            if (localDate.isAfter(_maxDate)) {
                _maxDate = localDate;
                _annotationFactory.resetAnnotation(_maxDateAnnotation);
            } else if (localDate.isBefore(_minDate)) {
                _minDate = localDate;
                _annotationFactory.resetAnnotation(_minDateAnnotation);
            }

            if (localTime.isAfter(_maxTime)) {
                _maxTime = localTime;
                _annotationFactory.resetAnnotation(_maxTimeAnnotation);
            } else if (localTime.isBefore(_minTime)) {
                _minTime = localTime;
                _annotationFactory.resetAnnotation(_minTimeAnnotation);
            }
        }

        if (localDate.isEqual(_maxDate)) {
            _annotationFactory.annotate(row, distinctCount, _maxDateAnnotation);
        }
        if (localDate.isEqual(_minDate)) {
            _annotationFactory.annotate(row, distinctCount, _minDateAnnotation);
        }

        if (localTime.isEqual(_maxTime)) {
            _annotationFactory.annotate(row, distinctCount, _maxTimeAnnotation);
        }
        if (localTime.isEqual(_minTime)) {
            _annotationFactory.annotate(row, distinctCount, _minTimeAnnotation);
        }
    }
}

From source file:org.eobjects.analyzer.beans.DateAndTimeAnalyzerColumnDelegate.java

License:Open Source License

public synchronized void run(final Date value, final InputRow row, final int distinctCount) {
    _numRows += distinctCount;/*w ww . ja va2s .c  o  m*/
    if (value == null) {
        _annotationFactory.annotate(row, distinctCount, _nullAnnotation);
    } else {
        final long timestamp = value.getTime();

        for (int i = 0; i < distinctCount; i++) {
            if (_statistics instanceof DescriptiveStatistics) {
                ((DescriptiveStatistics) _statistics).addValue(timestamp);
            } else {
                ((SummaryStatistics) _statistics).addValue(timestamp);
            }
        }

        LocalDate localDate = new LocalDate(value);
        LocalTime localTime = new LocalTime(value);
        if (_minDate == null) {
            // first non-null value
            _minDate = localDate;
            _maxDate = localDate;
            _minTime = localTime;
            _maxTime = localTime;
        } else {
            if (localDate.isAfter(_maxDate)) {
                _maxDate = localDate;
                _annotationFactory.reset(_maxDateAnnotation);
            } else if (localDate.isBefore(_minDate)) {
                _minDate = localDate;
                _annotationFactory.reset(_minDateAnnotation);
            }

            if (localTime.isAfter(_maxTime)) {
                _maxTime = localTime;
                _annotationFactory.reset(_maxTimeAnnotation);
            } else if (localTime.isBefore(_minTime)) {
                _minTime = localTime;
                _annotationFactory.reset(_minTimeAnnotation);
            }
        }

        if (localDate.isEqual(_maxDate)) {
            _annotationFactory.annotate(row, distinctCount, _maxDateAnnotation);
        }
        if (localDate.isEqual(_minDate)) {
            _annotationFactory.annotate(row, distinctCount, _minDateAnnotation);
        }

        if (localTime.isEqual(_maxTime)) {
            _annotationFactory.annotate(row, distinctCount, _maxTimeAnnotation);
        }
        if (localTime.isEqual(_minTime)) {
            _annotationFactory.annotate(row, distinctCount, _minTimeAnnotation);
        }
    }
}