Represents a fixed set of data
points
in a data type's
stream from a particular data
source
. A data set usually represents data at fixed time boundaries, and can be
used both for batch data insertion and as a result of read requests.
Here's a sample usage for populating a data source with activity data:
DataType dataType = DataType.TYPE_ACTIVITY_SEGMENT; DataSet.Builder dataSetBuilder = DataSet.builder(dataSource); for (ActivitySegment segment : getActivitySegments()) { dataSetBuilder.add(DataPoint.builder(dataSource) .setTimeInterval(segment.getStartMillis(), segment.getEndTimeMillis(), MILLISECONDS)) .setValues(segment.getActivity()) .build()); } DataSet dataSet = dataSetBuilder.build();
Nested Class Summary
Inherited Constant Summary
Public Method Summary
void | |
void | |
static DataSet.Builder | |
static DataSet | create
( DataSource
dataSource)
Creates a new data set to hold data points for the given
dataSource
. |
DataPoint | |
boolean | |
List < DataPoint > | |
DataSource | |
DataType | |
int | hashCode
()
|
boolean | |
String | toString
()
|
void |
Inherited Method Summary
Public Methods
public void add ( DataPoint dataPoint)
This method is deprecated.
Build DataSet
instances using the builder
.
Adds a data point to this data set. The data points should be for the correct data type and data source, and should have its timestamp already set.
Throws
dataPoint
has invalid data.public void addAll ( Iterable < DataPoint > dataPoints)
This method is deprecated.
Build DataSet
instances using the builder
.
Adds a list of data points to this data set in bulk. All data points should be for the correct data type and data source, and should have their timestamp already set.
public static DataSet.Builder builder ( DataSource dataSource)
Creates a new builder for a DataSet
with the given dataSource
.
Throws
public static DataSet create ( DataSource dataSource)
Creates a new data set to hold data points for the given dataSource
.
Data points with the matching data source can be created using createDataPoint()
, and after having the values set added to the data set via add(DataPoint)
.
Throws
public DataPoint createDataPoint ()
Creates an empty data point for this data set's data source. The new data point is not
added to the data set by this method. After the data point is initialized, add(DataPoint)
should be called.
public boolean equals ( Object other)
public List < DataPoint > getDataPoints ()
Returns the list of data points represented by this data set. The data points will preserve the same order in which they were inserted.
Certain APIs that return a DataSet might insert data points in chronological order, but this isn't enforced.
public DataSource getDataSource ()
Returns the data source which this data set represents. All of the data points in the data set are from this data source.
public DataType getDataType ()
Returns the data type this data set represents. All of the data points in the data set are of this data type.
public int hashCode ()
public boolean isEmpty ()
Returns whether this data set contains no data points.