this.hour = new Hour(schedule.getHour()); this.dayOfWeek = new DayOfWeek(schedule.getDayOfWeek()); this.dayOfMonth = new DayOfMonth(schedule.getDayOfMonth());
/** * * @param calendar */ private void resetTimeToFirstValues(Calendar calendar) { final int currentHour = calendar.get(Calendar.HOUR_OF_DAY); final int currentMinute = calendar.get(Calendar.MINUTE); final int currentSecond = calendar.get(Calendar.SECOND); final int firstHour = this.hour.getFirst(); final int firstMinute = this.minute.getFirst(); final int firstSecond = this.second.getFirst(); if (currentHour != firstHour || currentMinute != firstMinute || currentSecond != firstSecond) { setTime(calendar, firstHour, firstMinute, firstSecond); } }
currentHour++; Integer nextHour = this.hour.getNextMatch(currentHour < 24 ? currentHour : 0); if (nextHour == null) { return null;
Marker threshold = new ValueMarker(80.0); Hour hour1 = new Hour(18, 30, 6, 2005); Hour hour2 = new Hour(20, 30, 6, 2005); double millis1 = hour1.getFirstMillisecond(); double millis2 = hour2.getFirstMillisecond(); Marker cooling = new IntervalMarker(millis1, millis2); cooling.setLabelOffsetType(LengthAdjustmentType.EXPAND); cooling.setPaint(new Color(150, 150, 255)); cooling.setLabel("Automatic Cooling"); cooling.setLabelFont(new Font("SansSerif", Font.PLAIN, 11)); cooling.setLabelPaint(Color.blue); cooling.setLabelAnchor(RectangleAnchor.TOP_LEFT); cooling.setLabelTextAnchor(TextAnchor.TOP_RIGHT); plot.addDomainMarker(cooling, Layer.BACKGROUND);
Hour[] hours = new Hour[data.length()]; hours[0] = new Hour(); hours[0].setSummary(test);
private Calendar advanceTillMonthHasDate(Calendar cal, Integer date) { Calendar copy = this.copy(cal); // make sure the month can handle the date while (monthHasDate(copy, date) == false) { if (copy.get(Calendar.YEAR) > Year.MAX_YEAR) { return null; } // this month can't handle the date, so advance month to next month // and get the next suitable matching month copy.add(Calendar.MONTH, 1); copy = this.computeNextMonth(copy); if (copy == null) { return null; } date = this.dayOfMonth.getFirstMatch(copy); if (date == null) { return null; } copy.set(Calendar.SECOND, this.second.getFirst()); copy.set(Calendar.MINUTE, this.minute.getFirst()); copy.set(Calendar.HOUR_OF_DAY, this.hour.getFirst()); } copy.set(Calendar.DAY_OF_MONTH, date); return copy; }
Integer nextHour = this.hour.getNextMatch(currentCal);
for(int i = 0; i < hours.length; i++) { (hours[i] = new Hour()).setSummary(test); }
this.hour = new Hour(schedule.getHour()); this.dayOfWeek = new DayOfWeek(schedule.getDayOfWeek()); this.dayOfMonth = new DayOfMonth(schedule.getDayOfMonth());
nextCal.set(Calendar.HOUR_OF_DAY, this.hour.getFirst()); nextCal.set(Calendar.DAY_OF_WEEK, this.dayOfWeek.getFirst()); nextCal.set(Calendar.DAY_OF_MONTH, 1); nextCal.set(Calendar.HOUR_OF_DAY, this.hour.getFirst()); nextCal.set(Calendar.DAY_OF_WEEK, this.dayOfWeek.getFirst()); nextCal.set(Calendar.DAY_OF_MONTH, 1);
nextCal.set(Calendar.HOUR_OF_DAY, this.hour.getFirst()); nextCal.set(Calendar.MONTH, this.month.getFirstMatch()); nextCal.set(Calendar.DAY_OF_MONTH, 1);
nextCal.set(Calendar.HOUR_OF_DAY, this.hour.getFirst()); } else { nextCal = this.advanceTillMonthHasDate(nextCal, nextDayOfMonth);
this.firstTimeout.set(Calendar.SECOND, this.second.getFirst()); this.firstTimeout.set(Calendar.MINUTE, this.minute.getFirst()); this.firstTimeout.set(Calendar.HOUR_OF_DAY, this.hour.getFirst()); this.firstTimeout.set(Calendar.MILLISECOND, 0);