com.jstatcom.io
Interface DataHandler
-
- All Known Implementing Classes:
- TSASCIIHandler, TSExcelHandler, TSGaussDATHandler, TSGaussFMTHandler, TSMatlabHandler
public interface DataHandlerInterface to be implemented by classes that initiate parsing of data files and the creation of datasets. It can be used to import all kinds of datasets, because it does not rely on a distinct dataset class. It only uses the convention that elements of the dataset are stored asJSCDataobjects and that there existImportTypesdefining the structure of a dataset.The implementations of
DataHandlershould check whether a created dataset is in a consistent state when it can be accessed viagetData.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description voidexportData(java.io.File file, JSCData data, java.lang.String description)Exports data to a file in the format that the respective implementation of this interface handles.voidexportTS(java.io.File file, TS[] ts, java.lang.String description)Exports time series to a file in the format that the respective implementation of this interface handles.JSCDatagetData(ImportTypes type)Gets the imported data according to the respective type, which defines the kind of information to retrieve from the imported dataset.booleanimportData(java.io.File file)Parsesfileand collects the data asJSCDataobjects in aSymbolTable.
-
-
-
Method Detail
-
importData
boolean importData(java.io.File file)
Parsesfileand collects the data asJSCDataobjects in aSymbolTable. In case of an error this method should throw an exception. The return parameter should only indicate that the import operation was cancelled.- Parameters:
file- the file containing the data- Returns:
trueof import was ok,falseif cancelled
-
getData
JSCData getData(ImportTypes type)
Gets the imported data according to the respective type, which defines the kind of information to retrieve from the imported dataset.- Parameters:
type- defines the element of the dataset to get, for example the start date- Returns:
- the data stored as
JSCData
-
exportTS
void exportTS(java.io.File file, TS[] ts, java.lang.String description)Exports time series to a file in the format that the respective implementation of this interface handles.Implementation Note:
Not every handler implementation uses all information contained in a time series. For example, some handlers might not store the variable names, the date, and the description, because this may not be supported by the respective format.Implementations of this method should throw unchecked exceptions in case of errors, which should be dealt with by the calling objects.
- Parameters:
file- the file to store the time series tots- array of time series to exportdescription- an optional dataset description that handler implementations might use
-
exportData
void exportData(java.io.File file, JSCData data, java.lang.String description)Exports data to a file in the format that the respective implementation of this interface handles. This method should throw an exception if the type ofdatais not suppported.Implementations of this method should throw unchecked exceptions in case of errors, which should be dealt with by the calling objects.
- Parameters:
file- the file to store the data todata- the data object to store, must be supporteddescription- an optional description that handler implementations might use
-
-
DMelt 3.0 © DataMelt by jWork.ORG