Interface ChronoCondition<T>

All Superinterfaces:
Predicate<T>
All Known Subinterfaces:
HolidayModel
All Known Implementing Classes:
CopticMonth, EthiopianMonth, HebrewMonth, HijriMonth, HinduDay, HinduMonth, IndianMonth, Meridiem, Month, Nengo.Selector, PersianMonth, Quarter, Weekday, Zodiac.Event
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ChronoCondition<T> extends Predicate<T>

Represents a temporal condition.

Common examples are queries for Friday the thirteenth or if a date matches a holiday or a weekend. This interface is very similar to the type ChronoQuery<T, Boolean> but allows more clarity and does not throw any exception.

Author:
Meno Hochschild
See Also:
ChronoEntity.matches(ChronoCondition)
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    test​(T context)
    Decides if given context matches this condition.

    Methods inherited from interface java.util.function.Predicate

    and, negate, or
  • Method Details

    • test

      boolean test(T context)

      Decides if given context matches this condition.

      Due to better readability it is recommended to use following equivalent approach instead of this method::

        import static net.time4j.Weekday.SATURDAY;
        import static net.time4j.Month.JANUARY;
      
        PlainDate date = PlainDate.of(2014, JANUARY, 25);
        System.out.println(SATURDAY.test(date)); // direct use
        System.out.println(date.matches(SATURDAY)); // recommended callback
       
      Specified by:
      test in interface Predicate<T>
      Parameters:
      context - context as base of testing this condition
      Returns:
      true if given time context matches this condition else false