public class

SimpleDataAdapter

extends DataAdapter<Tx, Ty>
java.lang.Object
   ↳ com.shinobicontrols.charts.DataAdapter<Tx, Ty>
     ↳ com.shinobicontrols.charts.SimpleDataAdapter<Tx, Ty>

Class Overview

An ordered collection of Data objects which it holds for, and provides to, a Series. SimpleDataAdapter is a basic, concrete implementation of DataAdapter which notifies its series that it has been updated every time its dataPoints are modified.

Data points can be added and removed as necessary, and accessed and inserted by their integer index (position in the list). Duplicate data dataPoints are allowed. However, null data dataPoints cannot be added to a data adapter; trying to do so will result in a NullPointerException being thrown.

See Also

Summary

Public Constructors
SimpleDataAdapter()
Public Methods
boolean add(Data<Tx, Ty> dataPoint)
Appends the specified data point to the end of this data adapter.
void add(int location, Data<Tx, Ty> dataPoint)
Inserts the specified data point at the specified position in the data adapter.
boolean addAll(int location, Collection<? extends Data<Tx, Ty>> dataPoints)
Inserts all of the data points in the specified collection into the data adapter at the specified position.
boolean addAll(Collection<? extends Data<Tx, Ty>> dataPoints)
Appends all of the data points in the specified collection to the end of this data adapter.
void clear()
Removes all of the data points from this data adapter, resulting in an empty data adapter.
Data<Tx, Ty> remove(int location)
Removes the data point at the specified location from this data adapter.
boolean remove(Object object)
Removes the first occurrence of the specified object from this data adapter.
boolean removeAll(Collection<?> collection)
Removes all occurrences of each object in the specified collection from this data adapter
boolean retainAll(Collection<?> collection)
Removes all objects from this data adapter that are not contained in the specified collection.
Data<Tx, Ty> set(int location, Data<Tx, Ty> dataPoint)
Replaces the data point at the specified location in this data adapter with the specified data point.
[Expand]
Inherited Methods
From class com.shinobicontrols.charts.DataAdapter
From class java.lang.Object
From interface java.lang.Iterable

Public Constructors

public SimpleDataAdapter ()

Public Methods

public boolean add (Data<Tx, Ty> dataPoint)

Appends the specified data point to the end of this data adapter. Null data points are not permitted; trying to add one will result in a NullPointerException being thrown.

Parameters
dataPoint The data point to append to this data adapter
Returns
  • true if the data adapter changed as a result of the call

public void add (int location, Data<Tx, Ty> dataPoint)

Inserts the specified data point at the specified position in the data adapter. This will shift the data point currently at location and all subsequent data points to the right, adding one to their indices. Null data points are not permitted; trying to add one will result in a NullPointerException being thrown.

Parameters
location The index at which to insert
dataPoint The data point to insert into this data adapter

public boolean addAll (int location, Collection<? extends Data<Tx, Ty>> dataPoints)

Inserts all of the data points in the specified collection into the data adapter at the specified position. This will shift the data point currently at location and all subsequent data points to the right, adding one to their indices. Adding a null collection of data points, or a collection containing one or more null data points is not permitted and will result in a NullPointerException being thrown.

Parameters
location The index at which to insert
dataPoints Collection containing data points to be appended to the end of this data adapter
Returns
  • true if the data adapter changed as a result of the call

public boolean addAll (Collection<? extends Data<Tx, Ty>> dataPoints)

Appends all of the data points in the specified collection to the end of this data adapter. Adding a null collection of data points, or a collection containing one or more null data points is not permitted and will result in a NullPointerException being thrown.

Parameters
dataPoints Collection containing data points to be appended to the end of this data adapter
Returns
  • true if the data adapter changed as a result of the call

public void clear ()

Removes all of the data points from this data adapter, resulting in an empty data adapter.

public Data<Tx, Ty> remove (int location)

Removes the data point at the specified location from this data adapter.

Parameters
location The index of the data point to remove
Returns
  • The removed data point

public boolean remove (Object object)

Removes the first occurrence of the specified object from this data adapter.

Parameters
object The object to remove
Returns
  • true if this data adapter was modified by this operation, false otherwise

public boolean removeAll (Collection<?> collection)

Removes all occurrences of each object in the specified collection from this data adapter

Parameters
collection The collection of objects to remove
Returns
  • true if this data adapter was modified, false otherwise

public boolean retainAll (Collection<?> collection)

Removes all objects from this data adapter that are not contained in the specified collection.

Parameters
collection The collection of objects to retain
Returns
  • true if this data adapter was modified, false otherwise

public Data<Tx, Ty> set (int location, Data<Tx, Ty> dataPoint)

Replaces the data point at the specified location in this data adapter with the specified data point. This size of the data adapter remains the same. Null data points are not permitted; trying to add one will result in a NullPointerException being thrown.

Parameters
location The index of the data point to replace
dataPoint The new data point with which to replace the existing data point
Returns
  • The existing data point at the specified location