/** * Returns the date/time that marks the end of the time period. This * method returns a new {@code Date} instance every time it is called. * * @return The end date/time. * * @see #getLastMillisecond() */ @Override public Date getEnd() { return new Date(getLastMillisecond()); }
/** * Returns the date/time that marks the end of the time period. This * method returns a new <code>Date</code> instance every time it is called. * * @return The end date/time. * * @see #getLastMillisecond() */ public Date getEnd() { return new Date(getLastMillisecond()); }
/** * Returns the last millisecond of the time period, evaluated within a * specific time zone. * * @param zone the time zone (<code>null</code> not permitted). * * @return The last millisecond of the time period. * * @deprecated As of 1.0.3, you should avoid using this method (it creates * a new Calendar instance every time it is called). You are advised * to call {@link #getLastMillisecond(Calendar)} instead. * * @see #getFirstMillisecond(TimeZone) */ public long getLastMillisecond(TimeZone zone) { Calendar calendar = Calendar.getInstance(zone); return getLastMillisecond(calendar); }
/** * Returns the millisecond closest to the middle of the time period. * * @return The middle millisecond. */ public long getMiddleMillisecond() { long m1 = getFirstMillisecond(); long m2 = getLastMillisecond(); return m1 + (m2 - m1) / 2; }
/** * Returns the end x-value. * * @param series the series index (zero-based). * @param item the item index (zero-based). * * @return The value. */ public Number getEndX(int series, int item) { RegularTimePeriod tp = this.pointsInTime[translateGet(item)]; return new Long(tp.getLastMillisecond(this.workingCalendar)); }
/** * Returns the millisecond closest to the middle of the time period. * * @return The middle millisecond. */ public long getMiddleMillisecond() { long m1 = getFirstMillisecond(); long m2 = getLastMillisecond(); return m1 + (m2 - m1) / 2; }
/** * Returns the end x-value. * * @param series the series index (zero-based). * @param item the item index (zero-based). * * @return The value. */ @Override public Number getEndX(int series, int item) { RegularTimePeriod tp = this.pointsInTime[translateGet(item)]; return new Long(tp.getLastMillisecond(this.workingCalendar)); }
/** * Returns the millisecond closest to the middle of the time period, * evaluated using the supplied calendar (which incorporates a timezone). * * @param calendar the calendar. * * @return The middle millisecond. */ public long getMiddleMillisecond(Calendar calendar) { long m1 = getFirstMillisecond(calendar); long m2 = getLastMillisecond(calendar); return m1 + (m2 - m1) / 2; }
/** * Returns the ending X value for the specified series and item. * * @param series The series (zero-based index). * @param item The item (zero-based index). * * @return The value. */ public synchronized Number getEndX(int series, int item) { TimeSeries ts = (TimeSeries) this.data.get(series); return new Long(ts.getTimePeriod(item).getLastMillisecond( this.workingCalendar)); }
/** * Returns the millisecond closest to the middle of the time period, * evaluated using the supplied calendar (which incorporates a timezone). * * @param calendar the calendar. * * @return The middle millisecond. */ public long getMiddleMillisecond(Calendar calendar) { long m1 = getFirstMillisecond(calendar); long m2 = getLastMillisecond(calendar); return m1 + (m2 - m1) / 2; }
/** * Returns the ending X value for the specified series and item. * * @param series The series (zero-based index). * @param item The item (zero-based index). * * @return The value. */ @Override public synchronized Number getEndX(int series, int item) { TimeSeries ts = (TimeSeries) this.data.get(series); return new Long(ts.getTimePeriod(item).getLastMillisecond( this.workingCalendar)); }
/** * Returns the millisecond closest to the middle of the time period, * evaluated within a specific time zone. * * @param zone the time zone (<code>null</code> not permitted). * * @return The middle millisecond. * * @deprecated As of 1.0.3, you should avoid using this method (it creates * a new Calendar instance every time it is called). You are advised * to call {@link #getMiddleMillisecond(Calendar)} instead. */ public long getMiddleMillisecond(TimeZone zone) { Calendar calendar = Calendar.getInstance(zone); long m1 = getFirstMillisecond(calendar); long m2 = getLastMillisecond(calendar); return m1 + (m2 - m1) / 2; }
private void processCursor(RegularTimePeriod cursor, Double amountOfTimeSpent, Date resolutionDate) { double totalTime = getDouble(totalTimes, cursor); double totalCount = getDouble(totalCounts, cursor); long cursorStart = cursor.getFirstMillisecond(); long cursorEnd = cursor.getLastMillisecond(); if (amountOfTimeSpent != null && (resolutionDate == null || (resolutionDate.getTime() >= cursorStart && resolutionDate.getTime() <= cursorEnd))) { totalTime += amountOfTimeSpent.longValue(); totalCount++; } totalTimes.put(cursor, totalTime); totalCounts.put(cursor, totalCount); }
/** * Returns the x-value for a time period. * * @param period the time period ({@code null} not permitted). * * @return The x-value. */ protected synchronized long getX(RegularTimePeriod period) { long result = 0L; if (this.xPosition == TimePeriodAnchor.START) { result = period.getFirstMillisecond(); } else if (this.xPosition == TimePeriodAnchor.MIDDLE) { result = period.getMiddleMillisecond(); } else if (this.xPosition == TimePeriodAnchor.END) { result = period.getLastMillisecond(); } return result; }
/** * Returns the x-value for a time period. * * @param period the time period ({@code null} not permitted). * * @return The x-value. */ protected synchronized long getX(RegularTimePeriod period) { long result = 0L; if (this.xPosition == TimePeriodAnchor.START) { result = period.getFirstMillisecond(this.workingCalendar); } else if (this.xPosition == TimePeriodAnchor.MIDDLE) { result = period.getMiddleMillisecond(this.workingCalendar); } else if (this.xPosition == TimePeriodAnchor.END) { result = period.getLastMillisecond(this.workingCalendar); } return result; }
/** * Returns the x-value for a time period. * * @param period the time period (<code>null</code> not permitted). * * @return The x-value. */ protected synchronized long getX(RegularTimePeriod period) { long result = 0L; if (this.xPosition == TimePeriodAnchor.START) { result = period.getFirstMillisecond(this.workingCalendar); } else if (this.xPosition == TimePeriodAnchor.MIDDLE) { result = period.getMiddleMillisecond(this.workingCalendar); } else if (this.xPosition == TimePeriodAnchor.END) { result = period.getLastMillisecond(this.workingCalendar); } return result; }
/** * Returns the x-value for a time period. * * @param period the period. * * @return The x-value. */ private long getX(RegularTimePeriod period) { switch (this.position) { case (START) : return period.getFirstMillisecond(this.workingCalendar); case (MIDDLE) : return period.getMiddleMillisecond(this.workingCalendar); case (END) : return period.getLastMillisecond(this.workingCalendar); default: return period.getMiddleMillisecond(this.workingCalendar); } }
/** * Returns the x-value for a time period. * * @param period the period. * * @return The x-value. */ private long getX(RegularTimePeriod period) { switch (this.position) { case (START) : return period.getFirstMillisecond(this.workingCalendar); case (MIDDLE) : return period.getMiddleMillisecond(this.workingCalendar); case (END) : return period.getLastMillisecond(this.workingCalendar); default: return period.getMiddleMillisecond(this.workingCalendar); } }
/** * Finds the domain limits. Note: this doesn't need to be synchronized * because it's called from within another method that already is. */ protected void findDomainLimits() { long startL = getOldestTime().getFirstMillisecond(this.workingCalendar); long endL; if (this.domainIsPointsInTime) { endL = getNewestTime().getFirstMillisecond(this.workingCalendar); } else { endL = getNewestTime().getLastMillisecond(this.workingCalendar); } this.domainStart = new Long(startL); this.domainEnd = new Long(endL); this.domainRange = new Range(startL, endL); }
/** * Finds the domain limits. Note: this doesn't need to be synchronized * because it's called from within another method that already is. */ protected void findDomainLimits() { long startL = getOldestTime().getFirstMillisecond(this.workingCalendar); long endL; if (this.domainIsPointsInTime) { endL = getNewestTime().getFirstMillisecond(this.workingCalendar); } else { endL = getNewestTime().getLastMillisecond(this.workingCalendar); } this.domainStart = new Long(startL); this.domainEnd = new Long(endL); this.domainRange = new Range(startL, endL); }