/** * Returns the end x-value (as a double primitive) for an item within * a series. * * @param series the series index (zero-based). * @param item the item index (zero-based). * * @return The value. */ @Override public double getEndXValue(int series, int item) { TimePeriod period = (TimePeriod) this.values.getRowKey(item); return period.getEnd().getTime(); }
/** * Returns the end x-value (as a double primitive) for an item within * a series. * * @param series the series index (zero-based). * @param item the item index (zero-based). * * @return The value. */ public double getEndXValue(int series, int item) { TimePeriod period = (TimePeriod) this.values.getRowKey(item); return period.getEnd().getTime(); }
@Override public void appendNonNullItem(TimePeriod timePeriod, JqlClauseBuilder clauseBuilder) { Date startDate = timePeriod.getStart(); Date endDate = new Date(timePeriod.getEnd().getTime()); clauseBuilder.addDateRangeCondition(documentConstant, startDate, endDate); }
/** * 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 ending X value for the specified series and item. */ @Override public Number getEndX(int series, int item) { TimePeriodValues ts = (TimePeriodValues) this.data.get(series); TimePeriodValue dp = ts.getDataItem(item); return new Long(dp.getPeriod().getEnd().getTime()); }
/** * Returns the x-value for a time period. * * @param period the time period. * * @return The x-value. */ private long getXValue(TimePeriod period) { long result = 0L; if (this.xPosition == TimePeriodAnchor.START) { result = period.getStart().getTime(); } else if (this.xPosition == TimePeriodAnchor.MIDDLE) { long t0 = period.getStart().getTime(); long t1 = period.getEnd().getTime(); result = t0 + (t1 - t0) / 2L; } else if (this.xPosition == TimePeriodAnchor.END) { result = period.getEnd().getTime(); } return result; }
/** * 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 ending X value for the specified series and item. */ public Number getEndX(int series, int item) { TimePeriodValues ts = (TimePeriodValues) this.data.get(series); TimePeriodValue dp = ts.getDataItem(item); return new Long(dp.getPeriod().getEnd().getTime()); }
/** * Returns the x-value for a time period. * * @param period the time period. * * @return The x-value. */ private long getX(TimePeriod period) { if (this.xPosition == TimePeriodAnchor.START) { return period.getStart().getTime(); } else if (this.xPosition == TimePeriodAnchor.MIDDLE) { return period.getStart().getTime() / 2 + period.getEnd().getTime() / 2; } else if (this.xPosition == TimePeriodAnchor.END) { return period.getEnd().getTime(); } else { throw new IllegalStateException("TimePeriodAnchor unknown."); } }
/** * Returns the x-value for a time period. * * @param period the time period. * * @return The x-value. */ private long getXValue(TimePeriod period) { long result = 0L; if (this.xPosition == TimePeriodAnchor.START) { result = period.getStart().getTime(); } else if (this.xPosition == TimePeriodAnchor.MIDDLE) { long t0 = period.getStart().getTime(); long t1 = period.getEnd().getTime(); result = t0 + (t1 - t0) / 2L; } else if (this.xPosition == TimePeriodAnchor.END) { result = period.getEnd().getTime(); } return result; }
/** * Returns the x-value for a time period. * * @param period the time period. * * @return The x-value. */ private long getX(TimePeriod period) { if (this.xPosition == TimePeriodAnchor.START) { return period.getStart().getTime(); } else if (this.xPosition == TimePeriodAnchor.MIDDLE) { return period.getStart().getTime() / 2 + period.getEnd().getTime() / 2; } else if (this.xPosition == TimePeriodAnchor.END) { return period.getEnd().getTime(); } else { throw new IllegalStateException("TimePeriodAnchor unknown."); } }
private double getItemEndValue(int series, int item) { TaskSeries s = this.underlying.getSeries(series); Task t = s.get(item); TimePeriod duration = t.getDuration(); Date end = duration.getEnd(); return end.getTime(); }
private double getItemEndValue(int series, int item) { TaskSeries s = this.underlying.getSeries(series); Task t = s.get(item); TimePeriod duration = t.getDuration(); Date end = duration.getEnd(); return end.getTime(); }
private double getItemValue(int series, int item) { TaskSeries s = this.underlying.getSeries(series); Task t = s.get(item); TimePeriod duration = t.getDuration(); Date start = duration.getStart(); Date end = duration.getEnd(); return (start.getTime() + end.getTime()) / 2.0; }
private double getItemValue(int series, int item) { TaskSeries s = this.underlying.getSeries(series); Task t = s.get(item); TimePeriod duration = t.getDuration(); Date start = duration.getStart(); Date end = duration.getEnd(); return (start.getTime() + end.getTime()) / 2.0; }
/** * Returns the end value for a task. This is a date/time value, measured * in milliseconds since 1-Jan-1970. * * @param rowKey the series. * @param columnKey the category. * * @return The end value (possibly {@code null}). */ @Override public Number getEndValue(Comparable rowKey, Comparable columnKey) { Number result = null; int row = getRowIndex(rowKey); TaskSeries series = (TaskSeries) this.data.get(row); Task task = series.get(columnKey.toString()); if (task != null) { TimePeriod duration = task.getDuration(); if (duration != null) { result = new Long(duration.getEnd().getTime()); } } return result; }
/** * Returns the end value for a task. This is a date/time value, measured * in milliseconds since 1-Jan-1970. * * @param rowKey the series. * @param columnKey the category. * * @return The end value (possibly <code>null</code>). */ public Number getEndValue(Comparable rowKey, Comparable columnKey) { Number result = null; int row = getRowIndex(rowKey); TaskSeries series = (TaskSeries) this.data.get(row); Task task = series.get(columnKey.toString()); if (task != null) { TimePeriod duration = task.getDuration(); if (duration != null) { result = new Long(duration.getEnd().getTime()); } } return result; }
/** * Returns the end value of a sub-interval for a given item. * * @param rowKey the row key. * @param columnKey the column key. * @param subinterval the subinterval. * * @return The end value (possibly {@code null}). */ @Override public Number getEndValue(Comparable rowKey, Comparable columnKey, int subinterval) { Number result = null; int row = getRowIndex(rowKey); TaskSeries series = (TaskSeries) this.data.get(row); Task task = series.get(columnKey.toString()); if (task != null) { Task sub = task.getSubtask(subinterval); if (sub != null) { TimePeriod duration = sub.getDuration(); result = new Long(duration.getEnd().getTime()); } } return result; }
/** * Tests this time period instance for equality with an arbitrary object. * The object is considered equal if it is an instance of {@link TimePeriod} * and it has the same start and end dates. * * @param obj the other object ({@code null} permitted). * * @return A boolean. */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof TimePeriod)) { return false; } TimePeriod that = (TimePeriod) obj; if (!this.getStart().equals(that.getStart())) { return false; } if (!this.getEnd().equals(that.getEnd())) { return false; } return true; }
@Override public SearchRequest getSearchUrlSuffix(TimePeriod timePeriod, SearchRequest searchRequest) { // Copied from parent class, with some mods. Date startDate = timePeriod.getStart(); Date endDate = new Date(timePeriod.getEnd().getTime()); JqlQueryBuilder builder = JqlQueryBuilder.newBuilder(searchRequest.getQuery()); builder.where().defaultAnd().addDateRangeCondition(new StringBuilder("cf[").append(customFieldId).append("]").toString(), startDate, endDate); return new SearchRequest(builder.buildQuery(), searchRequest.getOwnerUserName(), null, null); } }
/** * Returns the range of the values in this dataset's domain. * * @param includeInterval a flag that controls whether or not the * x-intervals are taken into account. * * @return The range. */ public Range getDomainBounds(boolean includeInterval) { List keys = this.values.getRowKeys(); if (keys.isEmpty()) { return null; } TimePeriod first = (TimePeriod) keys.get(0); TimePeriod last = (TimePeriod) keys.get(keys.size() - 1); if (!includeInterval || this.domainIsPointsInTime) { return new Range(getXValue(first), getXValue(last)); } else { return new Range(first.getStart().getTime(), last.getEnd().getTime()); } }
/** * Returns the range of the values in this dataset's domain. * * @param includeInterval a flag that controls whether or not the * x-intervals are taken into account. * * @return The range. */ @Override public Range getDomainBounds(boolean includeInterval) { List keys = this.values.getRowKeys(); if (keys.isEmpty()) { return null; } TimePeriod first = (TimePeriod) keys.get(0); TimePeriod last = (TimePeriod) keys.get(keys.size() - 1); if (!includeInterval || this.domainIsPointsInTime) { return new Range(getXValue(first), getXValue(last)); } else { return new Range(first.getStart().getTime(), last.getEnd().getTime()); } }