org.jfree.data.time.TimePeriod Java Examples

The following examples show how to use org.jfree.data.time.TimePeriod. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExtTimeTableXYDataset.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * 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( final boolean includeInterval ) {
  final List keys = this.values.getRowKeys();
  if ( keys.isEmpty() ) {
    return null;
  }

  final TimePeriod first = (TimePeriod) keys.get( 0 );
  final 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() );
  }
}
 
Example #2
Source File: TaskSeriesCollection.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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</code>).
 */
@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;
}
 
Example #3
Source File: TaskSeriesCollection.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns the start 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 start value (possibly <code>null</code>).
 */
@Override
public Number getStartValue(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.getStart().getTime());
        }
    }
    return result;
}
 
Example #4
Source File: TaskSeriesCollection.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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</code>).
 */
@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;
}
 
Example #5
Source File: TaskSeriesCollection.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns the start 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 start value (possibly <code>null</code>).
 */
@Override
public Number getStartValue(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.getStart().getTime());
        }
    }
    return result;
}
 
Example #6
Source File: TaskSeriesCollection.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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</code>).
 */
@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;
}
 
Example #7
Source File: TimePeriodChartHyperlinkProvider.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public JRPrintHyperlink getEntityHyperlink(ChartEntity entity)
{
	JRPrintHyperlink printHyperlink = null;
	if (hasHyperlinks() && entity instanceof XYItemEntity)
	{
		XYItemEntity itemEntity = (XYItemEntity) entity;
		TimePeriodValuesCollection dataset = (TimePeriodValuesCollection) itemEntity.getDataset();
		TimePeriodValues series = dataset.getSeries(itemEntity.getSeriesIndex());
		Map<TimePeriod, JRPrintHyperlink> serieHyperlinks = itemHyperlinks.get(series.getKey());
		if (serieHyperlinks != null)
		{
			TimePeriod timePeriod = series.getTimePeriod(itemEntity.getItem());
			printHyperlink = serieHyperlinks.get(timePeriod);
		}
	}
	return printHyperlink;
}
 
Example #8
Source File: TaskSeriesCollection.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the start 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 start value (possibly <code>null</code>).
 */
@Override
public Number getStartValue(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.getStart().getTime());
        }
    }
    return result;
}
 
Example #9
Source File: TaskSeriesCollection.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * 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</code>).
 */
@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;
}
 
Example #10
Source File: TaskSeriesCollection.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns the start 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 start value (possibly <code>null</code>).
 */
@Override
public Number getStartValue(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.getStart().getTime());
        }
    }
    return result;
}
 
Example #11
Source File: TaskSeriesCollection.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the start 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 start value (possibly <code>null</code>).
 */
@Override
public Number getStartValue(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.getStart().getTime());
        }
    }
    return result;
}
 
Example #12
Source File: TaskSeriesCollection.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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</code>).
 */
@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;
}
 
Example #13
Source File: TaskSeriesCollection.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the start 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 start value (possibly <code>null</code>).
 */
public Number getStartValue(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.getStart().getTime());
        }
    }
    return result;
}
 
Example #14
Source File: TaskSeriesCollection.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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</code>).
 */
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;
}
 
Example #15
Source File: TaskSeriesCollection.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the start 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 start value (possibly <code>null</code>).
 */
public Number getStartValue(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.getStart().getTime());
        }
    }
    return result;
}
 
Example #16
Source File: TaskSeriesCollection.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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</code>).
 */
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;
}
 
Example #17
Source File: TaskSeriesCollection.java    From opensim-gui with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the start 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 start value (possibly <code>null</code>).
 */
public Number getStartValue(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.getStart().getTime());
        }
    }
    return result;
}
 
Example #18
Source File: TaskSeriesCollection.java    From opensim-gui with Apache License 2.0 6 votes vote down vote up
/**
 * 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</code>).
 */
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;
}
 
Example #19
Source File: ExtTimeTableXYDataset.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Adds a new data item to the dataset and, if requested, sends a {@link DatasetChangeEvent} to all registered
 * listeners.
 *
 * @param period     the time period (<code>null</code> not permitted).
 * @param y          the value for this period (<code>null</code> permitted).
 * @param seriesName the name of the series to add the value (<code>null</code> not permitted).
 * @param notify     whether dataset listener are notified or not.
 * @see #remove(TimePeriod, Comparable, boolean)
 */
public void add( final TimePeriod period, final Number y, final Comparable seriesName,
                 final boolean notify ) {
  // here's a quirk - the API has been defined in terms of a plain
  // TimePeriod, which cannot make use of the timezone and locale
  // specified in the constructor...so we only do the time zone
  // pegging if the period is an instanceof RegularTimePeriod
  if ( period instanceof RegularTimePeriod ) {
    final RegularTimePeriod p = (RegularTimePeriod) period;
    p.peg( this.workingCalendar );
  }
  this.values.addValue( y, period, seriesName );
  if ( notify ) {
    fireDatasetChanged();
  }
}
 
Example #20
Source File: Task.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new task.
 *
 * @param description  the task description (<code>null</code> not
 *                     permitted).
 * @param duration  the task duration (<code>null</code> permitted).
 */
public Task(String description, TimePeriod duration) {
    ParamChecks.nullNotPermitted(description, "description");
    this.description = description;
    this.duration = duration;
    this.percentComplete = null;
    this.subtasks = new java.util.ArrayList();
}
 
Example #21
Source File: XYTaskDataset.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
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;
}
 
Example #22
Source File: XYTaskDataset.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
private double getItemStartValue(int series, int item) {
    TaskSeries s = this.underlying.getSeries(series);
    Task t = s.get(item);
    TimePeriod duration = t.getDuration();
    Date start = duration.getStart();
    return start.getTime();
}
 
Example #23
Source File: XYTaskDataset.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
private double getItemStartValue(int series, int item) {
    TaskSeries s = this.underlying.getSeries(series);
    Task t = s.get(item);
    TimePeriod duration = t.getDuration();
    Date start = duration.getStart();
    return start.getTime();
}
 
Example #24
Source File: XYTaskDataset.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #25
Source File: TaskSeriesCollection.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #26
Source File: XYTaskDataset.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
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();
}
 
Example #27
Source File: Task.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new task.
 *
 * @param description  the task description (<code>null</code> not
 *                     permitted).
 * @param duration  the task duration (<code>null</code> permitted).
 */
public Task(String description, TimePeriod duration) {
    if (description == null) {
        throw new IllegalArgumentException("Null 'description' argument.");
    }
    this.description = description;
    this.duration = duration;
    this.percentComplete = null;
    this.subtasks = new java.util.ArrayList();
}
 
Example #28
Source File: XYTaskDataset.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #29
Source File: XYTaskDataset.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
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();
}
 
Example #30
Source File: XYTaskDataset.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
private double getItemStartValue(int series, int item) {
    TaskSeries s = this.underlying.getSeries(series);
    Task t = s.get(item);
    TimePeriod duration = t.getDuration();
    Date start = duration.getStart();
    return start.getTime();
}