List of usage examples for java.time.temporal TemporalQuery interface-usage
From source file Main.java
class Monday1Query implements TemporalQuery<Boolean> { @Override public Boolean queryFrom(TemporalAccessor temporal) { if (temporal.isSupported(ChronoField.DAY_OF_MONTH) && temporal.isSupported(ChronoField.DAY_OF_WEEK)) { int dayOfMonth = temporal.get(ChronoField.DAY_OF_MONTH); int weekDay = temporal.get(ChronoField.DAY_OF_WEEK);
From source file Main.java
class QuarterOfYearQuery implements TemporalQuery<Quarter> { @Override public Quarter queryFrom(TemporalAccessor temporal) { LocalDate now = LocalDate.from(temporal); if (now.isBefore(now.with(Month.APRIL).withDayOfMonth(1))) {
From source file Main.java
class NextMartinLutherKingDayQuery implements TemporalQuery<LocalDate> { @Override public LocalDate queryFrom(TemporalAccessor temporal) { LocalDate date = LocalDate.from(temporal); LocalDate currentYearMLKDay = getMartinLutherKingDayForDateInYear(date.getYear());
From source file Main.java
class SchoolHolidayQuery implements TemporalQuery<Boolean> { @Override public Boolean queryFrom(TemporalAccessor date) { int month = date.get(ChronoField.MONTH_OF_YEAR); if (month == Month.JULY.getValue() || month == Month.AUGUST.getValue()) { return true;
From source file Main.java
class FamilyVacations implements TemporalQuery<Boolean> { // Returns true if the passed-in date occurs during one of the // family vacations. Because the query compares the month and day only, // the check succeeds even if the Temporal types are not the same. public Boolean queryFrom(TemporalAccessor date) {
From source file FridayThirteenQuery.java
public class FridayThirteenQuery implements TemporalQuery<Boolean> { // Returns TRUE if the date occurs on Friday the 13th. public Boolean queryFrom(TemporalAccessor date) { return ((date.get(ChronoField.DAY_OF_MONTH) == 13) && (date.get(ChronoField.DAY_OF_WEEK) == 5));