kcl.waterloo.graphics.data
Interface GJDataVectorInterface<T>
-
- Type Parameters:
T- type of DataBuffer used to store the data.
- All Superinterfaces:
- java.util.EventListener, GJObservableInterface, java.beans.PropertyChangeListener
- All Known Implementing Classes:
- GJAbstractDataVector, GJBigDecimalDataVector, GJDoubleDataVector, GJFloatDataVector, GJPrimitiveDoubleDataVector
public interface GJDataVectorInterface<T> extends GJObservableInterface
TheGJDataVectorInterfaceinterface defines the methods that must be implemented by classes representing the x and y data for a 2D plot.Each
GJDataVectorInterfacesupports a DataBuffer of class T that contains the data for the x or y coordinatesData will be supplied to the paint methods of individual plots via the
getDataValues</>method. This method returns data as a double precision vector after transforming the data via a transform set in the host graph. Thus all plots and data in a single view will share the same transform. A layered view, with multiple overlapping graphs can be used to superimpose plots using different transformsA skeletal implementation of the
GJDataVectorInterfaceis supplied in theGJAbstractDataVectorclass.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface and Description static classGJDataVectorInterface.AXIS
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description voidclearDataBufferData()Sets the vector in the DataBuffer to null This method should fire a PropertyChangeEventjava.lang.ClassgetBufferClass()java.util.LinkedHashMap<java.lang.Double,Category>getCategories()Returns the LinkedHasMap of category settings.CategorygetCategory(double val)Returns the category associated with the specified double value.TgetDataBuffer()Returns the DataBuffer.double[]getDataValues(GJDataTransformInterface transform)Returns the data as an IEEE double precision array transformed by the class specified bygetTranformintgetDimension()Length of the vector in the DataBufferjava.lang.ObjectgetEntry(int index)Returns a value from the DataBufferjava.lang.StringgetName()double[]getRawDataValues()Returns the data as an IEEE double precision array without applying a transformbooleanisCategorical()Determines if this data set is categorical i.e.voidsetCategories(java.util.LinkedHashMap<java.lang.Double,Category> cat)Sets the LinkedHashMap containing the categories.voidsetCategory(double val, java.lang.String s)Associates aCategorycontaining {code String} s with the specifieddoublevalue.voidsetDataBuffer(java.lang.Object o)Sets the DataBuffer used to store the data.voidsetDataBufferData(java.util.AbstractList<? extends java.lang.Number> arr)Sets the vector in the DataBuffer to thevalues in the input.voidsetDataBufferData(double[] arr)Sets the vector in the DataBuffer to thevalues in the input.voidsetDataBufferData(int[] arr)Sets the vector in the DataBuffer to thevalues in the input.voidsetDataBufferData(java.util.Map m)Sets the vector in the DataBuffer to a series incrementing by 1 for each element.voidsetEntry(int index, double val)Sets a value in the DataBuffer This method should fire a PropertyChangeEvent when the buffer data are changedvoidsetName(java.lang.String s)-
Methods inherited from interface kcl.waterloo.observable.GJObservableInterface
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, hasListeners, hasSelfListener, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Method Detail
-
isCategorical
boolean isCategorical()
Determines if this data set is categorical i.e. has that categories is non-null.- Returns:
- true if Categories != null
-
getCategories
java.util.LinkedHashMap<java.lang.Double,Category> getCategories()
Returns the LinkedHasMap of category settings. SeeGJAbstractDataVector#categories categoriesinGJAbstractDataVector.- Returns:
- a LinkedHashMap
-
getCategory
Category getCategory(double val)
Returns the category associated with the specified double value.- Parameters:
val-- Returns:
- a Category
-
setCategory
void setCategory(double val, java.lang.String s)Associates aCategorycontaining {code String} s with the specifieddoublevalue.- Parameters:
val-s-
-
setCategories
void setCategories(java.util.LinkedHashMap<java.lang.Double,Category> cat)
Sets the LinkedHashMap containing the categories.- Parameters:
cat- a LinkedHashMapmap.
-
getDataValues
double[] getDataValues(GJDataTransformInterface transform)
Returns the data as an IEEE double precision array transformed by the class specified bygetTranform- Parameters:
transform-- Returns:
- a double[]
-
getRawDataValues
double[] getRawDataValues()
Returns the data as an IEEE double precision array without applying a transform- Returns:
- a double[]
-
getDataBuffer
T getDataBuffer()
Returns the DataBuffer.- Returns:
- DataBuffer of type
T
-
setDataBuffer
void setDataBuffer(java.lang.Object o)
Sets the DataBuffer used to store the data. The buffer will be copied by reference.- Parameters:
o- the object array or wrapper.
-
getDimension
int getDimension()
Length of the vector in the DataBuffer- Returns:
- the length of the vector
-
getBufferClass
java.lang.Class getBufferClass()
- Returns:
- the class of the DataBuffer
-
setDataBufferData
void setDataBufferData(double[] arr)
Sets the vector in the DataBuffer to thevalues in the input. Data may be cast and lose precision in the copy process. This method should fire a PropertyChangeEvent when the buffer data are changed- Parameters:
arr-
-
setDataBufferData
void setDataBufferData(int[] arr)
Sets the vector in the DataBuffer to thevalues in the input. Data may be cast and lose precision in the copy process. This method should fire a PropertyChangeEvent when the buffer data are changed- Parameters:
arr-
-
setDataBufferData
void setDataBufferData(java.util.AbstractList<? extends java.lang.Number> arr)
Sets the vector in the DataBuffer to thevalues in the input. Data may be cast and lose precision in the copy process. This method should fire a PropertyChangeEvent when the buffer data are changed- Parameters:
arr-
-
setDataBufferData
void setDataBufferData(java.util.Map m)
Sets the vector in the DataBuffer to a series incrementing by 1 for each element.mmust be a Map with a single key, which determines the start value of the series while the value corresponding to the key represents the upper limit of the series. TODO: Should this be removed?? This method should fire a PropertyChangeEvent when the buffer data are changed- Parameters:
m- a Map of size equal to 1.
-
clearDataBufferData
void clearDataBufferData()
Sets the vector in the DataBuffer to null This method should fire a PropertyChangeEvent
-
getEntry
java.lang.Object getEntry(int index)
Returns a value from the DataBuffer- Parameters:
index- of the required entry- Returns:
- the value a a double
-
setEntry
void setEntry(int index, double val)Sets a value in the DataBuffer This method should fire a PropertyChangeEvent when the buffer data are changed- Parameters:
index-val- the new value as double
-
getName
java.lang.String getName()
-
setName
void setName(java.lang.String s)
-
-
DMelt 3.0 © DataMelt by jWork.ORG