vec_math
Class AbstractDataSink

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by vec_math.AbstractDataSink
All Implemented Interfaces:
Cloneable, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying, DataSink

public abstract class AbstractDataSink
extends PropertyBundles
implements DataSink

A skeleton implementation of a data sink. acceptsData(java.lang.String) and metaData(java.util.Map) return true, setData(java.util.List) calls DataSink.clearData() and addData(java.util.List), thus only those two methods have to be implemented.


Nested Class Summary
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
 
Fields inherited from class util.PropertyBundles
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES
 
Fields inherited from class util.PropertyResources
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset
 
Fields inherited from class util.PropertyContainer
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Constructor Summary
protected AbstractDataSink(Map<String,String> prop)
          Constructs a new data sink.
 
Method Summary
 boolean acceptsData(String any)
          Returns true.
 boolean addData(List<VectorG> data)
          For small data sets this method suffices to deviate to the DataSink.addData(Map) method.
static List<Object> getOutliers(Map<Object,VectorG> data, DataModel fit, VectorG solution, double dev)
          From the user data and a data model we extract those keys that have a residual that is higher than the stated maximum discrepancy.
static Map<Object,VectorG> mapConvert(List<VectorG> d)
          Converts a list of vectors to a mapping of index-to-vector.
 boolean metaData(Map<String,? extends Serializable> m)
          Returns true.
 boolean setData(List<VectorG> data)
          Sets the data by calling clear and add with the vector list.
 boolean setData(Map<Object,VectorG> d)
          Sets the data by calling clear and then adding the data map.
static List<VectorG> vectorConvert(double[][] matrix)
          Converts a two-dimensional double array into a list of vectors.
static List<VectorG> vectorConvert(double[] chain, int vecdim)
          Converts a one-dimensional double array with implicit indexing along the dimension of the vector passed over.
 
Methods inherited from class util.PropertyBundles
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource
 
Methods inherited from class util.PropertyResources
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, init, keyCreate, keyCreate, reload, setApplet
 
Methods inherited from class util.PropertyContainer
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface vec_math.DataSink
addData, clearData
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 
Methods inherited from interface util.PropertySupplying
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties
 
Methods inherited from interface util.Initializable
init
 

Constructor Detail

AbstractDataSink

protected AbstractDataSink(Map<String,String> prop)
Constructs a new data sink.

Method Detail

acceptsData

public boolean acceptsData(String any)
Returns true.

Specified by:
acceptsData in interface DataSink
Returns:
True, if this sink might use thi type of data.

metaData

public boolean metaData(Map<String,? extends Serializable> m)
Returns true.

Specified by:
metaData in interface DataSink
Returns:
False, if we cannot interprete data with the information available.

setData

public boolean setData(List<VectorG> data)
Sets the data by calling clear and add with the vector list.

Specified by:
setData in interface DataSink
Returns:
True, if we can interprete this data.

addData

public boolean addData(List<VectorG> data)
For small data sets this method suffices to deviate to the DataSink.addData(Map) method. On huge data set, you may override this to increase performance.

Specified by:
addData in interface DataSink
Returns:
True, if we can interprete this data.

setData

public boolean setData(Map<Object,VectorG> d)
Sets the data by calling clear and then adding the data map.

Specified by:
setData in interface DataSink

mapConvert

public static Map<Object,VectorG> mapConvert(List<VectorG> d)
Converts a list of vectors to a mapping of index-to-vector. We retain the order in the list


vectorConvert

public static List<VectorG> vectorConvert(double[][] matrix)
Converts a two-dimensional double array into a list of vectors. First index corresponds to the index in the list, second to the vector elements


vectorConvert

public static List<VectorG> vectorConvert(double[] chain,
                                          int vecdim)
Converts a one-dimensional double array with implicit indexing along the dimension of the vector passed over. The array is organized as v0.x v0.y v0.z [...] v1.x v1.y [...] , i.e. the vecor elements are all stitched together as on a chain.


getOutliers

public static List<Object> getOutliers(Map<Object,VectorG> data,
                                       DataModel fit,
                                       VectorG solution,
                                       double dev)
From the user data and a data model we extract those keys that have a residual that is higher than the stated maximum discrepancy. Iterating over the values in the data map must retain the order of measures in the data model