/** * Returns the hour. * * @return The hour (never <code>null</code>). */ public Hour getHour() { return new Hour(this.hour, this.day); }
/** * Returns the hour. * * @return The hour (never {@code null}). */ public Hour getHour() { return new Hour(this.hour, this.day); }
/** * Returns the minute. * * @return The minute (never {@code null}). */ public Minute getMinute() { return new Minute(this.minute, new Hour(this.hour, this.day)); }
/** * Returns the minute. * * @return The minute (never <code>null</code>). */ public Minute getMinute() { return new Minute(this.minute, new Hour(this.hour, this.day)); }
/** * Returns the hour following this one. * * @return The hour following this one. */ @Override public RegularTimePeriod next() { Hour result; if (this.hour != LAST_HOUR_IN_DAY) { result = new Hour(this.hour + 1, this.day); } else { // we are at the last hour in the day... Day nextDay = (Day) this.day.next(); if (nextDay != null) { result = new Hour(FIRST_HOUR_IN_DAY, nextDay); } else { result = null; } } return result; }
/** * Returns the hour preceding this one. * * @return The hour preceding this one. */ public RegularTimePeriod previous() { Hour result; if (this.hour != FIRST_HOUR_IN_DAY) { result = new Hour(this.hour - 1, this.day); } else { // we are at the first hour in the day... Day prevDay = (Day) this.day.previous(); if (prevDay != null) { result = new Hour(LAST_HOUR_IN_DAY, prevDay); } else { result = null; } } return result; }
/** * Returns the hour preceding this one. * * @return The hour preceding this one. */ @Override public RegularTimePeriod previous() { Hour result; if (this.hour != FIRST_HOUR_IN_DAY) { result = new Hour(this.hour - 1, this.day); } else { // we are at the first hour in the day... Day prevDay = (Day) this.day.previous(); if (prevDay != null) { result = new Hour(LAST_HOUR_IN_DAY, prevDay); } else { result = null; } } return result; }
/** * Returns the hour following this one. * * @return The hour following this one. */ public RegularTimePeriod next() { Hour result; if (this.hour != LAST_HOUR_IN_DAY) { result = new Hour(this.hour + 1, this.day); } else { // we are at the last hour in the day... Day nextDay = (Day) this.day.next(); if (nextDay != null) { result = new Hour(FIRST_HOUR_IN_DAY, nextDay); } else { result = null; } } return result; }
public synchronized static RegularTimePeriod getRtp(OfxChartTimePeriod ofxTimePeriod, Date d) { RegularTimePeriod rtp; switch(ofxTimePeriod) { case Hour: rtp = new Hour(d);break; case Day: rtp = new Day(d);break; case Month: rtp = new Month(d);break; default: rtp = new Hour(d);break; } return rtp; }
/** * Creates an Hour instance by parsing a string. The string is assumed to * be in the format "YYYY-MM-DD HH", perhaps with leading or trailing * whitespace. * * @param s the hour string to parse. * * @return {@code null} if the string is not parseable, the hour * otherwise. */ public static Hour parseHour(String s) { Hour result = null; s = s.trim(); String daystr = s.substring(0, Math.min(10, s.length())); Day day = Day.parseDay(daystr); if (day != null) { String hourstr = s.substring( Math.min(daystr.length() + 1, s.length()), s.length() ); hourstr = hourstr.trim(); int hour = Integer.parseInt(hourstr); // if the hour is 0 - 23 then create an hour if ((hour >= FIRST_HOUR_IN_DAY) && (hour <= LAST_HOUR_IN_DAY)) { result = new Hour(hour, day); } } return result; }
int minute = Integer.parseInt(minstr); if ((minute >= 0) && (minute <= 59)) { result = new Minute(minute, new Hour(hour, day));
/** * Creates a new minute. * * @param minute the minute (0-59). * @param hour the hour (0-23). * @param day the day (1-31). * @param month the month (1-12). * @param year the year (1900-9999). */ public Minute(int minute, int hour, int day, int month, int year) { this(minute, new Hour(hour, new Day(day, month, year))); }
if ((minute >= 0) && (minute <= 59)) { Minute m = new Minute(minute, new Hour(hour, day)); int second = Integer.parseInt(secstr); if ((second >= 0) && (second <= 59)) {
/** * Creates a new minute. * * @param minute the minute (0-59). * @param hour the hour (0-23). * @param day the day (1-31). * @param month the month (1-12). * @param year the year (1900-9999). */ public Minute(int minute, int hour, int day, int month, int year) { this(minute, new Hour(hour, new Day(day, month, year))); }
private RegularTimePeriod determineTimeInterval(Date date, StyleProperties styleProperties) { if (styleProperties.getProperties() .containsKey(Style.PARAMETER_INTERVAL)) { String interval = styleProperties.getProperties() .get(Style.PARAMETER_INTERVAL); if (interval.equals(Style.VALUE_INTERVAL_BY_HOUR)) { return new Hour(date); } else if (interval.equals(Style.VALUE_INTERVAL_BY_DAY)) { return new Day(date); } else if (interval.equals(Style.VALUE_INTERVAL_BY_MONTH)) { return new Month(date); } } return new Week(date); }
private RegularTimePeriod determineTimeInterval(Date date, StyleProperties styleProperties) { if (styleProperties.getProperties().containsKey("interval")) { String interval = styleProperties.getProperties().get("interval"); if (interval.equals("byHour")) { return new Hour(date); } else if (interval.equals("byDay")) { return new Day(date); } else if (interval.equals("byMonth")) { return new Month(date); } } return new Week(date); }
Minute m0 = new Minute(0, new Hour(i, today)); Minute m1 = new Minute(15, new Hour(i, today)); Minute m2 = new Minute(30, new Hour(i, today)); Minute m3 = new Minute(45, new Hour(i, today)); Minute m4 = new Minute(0, new Hour(i + 1, today)); series1.add(new SimpleTimePeriod(m0.getStart(), m1.getStart()), Math.random()); series2.add(new SimpleTimePeriod(m1.getStart(), m2.getStart()), Math.random());
private IntervalXYDataset createDataset(List<DataSet> lContainer) { TimeSeriesCollection dataset = new TimeSeriesCollection(); for(DataSet container : lContainer) { TimeSeries ts = new TimeSeries(container.getLabel()); for(Data data : container.getData()) { Date d = DateUtil.getDateFromInt(data.getRecord().getYear(), data.getRecord().getMonth(), data.getRecord().getDay()); ts.addOrUpdate(new Hour(d), data.getY()); } dataset.addSeries(ts); } return dataset; } }