Package net.simplace.sim.io.interfaces
Class CSVInterface
java.lang.Object
net.simplace.sim.io.interfaces.FWSimInterface<FilePool>
net.simplace.sim.io.interfaces.FILEInterface
net.simplace.sim.io.interfaces.CSVInterface
implementation of the
giving access to resources from and output to files
divider can be given in xml-configuration tag. If not given divider will by default be 'tab' or '\t'
Use Interface by
FWSimInterfaceFWSimInterface.getInterface(FWSimVarMap, CONTENT_TYPE).getLinesOfFile();- Author:
- Andreas Enders
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class net.simplace.sim.io.interfaces.FWSimInterface
FWSimInterface.INTERFACE_TYPE -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CSVInterface.DATA_MODEdata mode for IO to read/write array valuesprotected Stringdivider can be given in xml-configuration tag.protected Integer[]number of header lines to skip before reading the dataprotected longthe file nameprotected Integernumber of header lines to skip before reading the dataprotected booleanadd unit to field name in outputFields inherited from class net.simplace.sim.io.interfaces.FILEInterface
iContent, iFileinfo, iFilenameFields inherited from class net.simplace.sim.io.interfaces.FWSimInterface
iColumnMap, iColumnNamesInt, iIntColumnNames -
Constructor Summary
ConstructorsModifierConstructorDescriptionCSVInterface(String aName, int aPoolSize, String aFileName, String aContent, String aDivider, long aSkipAboveSize, Integer[] aLinesToRead, Integer aSkipHeaderLines, Boolean aAddUnit2FieldName, CSVInterface.DATA_MODE aDataMode) protectedCSVInterface(String aName, org.jdom2.Element aInterfaceElement) -
Method Summary
Modifier and TypeMethodDescriptionbooleandivider can be given in xml-configuration tag.getInterface(FWSimVarMap aVarMap, FWSimVariable.CONTENT_TYPE aContentType) implementation of the get interface method.Integer[]longread(FWSimSession aFwSimSession, String aProjectID, Object aCache, LinkedHashMap<String, String> aKeyMap, FWSimInputAdapter aResourceAdapter, String aUniqueID, FWSimInterface.INTERFACE_TYPE aInterfaceType) factory method creating an interface instance concerning the given data typeorg.jdom2.ElementtoXML()Methods inherited from class net.simplace.sim.io.interfaces.FILEInterface
finalize, getFilename, setFilenameMethods inherited from class net.simplace.sim.io.interfaces.FWSimInterface
checkHeaderForColMode, createInterface, createInterface, createStatisticInterface, getInterfaceType, getName, getPoolSize, readColArray, toString, transformArrays, writeToDatabase
-
Field Details
-
iDivider
divider can be given in xml-configuration tag. If not given divider will by default be 'tab' or '\t' -
iSkipAboveSize
protected long iSkipAboveSizethe file name -
iLinesToRead
number of header lines to skip before reading the data -
iUnit2Fieldname
protected boolean iUnit2Fieldnameadd unit to field name in output -
iDataMode
data mode for IO to read/write array values -
iSkipHeaderLines
number of header lines to skip before reading the data
-
-
Constructor Details
-
CSVInterface
- Parameters:
aName-aPoolSize-aInterfaceElement-
-
CSVInterface
public CSVInterface(String aName, int aPoolSize, String aFileName, String aContent, String aDivider, long aSkipAboveSize, Integer[] aLinesToRead, Integer aSkipHeaderLines, Boolean aAddUnit2FieldName, CSVInterface.DATA_MODE aDataMode) - Parameters:
aName-aPoolSize-aFileName-aDivider-aSkipAboveSize-aLinesToRead-aSkipHeaderLines-
-
-
Method Details
-
read
public FWSimResourceCache read(FWSimSession aFwSimSession, String aProjectID, Object aCache, LinkedHashMap<String, String> aKeyMap, FWSimInputAdapter aResourceAdapter, String aUniqueID, FWSimInterface.INTERFACE_TYPE aInterfaceType) throws MissingSimResourceExceptionDescription copied from class:FWSimInterfacefactory method creating an interface instance concerning the given data type- Specified by:
readin classFWSimInterface<FilePool>- Returns:
- generic
FWSimResourceCache - Throws:
MissingSimResourceException
-
getInterface
implementation of the get interface method.- Overrides:
getInterfacein classFILEInterface- Returns:
- generic interface connection object. for example: database - connection; xml - fileinfo
- See Also:
-
getDivider
divider can be given in xml-configuration tag. If not given divider will by default be 'tab' or '\t'- Returns:
- the divider the string is split with to read the data from columns
-
getLinesToRead
- Returns:
-
getSkipHeaderLines
- Returns:
- the skipHeaderLines
-
getSkipAboveSize
public long getSkipAboveSize()- Returns:
-
getDataMode
-
getAddUnitToFieldName
public boolean getAddUnitToFieldName()- Returns:
- if units should be added to field name
-
toXML
public org.jdom2.Element toXML()- Overrides:
toXMLin classFILEInterface- Returns:
- Element containing configuration for this Interface
-