本文整理汇总了Java中java.time.LocalTime.MAX属性的典型用法代码示例。如果您正苦于以下问题:Java LocalTime.MAX属性的具体用法?Java LocalTime.MAX怎么用?Java LocalTime.MAX使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.time.LocalTime
的用法示例。
在下文中一共展示了LocalTime.MAX属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: data_adjustInto
@DataProvider(name="adjustInto")
Object[][] data_adjustInto() {
return new Object[][]{
{LocalTime.of(23, 5), LocalTime.of(4, 1, 1, 100), LocalTime.of(23, 5, 0, 0), null},
{LocalTime.of(23, 5, 20), LocalTime.of(4, 1, 1, 100), LocalTime.of(23, 5, 20, 0), null},
{LocalTime.of(23, 5, 20, 1000), LocalTime.of(4, 1, 1, 100), LocalTime.of(23, 5, 20, 1000), null},
{LocalTime.of(23, 5, 20, 1000), LocalTime.MAX, LocalTime.of(23, 5, 20, 1000), null},
{LocalTime.of(23, 5, 20, 1000), LocalTime.MIN, LocalTime.of(23, 5, 20, 1000), null},
{LocalTime.of(23, 5, 20, 1000), LocalTime.NOON, LocalTime.of(23, 5, 20, 1000), null},
{LocalTime.of(23, 5, 20, 1000), LocalTime.MIDNIGHT, LocalTime.of(23, 5, 20, 1000), null},
{LocalTime.MAX, LocalTime.of(23, 5, 20, 1000), LocalTime.of(23, 59, 59, 999999999), null},
{LocalTime.MIN, LocalTime.of(23, 5, 20, 1000), LocalTime.of(0, 0, 0), null},
{LocalTime.NOON, LocalTime.of(23, 5, 20, 1000), LocalTime.of(12, 0, 0), null},
{LocalTime.MIDNIGHT, LocalTime.of(23, 5, 20, 1000), LocalTime.of(0, 0, 0), null},
{LocalTime.of(23, 5), LocalDateTime.of(2210, 2, 2, 1, 1), LocalDateTime.of(2210, 2, 2, 23, 5), null},
{LocalTime.of(23, 5), OffsetTime.of(1, 1, 0, 0, OFFSET_PTWO), OffsetTime.of(23, 5, 0, 0, OFFSET_PTWO), null},
{LocalTime.of(23, 5), OffsetDateTime.of(2210, 2, 2, 1, 1, 0, 0, OFFSET_PTWO), OffsetDateTime.of(2210, 2, 2, 23, 5, 0, 0, OFFSET_PTWO), null},
{LocalTime.of(23, 5), ZonedDateTime.of(2210, 2, 2, 1, 1, 0, 0, ZONE_PARIS), ZonedDateTime.of(2210, 2, 2, 23, 5, 0, 0, ZONE_PARIS), null},
{LocalTime.of(23, 5), LocalDate.of(2210, 2, 2), null, DateTimeException.class},
{LocalTime.of(23, 5), null, null, NullPointerException.class},
};
}
示例2: parseTime
/**
* parses a local time string inputted by a user into a ZonedDateTime object
* @param userInput the local time
* @return new ZonedDateTime with the new time
*/
public static LocalTime parseTime(String userInput)
{
LocalTime time;
// relative time
if(userInput.matches(".+[mM][iI][nN]$"))
{
time = LocalTime.now().plusMinutes(Long.parseLong(userInput.replaceAll("[^\\d]", "")));
}
// absolute time
else if(userInput.equals("24:00") || userInput.equals("24")) // 24:00 is not really a valid time
{
time = LocalTime.MAX;
}
else if(userInput.contains(":")) // 1:00pm or 13:00
{
if(userInput.matches(".+([aApP][mM])"))
{
time = LocalTime.parse(userInput.toUpperCase(), DateTimeFormatter.ofPattern("h:mma"));
}
else
{
time = LocalTime.parse(userInput, DateTimeFormatter.ofPattern("H:mm"));
}
}
else // 1pm or 13
{
if(userInput.matches(".+([aApP][mM])"))
{
time = LocalTime.parse(userInput.toUpperCase(), DateTimeFormatter.ofPattern("ha"));
}
else
{
time = LocalTime.parse(userInput, DateTimeFormatter.ofPattern("H"));
}
}
return time;
}
示例3: draw
public void draw() {
final double width = getWidth();
final double height = getHeight();
GraphicsContext gc = getGraphicsContext2D();
gc.clearRect(0, 0, width, height);
if (entries != null && !entries.isEmpty()) {
for (Entry<?> entry : entries) {
com.calendarfx.model.Calendar calendar = entry.getCalendar();
if (calendar == null) {
continue;
}
Color color = getCalendarColor(calendar.getStyle());
gc.setFill(color);
if (entry.isFullDay()) {
gc.fillRect(0, 0, width, height);
} else {
LocalTime startTime = entry.getStartTime();
LocalTime endTime = entry.getEndTime();
if (entry.getStartDate().isBefore(getDate())) {
startTime = LocalTime.MIN;
}
if (entry.getEndDate().isAfter(getDate())) {
endTime = LocalTime.MAX;
}
double y = height * (startTime.toSecondOfDay() / (double) LocalTime.MAX.toSecondOfDay());
double h = height * (endTime.toSecondOfDay() / (double) LocalTime.MAX.toSecondOfDay());
gc.fillRect(0, y, width, h - y);
}
}
}
}
示例4: splitDatesIntoMonths
public static List<Date[]> splitDatesIntoMonths(Date from, Date to) throws IllegalArgumentException {
List<Date[]> dates = new ArrayList<>();
LocalDateTime dFrom = asLocalDateTime(from);
LocalDateTime dTo = asLocalDateTime(to);
if (dFrom.compareTo(dTo) >= 0) {
throw new IllegalArgumentException("Provide a to-date greater than the from-date");
}
while (dFrom.compareTo(dTo) < 0) {
// check if current time frame is last
boolean isLastTimeFrame = dFrom.getMonthValue() == dTo.getMonthValue() && dFrom.getYear() == dTo.getYear();
// define day of month based on timeframe. if last - take boundaries from end date, else end of month and date
int dayOfMonth = isLastTimeFrame ? dTo.getDayOfMonth() : dFrom.with(TemporalAdjusters.lastDayOfMonth()).getDayOfMonth();
LocalTime time = isLastTimeFrame ? dTo.toLocalTime() : LocalTime.MAX;
// build timeframe
Date[] dar = new Date[2];
dar[0] = asDate(dFrom);
dar[1] = asDate(dFrom.withDayOfMonth(dayOfMonth).toLocalDate().atTime(time));
// add current timeframe
dates.add(dar);
// jump to beginning of next month
dFrom = dFrom.plusMonths(1).withDayOfMonth(1).toLocalDate().atStartOfDay();
}
return dates;
}
示例5: WeekView
public WeekView(ObjectProperty<LocalDate> dateBegin, int numberOfDays, Calendar... calendar) {
this(dateBegin, numberOfDays, LocalTime.MIN, LocalTime.MAX, new WeekViewRenderer(), new FlexAppointmentFactory(), calendar);
}
示例6: DayView
public DayView(ObjectProperty<LocalDate> date, Calendar... calendar) {
this(date, LocalTime.MIN, LocalTime.MAX, new DayViewRenderer(), new FlexAppointmentFactory(), calendar);
}
示例7: createControl
@Override
protected DateControl createControl() {
CalendarSource source = new CalendarSource();
source.setName("Demo Source");
Calendar[] calendar = new Calendar[7];
for (int i = 0; i < 7; i++) {
calendar[i] = new Calendar("Calendar " + i);
calendar[i].setStyle(Calendar.Style.getStyle(i));
}
for (int i = 0; i < 1000; i++) {
Entry<String> entry = new Entry<>("Entry " + i);
LocalDate date = LocalDate.now();
if (Math.random() < .5) {
date = date.minusDays((long) (Math.random() * 365));
} else {
date = date.plusDays((long) (Math.random() * 365));
}
LocalTime start = LocalTime.of((int) (Math.random() * 20), (int) (Math.random() * 30));
Duration duration = Duration.ofHours((int) (Math.random() * 8));
LocalTime end = start.plus(duration);
if (end.isBefore(start)) {
end = LocalTime.MAX;
}
entry.changeStartDate(date);
entry.changeEndDate(date);
entry.changeStartTime(start);
entry.changeEndTime(end);
if (Math.random() > .9) {
entry.setFullDay(true);
}
entry.setCalendar(calendar[(int) (Math.random() * 7)]);
}
source.getCalendars().addAll(calendar);
monthView = new MonthSheetView();
monthView.getCalendarSources().add(source);
monthView.setCellFactory(param -> new MonthSheetView.DetailedDateCell(param.getView(), param.getDate()));
return monthView;
}
示例8: trimTimeBounds
private void trimTimeBounds() {
if (this instanceof WeekDayView) {
return;
}
LoggingDomain.PRINTING.fine("trimming hours");
LocalTime st = LocalTime.of(8, 0);
LocalTime et = LocalTime.of(19, 0);
LocalTime etu = getEarliestTimeUsed();
LocalTime ltu = getLatestTimeUsed();
LoggingDomain.PRINTING.fine("earliest time: " + etu + ", latest time: " + ltu);
setEarlyLateHoursStrategy(EarlyLateHoursStrategy.HIDE);
if (etu != null && ltu != null && ltu.isAfter(etu)) {
// some padding before the first entry
if (!etu.isBefore(LocalTime.of(1, 0))) {
etu = etu.minusHours(1);
} else {
etu = LocalTime.MIN;
}
// some padding after the last entry
if (!ltu.isAfter(LocalTime.of(23, 0))) {
ltu = ltu.plusHours(1);
} else {
ltu = LocalTime.MAX;
}
// only adjust start time if it is too late
if (etu.isBefore(st.plusHours(1))) {
setStartTime(etu);
} else {
setStartTime(st);
}
// only adjust end time if it is too early
if (ltu.isAfter(et.minusHours(1))) {
setEndTime(ltu);
} else {
setEndTime(et);
}
} else {
setStartTime(st);
setEndTime(et);
}
setVisibleHours(Math.min(24, (int) getStartTime().until(getEndTime(), ChronoUnit.HOURS)));
}
示例9: updateEntries
private void updateEntries(String reason) {
displayedDate = getSkinnable().getDate();
getChildren().removeIf(node -> node instanceof DayEntryView);
Map<LocalDate, List<Entry<?>>> dataMap = new HashMap<>();
dataLoader.loadEntries(dataMap);
List<Entry<?>> entryList = dataMap.get(getSkinnable().getDate());
LocalTime earliest = null;
LocalTime latest = null;
if (entryList != null) {
entryList.removeIf(Entry::isFullDay);
for (Entry<?> entry : entryList) {
doAddEntryView(entry);
if (earliest == null || entry.getStartTime().isBefore(earliest)) {
earliest = entry.getStartTime();
}
if (entry.getStartDate().isBefore(getSkinnable().getDate())) {
earliest = LocalTime.MIN;
}
if (latest == null || entry.getEndTime().isAfter(latest)) {
latest = entry.getEndTime();
}
if (entry.getEndDate().isAfter(getSkinnable().getDate())) {
latest = LocalTime.MAX;
}
}
}
getSkinnable().getProperties().put("earliest.time.used", earliest);
getSkinnable().getProperties().put("latest.time.used", latest);
getSkinnable().requestLayout();
LoggingDomain.VIEW.fine("updating entries in day view " + getSkinnable().getDate() + ": reason = " + reason + ", entry count: " + getChildren().stream().filter(child -> child instanceof DayEntryView).count());
}
示例10: setup
@Before
public void setup() {
interval = new Interval(LocalDate.now(), LocalTime.MIN, LocalDate.now(), LocalTime.MAX);
}
示例11: samples
@Override
protected List<TemporalAccessor> samples() {
TemporalAccessor[] array = {TEST_12_30_40_987654321, LocalTime.MIN, LocalTime.MAX, LocalTime.MIDNIGHT, LocalTime.NOON};
return Arrays.asList(array);
}
示例12: DayPane
/**
* Creates a new DayPane with associated with the given date. The DayPane covers the full day and
* uses the default renderer.
*
* @param date The date associated with this DayPane. Only appointments for this date will be displayed.
*/
public DayPane(LocalDate date) {
this(date, LocalTime.MIN, LocalTime.MAX);
}