/** * Returns a time period that would be the next in sequence on the end of * the time series. * * @return The next time period. */ public RegularTimePeriod getNextTimePeriod() { RegularTimePeriod last = getTimePeriod(getItemCount() - 1); return last.next(); }
/** * Returns a time period that would be the next in sequence on the end of * the time series. * * @return The next time period. */ public RegularTimePeriod getNextTimePeriod() { RegularTimePeriod last = getTimePeriod(getItemCount() - 1); return last.next(); }
public static void normaliseDateRange(Map<RegularTimePeriod, List<Long>> dateMap, int days, Class period, TimeZone timeZone) { // find earliest date, then move it forwards until we hit now Calendar cal = Calendar.getInstance(timeZone); cal.add(Calendar.DAY_OF_MONTH, - days); Date earliest = cal.getTime(); RegularTimePeriod cursor = RegularTimePeriod.createInstance(period, earliest, timeZone); RegularTimePeriod end = RegularTimePeriod.createInstance(period, new Date(), timeZone); //fix for JRA-11686. Prevents the loop from looping infinitely. while (cursor != null && cursor.compareTo(end) <= 0) { if (!dateMap.containsKey(cursor)) { dateMap.put(cursor, Lists.newArrayList((long) 0)); } cursor = cursor.next(); cursor.peg(cal); } }
public static void normaliseDateRangeCount(Map<RegularTimePeriod, Number> dateMap, int days, Class period, TimeZone timeZone) { // find earliest date, then move it forwards until we hit now Calendar cal = Calendar.getInstance(timeZone); cal.add(Calendar.DAY_OF_MONTH, - days); Date earliest = cal.getTime(); RegularTimePeriod cursor = RegularTimePeriod.createInstance(period, earliest, timeZone); RegularTimePeriod end = RegularTimePeriod.createInstance(period, new Date(), timeZone); //fix for JRA-11686. Prevents the loop from looping infinitely. while (cursor != null && cursor.compareTo(end) <= 0) { if (!dateMap.containsKey(cursor)) { dateMap.put(cursor, 0); } cursor = cursor.next(); cursor.peg(cal); } }
totalCounts.put(cursor, totalCount); cursor = cursor.next(); cursor.peg(cal);
/** * Fill the pointsInTime with times using TimePeriod.next(): * Will silently return if the time array was already populated. * * Also computes the data cached for later use by * methods implementing the DomainInfo interface: * * @param start the start. * * @return ??. */ public synchronized long setTimeBase(RegularTimePeriod start) { if (this.pointsInTime[0] == null) { this.pointsInTime[0] = start; for (int i = 1; i < this.historyCount; i++) { this.pointsInTime[i] = this.pointsInTime[i - 1].next(); } } long oldestL = this.pointsInTime[0].getFirstMillisecond( this.workingCalendar); long nextL = this.pointsInTime[1].getFirstMillisecond( this.workingCalendar); this.deltaTime = nextL - oldestL; this.oldestAt = 0; this.newestAt = this.historyCount - 1; findDomainLimits(); return this.deltaTime; }
/** * Fill the pointsInTime with times using TimePeriod.next(): * Will silently return if the time array was already populated. * * Also computes the data cached for later use by * methods implementing the DomainInfo interface: * * @param start the start. * * @return ??. */ public synchronized long setTimeBase(RegularTimePeriod start) { if (this.pointsInTime[0] == null) { this.pointsInTime[0] = start; for (int i = 1; i < this.historyCount; i++) { this.pointsInTime[i] = this.pointsInTime[i - 1].next(); } } long oldestL = this.pointsInTime[0].getFirstMillisecond( this.workingCalendar ); long nextL = this.pointsInTime[1].getFirstMillisecond( this.workingCalendar ); this.deltaTime = nextL - oldestL; this.oldestAt = 0; this.newestAt = this.historyCount - 1; findDomainLimits(); return this.deltaTime; }
RegularTimePeriod nextInstant = this.pointsInTime[this.newestAt].next(); this.newestAt = this.oldestAt; // newestAt takes value previously held
public static void normaliseDateRange(TimeSeriesCollection collection, RegularTimePeriod[] range) { if (collection.getSeriesCount() == 0) return; // find earliest date, then move it forwards until we hit now RegularTimePeriod earliest = range[0]; RegularTimePeriod latest = range[1]; RegularTimePeriod cursor = earliest; for (int i = 0; i < collection.getSeriesCount(); i++) { TimeSeries series = collection.getSeries(i); while (cursor.compareTo(latest) != 1) { if (series.getValue(cursor) == null) series.add(cursor, Integer.valueOf(0)); cursor = cursor.next(); } cursor = earliest; } } }
RegularTimePeriod nextInstant = this.pointsInTime[this.newestAt].next(); this.newestAt = this.oldestAt; // newestAt takes value previously held
cursor = cursor.next(); cursor.peg(calendar);
p = p.next();