當前位置: 首頁>>代碼示例>>Java>>正文


Java LocalDate.isAfter方法代碼示例

本文整理匯總了Java中java.time.LocalDate.isAfter方法的典型用法代碼示例。如果您正苦於以下問題:Java LocalDate.isAfter方法的具體用法?Java LocalDate.isAfter怎麽用?Java LocalDate.isAfter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.time.LocalDate的用法示例。


在下文中一共展示了LocalDate.isAfter方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isShowingTimeMarker

import java.time.LocalDate; //導入方法依賴的package包/類
@Override
protected boolean isShowingTimeMarker() {
    WeekTimeScaleView dayView = getSkinnable();
    DetailedWeekView weekView = dayView.getDetailedWeekView();

    if (weekView != null) {
        LocalDate today = getSkinnable().getToday();

        LocalDate weekStart = weekView.getStartDate();
        LocalDate weekEnd = weekView.getEndDate();

        return !(weekStart.isAfter(today) || weekEnd.isBefore(today));

    }

    return false;
}
 
開發者ID:dlemmermann,項目名稱:CalendarFX,代碼行數:18,代碼來源:WeekTimeScaleViewSkin.java

示例2: testRangeOfLocalDates

import java.time.LocalDate; //導入方法依賴的package包/類
@Test(dataProvider = "LocalDateRanges")
public void testRangeOfLocalDates(LocalDate start, LocalDate end, Period step, boolean parallel) {
    final boolean ascend = start.isBefore(end);
    final Range<LocalDate> range = Range.of(start, end, step, v -> v.getDayOfWeek() == DayOfWeek.MONDAY);
    final Array<LocalDate> array = range.toArray(parallel);
    final LocalDate first = array.first(v -> true).map(ArrayValue::getValue).get();
    final LocalDate last = array.last(v -> true).map(ArrayValue::getValue).get();
    Assert.assertEquals(array.typeCode(), ArrayType.LOCAL_DATE);
    Assert.assertTrue(!array.style().isSparse());
    Assert.assertEquals(range.start(), start, "The range start");
    Assert.assertEquals(range.end(), end, "The range end");
    int index = 0;
    LocalDate value = first;
    while (ascend ? value.isBefore(last) : value.isAfter(last)) {
        final LocalDate actual = array.getValue(index);
        Assert.assertEquals(actual, value, "Value matches at " + index);
        Assert.assertTrue(ascend ? actual.compareTo(start) >= 0 && actual.isBefore(end) : actual.compareTo(start) <= 0 && actual.isAfter(end), "Value in bounds at " + index);
        value = ascend ? value.plus(step) : value.minus(step);
        while (value.getDayOfWeek() == DayOfWeek.MONDAY) value = ascend ? value.plus(step) : value.minus(step);
        index++;
    }
}
 
開發者ID:zavtech,項目名稱:morpheus-core,代碼行數:23,代碼來源:RangeFilterTests.java

示例3: selectRange

import java.time.LocalDate; //導入方法依賴的package包/類
@Override
public void selectRange(LocalDate start, LocalDate end) {
    if (start == null || end == null || start.isAfter(end)) {
        return;
    }

    List<LocalDate> toSelect = new ArrayList<>();
    while (start.isBefore(end) || start.equals(end)) {
        if (!model.selectedDates.contains(start)) {
            toSelect.add(start);
        }
        start = start.plusDays(1);
    }

    model.selectedDates.addAll(toSelect);
    model.lastSelected = toSelect.get(toSelect.size() - 1);
}
 
開發者ID:dlemmermann,項目名稱:CalendarFX,代碼行數:18,代碼來源:DateSelectionModel.java

示例4: findIfLocalDateIsInRange

import java.time.LocalDate; //導入方法依賴的package包/類
private boolean findIfLocalDateIsInRange(String date1, String date2){

        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd");
        LocalDate dateTime1 = LocalDate.parse(date1, formatter);
        LocalDate dateTime2 = LocalDate.parse(date2, formatter);

        LocalDate now = LocalDate.now();

        return (now.isEqual(dateTime1) || now.isEqual(dateTime2)) ||
               (dateTime1.isBefore(now) && dateTime2.isAfter(now));
    }
 
開發者ID:BBVA,項目名稱:mirrorgate,代碼行數:12,代碼來源:ProgramIncrementServiceImpl.java

示例5: isValid

import java.time.LocalDate; //導入方法依賴的package包/類
@Override
public boolean isValid(LocalDate localDate, ConstraintValidatorContext cxt) {
    // Another validator should check for this if required
    if (localDate == null) {
        return true;
    }

    return !localDate.isAfter(LocalDate.now());
}
 
開發者ID:hmcts,項目名稱:cmc-claim-store,代碼行數:10,代碼來源:DateNotInTheFutureConstraintValidator.java

示例6: isDateIncludeInInterval

import java.time.LocalDate; //導入方法依賴的package包/類
/**
 * Verifie qu'une date est inclue dans un intervalle
 * 
 * @param dateToCompare
 * @return true si la date est incluse dans un interval
 */
public static Boolean isDateIncludeInInterval(LocalDate dateToCompare, LocalDate dateDebut, LocalDate dateFin) {
	if (dateToCompare == null) {
		/* Si la date est null, c'est ok! */
		return true;
	} else if ((dateToCompare.equals(dateDebut) || dateToCompare.isAfter(dateDebut))
			&& (dateToCompare.equals(dateFin) || dateToCompare.isBefore(dateFin))) {
		return true;
	}
	return false;
}
 
開發者ID:EsupPortail,項目名稱:esup-ecandidat,代碼行數:17,代碼來源:MethodUtils.java

示例7: getReservasEmAbertoNoDia

import java.time.LocalDate; //導入方法依賴的package包/類
@Override
public List<ReservaEntity> getReservasEmAbertoNoDia(LocalDate data) {
	ArrayList<ReservaEntity> resultado = new ArrayList<>();
	for (ReservaEntity vo : reservas) {
		if (data.getDayOfWeek().equals(
				vo.getDataInicio().toInstant().atZone(ZoneId.systemDefault()).toLocalDate().getDayOfWeek())) {
			if (!data.isBefore(vo.getDataInicio().toInstant().atZone(ZoneId.systemDefault()).toLocalDate())
					&& !data.isAfter(vo.getDataFim().toInstant().atZone(ZoneId.systemDefault()).toLocalDate())
					&& vo.getStatus().equals(EnumReserva.PEDIDO)) {
				resultado.add(vo);
			}
		}
	}
	return resultado;
}
 
開發者ID:dev-andremonteiro,項目名稱:AlphaLab,代碼行數:16,代碼來源:MockReservaDAO.java

示例8: getDate

import java.time.LocalDate; //導入方法依賴的package包/類
private LocalDate getDate(LocalDate startDate, int dayCount) {
    if (getSkinnable().isAdjustToFirstDayOfWeek()) {
        LocalDate newStartDate = startDate.with(DAY_OF_WEEK, getSkinnable().getFirstDayOfWeek().getValue());
        if (newStartDate.isAfter(startDate)) {
            startDate = newStartDate.minusWeeks(1);
        } else {
            startDate = newStartDate;
        }
    }

    return startDate.plusDays(dayCount);
}
 
開發者ID:dlemmermann,項目名稱:CalendarFX,代碼行數:13,代碼來源:WeekViewSkin.java

示例9: valideerMaterieelPeilmomentNietInToekomst

import java.time.LocalDate; //導入方法依賴的package包/類
private void valideerMaterieelPeilmomentNietInToekomst(String peilmomentMaterieel) throws StapMeldingException {
    LocalDate materieelPeilmoment = datumService.parseDate(peilmomentMaterieel);
    if (materieelPeilmoment != null && materieelPeilmoment.isAfter(DatumUtil.vanZonedDateTimeNaarLocalDateNederland(DatumUtil
            .nuAlsZonedDateTime()))) {
        throw new StapMeldingException(new Melding(SoortMelding.FOUT, Regel.R2295));
    }
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:8,代碼來源:PeilmomentValidatieServiceImpl.java

示例10: calculateStartDate

import java.time.LocalDate; //導入方法依賴的package包/類
private LocalDate calculateStartDate() {
    LocalDate startDate = getDate();

    if (isAdjustToFirstDayOfWeek()) {
        LocalDate newStartDate = startDate.with(DAY_OF_WEEK, getFirstDayOfWeek().getValue());
        if (newStartDate.isAfter(startDate)) {
            startDate = newStartDate.minusWeeks(1);
        } else {
            startDate = newStartDate;
        }
    }

    return startDate;
}
 
開發者ID:dlemmermann,項目名稱:CalendarFX,代碼行數:15,代碼來源:WeekView.java

示例11: select

import java.time.LocalDate; //導入方法依賴的package包/類
@Override
public void select(LocalDate date) {
    if (date != null) {
        if (rangeStart == null) {
            model.selectedDates.setAll(date);
            model.lastSelected = date;
            rangeStart = date;
            rangeEnd = date;
        } else {
            if (date.equals(rangeStart.plusDays(-1)) || date.equals(rangeEnd.plusDays(1))) {
                model.selectedDates.add(date);
                model.lastSelected = date;

                if (date.isAfter(rangeEnd)) {
                    rangeEnd = date;
                }

                if (date.isBefore(rangeStart)) {
                    rangeStart = date;
                }
            } else {
                rangeStart = null;
                rangeEnd = null;
                select(date);
            }
        }
    }
}
 
開發者ID:dlemmermann,項目名稱:CalendarFX,代碼行數:29,代碼來源:DateSelectionModel.java

示例12: isRecurrenceShowing

import java.time.LocalDate; //導入方法依賴的package包/類
private boolean isRecurrenceShowing(Entry<?> entry, ZonedDateTime st, ZonedDateTime et, ZoneId zoneId) {
    String recurrenceRule = entry.getRecurrenceRule();

    LocalDate utilStartDate = entry.getStartAsZonedDateTime().toLocalDate();

    try {
        LocalDate utilEndDate = et.toLocalDate();

        LocalDateIterator iterator = LocalDateIteratorFactory.createLocalDateIterator(recurrenceRule, utilStartDate, zoneId, true);

        /*
         * TODO: for performance reasons we should definitely
         * use the advanceTo() call, but unfortunately this
         * collides with the fact that e.g. the DetailedWeekView loads
         * data day by day. So a given day would not show
         * entries that start on the day before but intersect
         * with the given day. We have to find a solution for
         * this.
         */
        // iterator.advanceTo(org.joda.time.LocalDate.fromDateFields(Date.from(st.toInstant())));

        while (iterator.hasNext()) {
            LocalDate repeatingDate = iterator.next();
            if (repeatingDate.isAfter(utilEndDate)) {
                break;
            } else {
                ZonedDateTime recurrenceStart = ZonedDateTime.of(repeatingDate, LocalTime.MIN, zoneId);
                ZonedDateTime recurrenceEnd = recurrenceStart.plus(entry.getDuration());

                if (Util.intersect(recurrenceStart, recurrenceEnd, st, et)) {
                    return true;
                }
            }
        }
    } catch (ParseException ex) {
        ex.printStackTrace();
    }

    return false;
}
 
開發者ID:dlemmermann,項目名稱:CalendarFX,代碼行數:41,代碼來源:Entry.java

示例13: testCrossSectionalReturns

import java.time.LocalDate; //導入方法依賴的package包/類
@Test()
public void testCrossSectionalReturns() throws Exception {
    LocalDate startDate = LocalDate.MIN;
    LocalDate endDate = LocalDate.MAX;
    final Index<LocalDate> rowKeys = Index.of(LocalDate.class, 100);
    final Index<String> tickers = Index.of("BLK", "CSCO", "SPY", "YHOO", "VNQI", "VGLT", "VCLT");
    final DataFrame<LocalDate,String> closePrices = DataFrame.ofDoubles(rowKeys, tickers);
    for (String ticker : tickers) {
        System.out.println("Loading data for ticker " + ticker);
        final DataFrame<LocalDate,String> quotes = TestDataFrames.getQuotes(ticker);
        quotes.tail(10).out().print();
        closePrices.rows().addAll(quotes.rows().keyArray());
        final LocalDate firstKey = quotes.rows().firstKey().get();
        final LocalDate lastKey = quotes.rows().lastKey().get();
        startDate = firstKey.isAfter(startDate) ? firstKey : startDate;
        endDate = lastKey.isBefore(endDate) ? lastKey : endDate;
        quotes.rows().forEach(row -> {
            final LocalDate date = row.key();
            final double price = row.getDouble("Adj Close");
            closePrices.data().setDouble(date, ticker, price);
        });
    }

    final Set<LocalDate> nanDates = new HashSet<>();
    closePrices.rows().forEach(row -> row.forEachValue(v -> {
        final double value = v.getDouble();
        if (Double.isNaN(value)) {
            final LocalDate rowKey = row.key();
            nanDates.add(rowKey);
            if (rowKey.getYear() == 2014) {
                System.out.println(rowKey);
            }
        }
    }));

    final DataFrame<LocalDate,String> selection = closePrices.rows().select(row -> !nanDates.contains(row.key()));
    final DataFrame<LocalDate,String> sorted = selection.rows().sort((row1, row2) -> row1.key().compareTo(row2.key()));
    final DataFrame<LocalDate,String> returns = sorted.calc().percentChanges();
    returns.rows().first().get().applyDoubles(v -> 0d);
    returns.head(10).out().print();
    returns.cols().stats().correlation().out().print();
}
 
開發者ID:zavtech,項目名稱:morpheus-core,代碼行數:43,代碼來源:QuoteTests.java

示例14: executeWithConfig

import java.time.LocalDate; //導入方法依賴的package包/類
@Override
protected void executeWithConfig(CommandEvent commandEvent, Config config) {
    final User user = commandEvent.getAuthor();
    final String[] args = commandEvent.getArgs().replaceAll("\\s{1,3}", " ").split(" ");
    if (args.length < 3) {
        throw new UserMessedUpException(user, localeService.getMessageFor(LocaleService.BAD_SYNTAX,
                localeService.getLocaleForUser(user), "!raid ex mewtwo 2017-11-11 10:00 solna platform"));
    }
    String pokemonName = args[0];
    final Pokemon pokemon = pokemonRepository.search(pokemonName, user);
    final Locale locale = localeService.getLocaleForUser(user);
    if (!Utils.isRaidExPokemon(pokemon.getName())) {
        throw new UserMessedUpException(user, localeService.getMessageFor(LocaleService.NOT_EX_RAID,
                locale, pokemonName));
    }

    String dateString = args[1];
    String timeString = args[2];
    LocalTime endsAtTime = Utils.parseTime(user, timeString, localeService);
    LocalDate endsAtDate = Utils.parseDate(user, dateString, localeService);
    LocalDateTime endsAt = LocalDateTime.of(endsAtDate, endsAtTime);

    assertTimeNotInNoRaidTimespan(user, endsAtTime, localeService);
    if (endsAtDate.isAfter(LocalDate.now().plusDays(10))) {
        throw new UserMessedUpException(user, localeService.getMessageFor(LocaleService.EX_DATE_LIMITS,
                locale));
    }
    assertCreateRaidTimeNotBeforeNow(user, endsAt, localeService);

    StringBuilder gymNameBuilder = new StringBuilder();
    for (int i = 3; i < args.length; i++) {
        gymNameBuilder.append(args[i]).append(" ");
    }
    String gymName = gymNameBuilder.toString().trim();
    final Gym gym = gymRepository.search(user, gymName, config.getRegion());
    final Raid raid = new Raid(pokemon, endsAt, gym, localeService, config.getRegion());
    if (!raid.isExRaid()) {
        throw new UserMessedUpException(user, localeService.getMessageFor(LocaleService.NOT_EX_RAID,
                locale, pokemonName));
    }
    raidRepository.newRaid(user, raid, commandEvent.getGuild(), config,
            "!raid ex " + raid.getPokemon().getName() + " " + printTimeIfSameDay(raid.getEndOfRaid()) +
    " " + gym.getName());
    replyBasedOnConfig(config, commandEvent, localeService.getMessageFor(LocaleService.NEW_RAID_CREATED,
            locale, raid.toString(locale)));
}
 
開發者ID:magnusmickelsson,項目名稱:pokeraidbot,代碼行數:47,代碼來源:NewRaidExCommand.java

示例15: requireValidOrderOfDates

import java.time.LocalDate; //導入方法依賴的package包/類
private static void requireValidOrderOfDates(LocalDate startDate, LocalDate endDate) {
    if (startDate.isAfter(endDate)) {
        throw new IllegalArgumentException("StartDate cannot be after endDate");
    }
}
 
開發者ID:hmcts,項目名稱:cmc-claim-store,代碼行數:6,代碼來源:TotalAmountCalculator.java


注:本文中的java.time.LocalDate.isAfter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。