当前位置: 首页>>代码示例>>Java>>正文


Java LocalDate.equals方法代码示例

本文整理汇总了Java中java.time.LocalDate.equals方法的典型用法代码示例。如果您正苦于以下问题:Java LocalDate.equals方法的具体用法?Java LocalDate.equals怎么用?Java LocalDate.equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.time.LocalDate的用法示例。


在下文中一共展示了LocalDate.equals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTreasureHuntEventSession

import java.time.LocalDate; //导入方法依赖的package包/类
public TreasureHuntEventSession getTreasureHuntEventSession(Long activePersonaId) {
	TreasureHuntEntity treasureHuntEntity = treasureHuntDao.findById(activePersonaId);
	if(treasureHuntEntity == null) {
		driverPersonaBo.createThInformation(personaDao.findById(activePersonaId));
		return getTreasureHuntEventSession(activePersonaId);
	}
	
	LocalDate thDate = treasureHuntEntity.getThDate();
	LocalDate nowDate = LocalDate.now();
	if(!thDate.equals(nowDate)) {
		Integer days = (int) ChronoUnit.DAYS.between(thDate, nowDate);
		if(days >= 2 || treasureHuntEntity.getCoinsCollected() != 32767) {
			return createNewTreasureHunt(treasureHuntEntity, true);
		} else {
			return createNewTreasureHunt(treasureHuntEntity, false);
		}
	}
	
	TreasureHuntEventSession treasureHuntEventSession = new TreasureHuntEventSession();
	treasureHuntEventSession.setCoinsCollected(treasureHuntEntity.getCoinsCollected());
	treasureHuntEventSession.setIsStreakBroken(treasureHuntEntity.getIsStreakBroken());
	treasureHuntEventSession.setNumCoins(treasureHuntEntity.getNumCoins());
	treasureHuntEventSession.setSeed(treasureHuntEntity.getSeed());
	treasureHuntEventSession.setStreak(treasureHuntEntity.getStreak());
	return treasureHuntEventSession;
}
 
开发者ID:SoapboxRaceWorld,项目名称:soapbox-race-core,代码行数:27,代码来源:EventsBO.java

示例2: renderDayItem

import java.time.LocalDate; //导入方法依赖的package包/类
/**
 * Creates a node for a given day. Styling should be done via CSS, but
 * appropriate CSS classes are assigned to each node.
 * @param date A given date the node is associated with.
 * @return A node that displays the day of month.
 */
private Node renderDayItem(LocalDate date) {
    Label lblDate = new Label(""+date.getDayOfMonth());
    lblDate.getStyleClass().add("daychooser-day");
    if(date.getDayOfWeek() == DayOfWeek.SATURDAY
            || date.getDayOfWeek() == DayOfWeek.SUNDAY) {
        lblDate.getStyleClass().add("daychooser-weekend");
    } else {
        lblDate.getStyleClass().add("daychooser-weekday");
    }
    if(date.equals(selectedDateProperty.get())) {
        lblDate.getStyleClass().add("daychooser-selected-day");
    }
    if(date.equals(LocalDate.now())) {
        lblDate.getStyleClass().add("daychooser-current-day");
    }

    return lblDate;
}
 
开发者ID:Jibbow,项目名称:FastisFX,代码行数:25,代码来源:DayChooser.java

示例3: updateStyleClasses

import java.time.LocalDate; //导入方法依赖的package包/类
private void updateStyleClasses() {
    LocalDate date = getDate();
    if (date.equals(getToday())) {
        if (!getStyleClass().contains(DAY_VIEW_TODAY)) {
            getStyleClass().add(DAY_VIEW_TODAY);
        }
    } else {
        getStyleClass().remove(DAY_VIEW_TODAY);
    }

    if (getWeekendDays().contains(date.getDayOfWeek())) {
        if (!getStyleClass().contains(DAY_VIEW_WEEKEND_DAY)) {
            getStyleClass().add(DAY_VIEW_WEEKEND_DAY);
        }
    } else {
        getStyleClass().remove(DAY_VIEW_WEEKEND_DAY);
    }
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:19,代码来源:DayView.java

示例4: validate

import java.time.LocalDate; //导入方法依赖的package包/类
@Override
protected boolean validate() {
    LocalDate start = date.getValue();
    LocalDate end = endDate.getValue();

    if (name.getText().isEmpty()) {
        MessageHelper.showErrorAlertMessage("The Name is missing.");
        name.requestFocus();
        return false;
    } else if (start == null) {
        MessageHelper.showErrorAlertMessage("Startdate has to be set.");
        date.requestFocus();
        return false;
    } else if (end == null) {
        MessageHelper.showErrorAlertMessage("Enddate has to be set.");
        endDate.requestFocus();
        return false;
    } else if (start.isAfter(end) || start.equals(end)) {
        MessageHelper.showErrorAlertMessage("Enddate has to be after the startdate.");
        return false;
    } else if (musicalWorks == null || musicalWorks.isEmpty()) {
        MessageHelper.showErrorAlertMessage("A musical work has to be selected.");
        return false;
    }
    return true;
}
 
开发者ID:ITB15-S4-GroupD,项目名称:Planchester,代码行数:27,代码来源:CreateTourController.java

示例5: getTimeText

import java.time.LocalDate; //导入方法依赖的package包/类
/**
 * Creates a nicely formatted text that contains the start and end time of
 * the given entry. The text can also be something like "full day" if the entry
 * is a full-day entry.
 *
 * @param entry the entry for which the text will be created
 * @return a text showing the start and end times of the entry
 */
protected String getTimeText(Entry<?> entry) {
    if (entry.isFullDay()) {
        return Messages.getString("AgendaEntryCell.ALL_DAY");//$NON-NLS-1$
    }

    LocalDate startDate = entry.getStartDate();
    LocalDate endDate = entry.getEndDate();

    String text;

    if (startDate.equals(endDate)) {
        text = MessageFormat.format(Messages.getString("AgendaEntryCell.ENTRY_TIME_RANGE"), //$NON-NLS-1$
                timeFormatter.format(entry.getStartTime()), timeFormatter.format(entry.getEndTime()));
    } else {
        text = MessageFormat.format(Messages.getString("AgendaEntryCell.ENTRY_TIME_RANGE_WITH_DATE"), //$NON-NLS-1$
                shortDateFormatter.format(entry.getStartDate()), timeFormatter.format(entry.getStartTime()), shortDateFormatter.format(entry.getEndDate()),
                timeFormatter.format(entry.getEndTime()));
    }

    return text;
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:30,代码来源:AgendaView.java

示例6: now_ZoneId

import java.time.LocalDate; //导入方法依赖的package包/类
@Test
public void now_ZoneId() {
    ZoneId zone = ZoneId.of("UTC+01:02:03");
    LocalDate expected = LocalDate.now(Clock.system(zone));
    LocalDate test = LocalDate.now(zone);
    for (int i = 0; i < 100; i++) {
        if (expected.equals(test)) {
            return;
        }
        expected = LocalDate.now(Clock.system(zone));
        test = LocalDate.now(zone);
    }
    assertEquals(test, expected);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:15,代码来源:TCKLocalDate.java

示例7: createSingleDayHeader

import java.time.LocalDate; //导入方法依赖的package包/类
public Node createSingleDayHeader(LocalDate date) {
    final Label lblWeekday = new Label(date.getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.getDefault()));
    lblWeekday.getStyleClass().add("header-weekday");
    final Label lblDate = new Label(DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).format(date));
    lblDate.getStyleClass().add("header-date");
    VBox container = new VBox(lblDate, lblWeekday);
    container.getStyleClass().add("header-container");
    if(date.equals(LocalDate.now())) {
        container.getStyleClass().add("header-container-today");
    }
    container.setAlignment(Pos.TOP_CENTER);
    return container;
}
 
开发者ID:Jibbow,项目名称:FastisFX,代码行数:14,代码来源:WeekViewRenderer.java

示例8: 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

示例9: SingleDateRangeSelector

import java.time.LocalDate; //导入方法依赖的package包/类
public SingleDateRangeSelector(DateSelectionModel model) {
    super(model);

    List<LocalDate> selection = new ArrayList<>();
    selection.addAll(model.selectedDates);

    if (!selection.isEmpty()) {
        Collections.sort(selection);

        boolean valid = true;
        for (int i = 0; i < selection.size() - 1; i++) {
            if (i == selection.size() - 1) {
                break;
            }

            LocalDate pivot = selection.get(i);
            LocalDate next = selection.get(i + 1);

            if (!next.equals(pivot.plusDays(1))) {
                valid = false;
                break;
            }
        }

        if (!valid) {
            clear();
        } else {
            rangeStart = selection.get(0);
            rangeEnd = selection.get(selection.size() - 1);
            model.lastSelected = rangeEnd;
        }
    }
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:34,代码来源:DateSelectionModel.java

示例10: now

import java.time.LocalDate; //导入方法依赖的package包/类
@Test
public void now() {
    LocalDate expected = LocalDate.now(Clock.systemDefaultZone());
    LocalDate test = LocalDate.now();
    for (int i = 0; i < 100; i++) {
        if (expected.equals(test)) {
            return;
        }
        expected = LocalDate.now(Clock.systemDefaultZone());
        test = LocalDate.now();
    }
    assertEquals(test, expected);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:14,代码来源:TCKLocalDate.java

示例11: Interval

import java.time.LocalDate; //导入方法依赖的package包/类
/**
 * Constructs a new time interval with the given start and end dates / times
 * and time zone.
 *
 * @param startDate the start date (e.g. Oct. 3rd, 2015)
 * @param startTime the start time (e.g. 10:45am)
 * @param endDate   the end date
 * @param endTime   the end time
 * @param zoneId    the time zone
 */
public Interval(LocalDate startDate, LocalTime startTime, LocalDate endDate, LocalTime endTime, ZoneId zoneId) {
    this.startDate = requireNonNull(startDate);
    this.startTime = requireNonNull(startTime);
    this.endDate = requireNonNull(endDate);
    this.endTime = requireNonNull(endTime);
    this.zoneId = requireNonNull(zoneId);

    if (startDate.isAfter(endDate)) {
        throw new IllegalArgumentException("the start date can never be after the end date");
    }

    /*
     * Now we know that the start date is either earlier than the end date or
     * on the same date.
     */

    if (startDate.equals(endDate)) {

        /*
         * If the start date and the end date are on the same date then we have to make sure that the
         * start time is not after the end time.
         */
        if (getStartTime().isAfter(getEndTime())) {
            throw new IllegalArgumentException("the start time can not be after the end time if both are on the same date");
        }
    }
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:38,代码来源:Interval.java

示例12: updateRegion

import java.time.LocalDate; //导入方法依赖的package包/类
private void updateRegion(Region region, int day) {
    final AllDayView view = getSkinnable();

    LocalDate startDate = view.getDate();

    if (view.isAdjustToFirstDayOfWeek()) {
        startDate = Util.adjustToFirstDayOfWeek(view.getDate(), view.getFirstDayOfWeek());
    }

    LocalDate date = getDate(startDate, day);

    if (view.isShowToday() && date.equals(view.getToday())) {
        if (!region.getStyleClass().contains(ALL_DAY_BACKGROUND_REGION_TODAY)) {
            region.getStyleClass().add(ALL_DAY_BACKGROUND_REGION_TODAY);
        }
    } else {
        region.getStyleClass().remove(ALL_DAY_BACKGROUND_REGION_TODAY);
    }

    if (view.getWeekendDays().contains(date.getDayOfWeek())) {
        if (!region.getStyleClass().contains(ALL_DAY_BACKGROUND_REGION_WEEKEND)) {
            region.getStyleClass().add(ALL_DAY_BACKGROUND_REGION_WEEKEND);
        }
    } else {
        region.getStyleClass().remove(ALL_DAY_BACKGROUND_REGION_WEEKEND);
    }
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:28,代码来源:AllDayViewSkin.java

示例13: intersect

import java.time.LocalDate; //导入方法依赖的package包/类
public static boolean intersect(LocalDate aStart, LocalDate aEnd,
                                LocalDate bStart, LocalDate bEnd) {

    // Same start time or same end time?
    if (aStart.equals(bStart) || aEnd.equals(bEnd)) {
        return true;
    }

    return aStart.isBefore(bEnd) && aEnd.isAfter(bStart);

}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:12,代码来源:Util.java

示例14: with

import java.time.LocalDate; //导入方法依赖的package包/类
private JapaneseDate with(LocalDate newDate) {
    return (newDate.equals(isoDate) ? this : new JapaneseDate(newDate));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:JapaneseDate.java

示例15: requestStartDate

import java.time.LocalDate; //导入方法依赖的package包/类
public final void requestStartDate(LocalDate date) {
    if (date == null) {
        return;
    }

    switch (getViewType()) {
        case DAY_VIEW:
            if (date.equals(getToday())) {
                startField.setValue(TimeRangeField.TimeRangeFieldValue.TODAY);
                endField.setValue(TimeRangeField.TimeRangeFieldValue.TODAY);
            } else if (date.equals(getTomorrow())) {
                startField.setValue(TimeRangeField.TimeRangeFieldValue.TOMORROW);
                endField.setValue(TimeRangeField.TimeRangeFieldValue.TOMORROW);
            } else {
                startField.setValue(TimeRangeField.TimeRangeFieldValue.ON_DATE);
                startField.setOnDate(date);
                endField.setValue(TimeRangeField.TimeRangeFieldValue.ON_DATE);
                endField.setOnDate(date);
            }
            break;

        case WEEK_VIEW:
            if (date.equals(getThisWeekDate())) {
                startField.setValue(TimeRangeField.TimeRangeFieldValue.THIS_WEEK);
                endField.setValue(TimeRangeField.TimeRangeFieldValue.THIS_WEEK);
            } else if (date.equals(getNextWeekDate())) {
                startField.setValue(TimeRangeField.TimeRangeFieldValue.NEXT_WEEK);
                endField.setValue(TimeRangeField.TimeRangeFieldValue.NEXT_WEEK);
            } else {
                startField.setValue(TimeRangeField.TimeRangeFieldValue.ON_DATE);
                startField.setOnDate(date);
                endField.setValue(TimeRangeField.TimeRangeFieldValue.ON_DATE);
                endField.setOnDate(date);
            }
            break;

        case MONTH_VIEW:
            if (date.equals(getThisMonthDate())) {
                startField.setValue(TimeRangeField.TimeRangeFieldValue.THIS_MONTH);
                endField.setValue(TimeRangeField.TimeRangeFieldValue.THIS_MONTH);
            } else if (date.equals(getNextMonthDate())) {
                startField.setValue(TimeRangeField.TimeRangeFieldValue.NEXT_MONTH);
                endField.setValue(TimeRangeField.TimeRangeFieldValue.NEXT_MONTH);
            } else {
                TimeRangeField.TimeRangeFieldValue month = TimeRangeField.TimeRangeFieldValue.getFromMonth(date.getMonth());
                int year = date.getYear();
                endField.setValue(month);
                endField.setMonthYear(year);
                startField.setValue(month);
                startField.setMonthYear(year);
            }
            break;

        default:
            throw new UnsupportedOperationException("Not supported yet!: " + getViewType());
    }
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:58,代码来源:TimeRangeView.java


注:本文中的java.time.LocalDate.equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。