com.xceptance.xlt.report.external.util.ValueSet Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xlt Show documentation
Show all versions of xlt Show documentation
XLT (Xceptance LoadTest) is an extensive load and performance test tool developed and maintained by Xceptance.
package com.xceptance.xlt.report.external.util;
import java.util.TreeMap;
import org.jfree.data.time.Second;
import org.jfree.data.time.TimeSeries;
import com.xceptance.xlt.report.external.util.dataItem.DataItem;
import com.xceptance.xlt.report.util.JFreeChartUtils;
/**
* @author matthias.ullrich
*/
public class ValueSet
{
protected TreeMap timerData = new TreeMap();
/**
* add or update current value set with time value pair
*
* @param time
* time to update
* @param value
* value
*/
public void addOrUpdate(final long time, final double value)
{
final Second s = JFreeChartUtils.getSecond(time);
DataItem current = timerData.get(s);
if (current == null)
{
current = new DataItem(s, value);
timerData.put(s, current);
}
current.addOrUpdate(value);
}
/**
* convert current value set to time series
*
* @param timeSeriesName
* time series name
* @return resulting time series
*/
public TimeSeries toTimeSeries(final String timeSeriesName)
{
final TimeSeries timeSeries = new TimeSeries(timeSeriesName);
for (final DataItem item : timerData.values())
{
timeSeries.add(item);
}
return timeSeries;
}
}