當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。