Example usage for org.joda.time ReadableInstant isAfter

List of usage examples for org.joda.time ReadableInstant isAfter

Introduction

In this page you can find the example usage for org.joda.time ReadableInstant isAfter.

Prototype

boolean isAfter(ReadableInstant instant);

Source Link

Document

Is this instant after the instant passed in comparing solely by millisecond.

Usage

From source file:com.alliander.osgp.domain.core.validation.joda.FutureValidator.java

License:Open Source License

@Override
public boolean isValid(final ReadableInstant value, final ConstraintValidatorContext context) {
    if (value == null) {
        return true;
    }/*from   w  w w. j a v a2s  .  co  m*/

    final DateTime checkDate = new DateMidnight(DateTimeZone.UTC).toDateTime();

    return value.isEqual(checkDate) || value.isAfter(checkDate);
}

From source file:com.robwilliamson.healthyesther.util.time.Range.java

License:Open Source License

@Override
public boolean contains(ReadableInstant instant, Comparison comparison) {
    if (instant.isAfter(from) && instant.isBefore(to)) {
        return true;
    }/*from  w w w  .  ja  v  a  2 s  .co m*/

    if (comparison == Comparison.EXCLUSIVE) {
        return false;
    }

    return instant.isEqual(from) || instant.isEqual(to);
}

From source file:com.robwilliamson.healthyesther.util.time.RangeSet.java

License:Open Source License

private static boolean afterOrEqualTo(ReadableInstant lhs, ReadableInstant rhs) {
    return lhs.isAfter(rhs) || lhs.isEqual(rhs);
}

From source file:net.ripe.rpki.commons.crypto.ValidityPeriod.java

License:BSD License

public boolean isExpiredAt(ReadableInstant instant) {
    return notValidAfter != null && instant.isAfter(getNotValidAfter());
}

From source file:net.ripe.rpki.commons.crypto.ValidityPeriod.java

License:BSD License

public boolean isValidAt(ReadableInstant instant) {
    if (instant == null) {
        return !isClosed();
    } else {// w  ww . j  a  v  a 2 s . co  m
        return (notValidBefore == null || !instant.isBefore(getNotValidBefore()))
                && (notValidAfter == null || !instant.isAfter(getNotValidAfter()));
    }
}

From source file:org.apereo.portal.events.aggr.AggregationIntervalInfo.java

License:Apache License

/**
 * @return Minutes between {@link #getStart()} and the end parameter, if the parameter is after
 *     {@link #getEnd()} then {@link #getEnd()} is used
 */// www. jav a  2s.  c o m
public int getDurationTo(ReadableInstant end) {
    if (end.isAfter(this.end)) {
        return this.getTotalDuration();
    }

    return Math.abs(Minutes.minutesBetween(this.start, end).getMinutes());
}

From source file:org.apereo.portal.events.aggr.EventDateTimeUtils.java

License:Apache License

/**
 * Determines if an instant is between a start (inclusive) and end (exclusive).
 *
 * @param start start of range (inclusive)
 * @param end end of range (exclusive)//from   w w  w. j av  a 2s .  co m
 * @param instant instant
 * @return Returns 0 if the instant is contained in the range: (getStart() <= instant <
 *     getEnd()) Returns -1 if the range comes before the instant: (getEnd() <= instant) Returns
 *     1 if the range comes after the instant (instant < getStart())
 * @see Comparable#compareTo(Object)
 */
public static int compareTo(ReadableInstant start, ReadableInstant end, ReadableInstant instant) {
    if (instant.isBefore(start)) {
        return 1;
    }

    if (end.isAfter(instant)) {
        return 0;
    }

    return -1;
}

From source file:org.hibernate.validator.constraints.impl.FutureValidatorForReadableInstant.java

License:Apache License

public boolean isValid(ReadableInstant value, ConstraintValidatorContext context) {
    //null values are valid
    if (value == null) {
        return true;
    }/*  w w w.j  a  v a2  s. c  o m*/

    return value.isAfter(null);
}

From source file:org.springmodules.validation.util.condition.date.jodatime.IsInTheFutureInstantCondition.java

License:Apache License

/**
 * Checks whether the given instant is in the future.
 *
 * @param instant The instant to be checked.
 * @return <code>true</code> if the given instant is in the future, <code>false</code> otherwise.
 *///from  www . j av  a 2 s  .co  m
protected boolean checkInstant(ReadableInstant instant) {
    return instant.isAfter(new DateTime());
}