de.erichseifert.gral.data
Class DataAccessor
- java.lang.Object
-
- de.erichseifert.gral.data.DataAccessor
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Iterable<java.lang.Comparable<?>>
- Direct Known Subclasses:
- Row
public abstract class DataAccessor extends java.lang.Object implements java.lang.Iterable<java.lang.Comparable<?>>, java.io.SerializableAbstract base for reading substructures of a data source, i.e. columns or rows.DataAccessors are iterable and provide utility methods for statistics and array conversion.- See Also:
DataSource, Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description DataAccessor(DataSource source, int index)Initializes a new instance with the specified data source and an access index.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description booleanequals(java.lang.Object obj)abstract java.lang.Comparable<?>get(int index)Returns the value of the data source for the specified index.intgetIndex()Returns the index to access the data source.DataSourcegetSource()Returns the data source containing this column.doublegetStatistics(java.lang.String key)Returns the specified statistical information for this data.inthashCode()java.util.Iterator<java.lang.Comparable<?>>iterator()Returns an iterator over the elements of this object.abstract intsize()Returns the number of elements in this column.java.lang.Comparable<?>[]toArray(java.lang.Comparable<?>[] data)Converts the data column to an array.java.lang.StringtoString()
-
-
-
Constructor Detail
-
DataAccessor
public DataAccessor(DataSource source, int index)
Initializes a new instance with the specified data source and an access index.- Parameters:
source- Data source.index- Column index.
-
-
Method Detail
-
getSource
public DataSource getSource()
Returns the data source containing this column.- Returns:
- Data source containing this column.
-
getIndex
public int getIndex()
Returns the index to access the data source.- Returns:
- Data index.
-
get
public abstract java.lang.Comparable<?> get(int index)
Returns the value of the data source for the specified index.- Parameters:
index- Index.- Returns:
- Value of the accessed cell.
-
size
public abstract int size()
Returns the number of elements in this column.- Returns:
- Number of elements
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toArray
public java.lang.Comparable<?>[] toArray(java.lang.Comparable<?>[] data)
Converts the data column to an array.- Parameters:
data- Optional array as data sink. If array isnulla new array will be created.- Returns:
- Array with row data;
-
getStatistics
public double getStatistics(java.lang.String key)
Returns the specified statistical information for this data.- Parameters:
key- Requested Statistical information.- Returns:
- Calculated value.
-
iterator
public java.util.Iterator<java.lang.Comparable<?>> iterator()
Returns an iterator over the elements of this object.- Specified by:
iteratorin interfacejava.lang.Iterable<java.lang.Comparable<?>>- Returns:
- an iterator.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG