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