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


Java LocalDate.compareTo方法代碼示例

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


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

示例1: initTimeline

import java.time.LocalDate; //導入方法依賴的package包/類
private void initTimeline(LocalDate start, LocalDate end) {
	this.timelineStart = start;
	this.timelineEnd = end;
	
	for(int m = start.getMonthValue(); m <= end.getMonthValue(); m++) {
		TableColumn<GanttTask,GanttBarPiece> monthCol = new TableColumn<GanttTask,GanttBarPiece>();
		Label month = new Label(Month.of(m).toString());
		monthCol.setGraphic(month);
		monthCol.setResizable(false);

		LocalDate tmp = LocalDate.of(start.getYear(), m, 1);
		LocalDate chartStart = start.compareTo(tmp) > 0 ? start : tmp;

		for(int d = chartStart.getDayOfMonth(); d <= chartStart.lengthOfMonth(); d++) {
			GanttDayColumn c = new GanttDayColumn(chartStart.getYear(), m, d);
			c.setPrefWidth(20);
			Label day = new Label(Integer.toString(d));
			c.setGraphic(day);
			monthCol.getColumns().add(c);
		}

		this.getColumns().add(monthCol);
	}
	// TODO make timeline right-left scrollable with wheel on windows 
}
 
開發者ID:vibridi,項目名稱:qgu,代碼行數:26,代碼來源:TimelineView.java

示例2: from

import java.time.LocalDate; //導入方法依賴的package包/類
/**
 * Obtains an instance of {@code JapaneseEra} from a date.
 *
 * @param date  the date, not null
 * @return the Era singleton, never null
 */
static JapaneseEra from(LocalDate date) {
    if (date.isBefore(MEIJI_6_ISODATE)) {
        throw new DateTimeException("JapaneseDate before Meiji 6 are not supported");
    }
    for (int i = KNOWN_ERAS.length - 1; i > 0; i--) {
        JapaneseEra era = KNOWN_ERAS[i];
        if (date.compareTo(era.since) >= 0) {
            return era;
        }
    }
    return null;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:19,代碼來源:JapaneseEra.java

示例3: privateEraFrom

import java.time.LocalDate; //導入方法依賴的package包/類
static sun.util.calendar.Era privateEraFrom(LocalDate isoDate) {
    for (int i = KNOWN_ERAS.length - 1; i > 0; i--) {
        JapaneseEra era = KNOWN_ERAS[i];
        if (isoDate.compareTo(era.since) >= 0) {
            return ERA_CONFIG[i];
        }
    }
    return null;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:10,代碼來源:JapaneseEra.java

示例4: RangeOfLocalDates

import java.time.LocalDate; //導入方法依賴的package包/類
/**
 * Constructor
 * @param start     the start for range, inclusive
 * @param end       the end for range, exclusive
 * @param step      the step increment
 * @param excludes  optional predicate to exclude elements in this range
 */
RangeOfLocalDates(LocalDate start, LocalDate end, Period step, Predicate<LocalDate> excludes) {
    super(start, end);
    this.step = step;
    this.ascend = start.compareTo(end) <= 0;
    this.excludes = excludes;
}
 
開發者ID:zavtech,項目名稱:morpheus-core,代碼行數:14,代碼來源:RangeOfLocalDates.java

示例5: inBounds

import java.time.LocalDate; //導入方法依賴的package包/類
/**
 * Checks that the value specified is in the bounds of this range
 * @param value     the value to check if in bounds
 * @return          true if in bounds
 */
private boolean inBounds(LocalDate value) {
    return ascend ? value.compareTo(start()) >=0 && value.isBefore(end()) : value.compareTo(start()) <=0 && value.isAfter(end());
}
 
開發者ID:zavtech,項目名稱:morpheus-core,代碼行數:9,代碼來源:RangeOfLocalDates.java


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