当前位置: 首页>>代码示例>>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;未经允许,请勿转载。