Class FILEInterface
java.lang.Object
net.simplace.sim.io.interfaces.FWSimInterface<FilePool>
net.simplace.sim.io.interfaces.FILEInterface
- Direct Known Subclasses:
CSVInterface, NetCDFInterface, XMLInterface
Base class of the file based interfaces. The access object is a
FilePool, which manages the files (the file
name may contain tokens and therefore differ between simulations). Instead of a file name the data can be given
directly as content.- Author:
- Andreas Enders
-
Nested Class Summary
Nested classes/interfaces inherited from class FWSimInterface
FWSimInterface.INTERFACE_TYPE -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringthe data as string instead of a file (childcontent)protected FilePoolthe file pool, created on the first call ofgetInterface(FWSimVarMap, CONTENT_TYPE)protected Stringthe file name (childfilename), may contain${...}tokensFields inherited from class FWSimInterface
iColumnMap, iColumnNamesInt, iIntColumnNames -
Constructor Summary
ConstructorsModifierConstructorDescriptionFILEInterface(String aName, int aPoolSize, FWSimInterface.INTERFACE_TYPE aType, String aFileName, String aContent) Creates the interface without element.protectedFILEInterface(String aName, FWSimInterface.INTERFACE_TYPE aType, org.jdom2.Element aInterfaceElement) Creates the interface from its element (childrenfilenameandcontent). -
Method Summary
Modifier and TypeMethodDescriptionvoidfinalize()Closes the files of the file pool.getInterface(FWSimVarMap aVarMap, FWSimVariable.CONTENT_TYPE aContentType) Returns the file pool; it is created on the first call if a file name or content is given.protected voidCloses and discards the file pool, so it is created again with the current settings on the next use (e.g.voidsetFilename(String aFilename) org.jdom2.ElementtoXML()Adds thefilenameandcontentelements (if set) to the element of the base class.Methods inherited from class FWSimInterface
checkHeaderForColMode, createInterface, createInterface, createStatisticInterface, getInterfaceElement, getInterfaceType, getName, getPoolSize, read, readColArray, readColArray, toString, transformArrays, writeToDatabase
-
Field Details
-
iFilename
the file name (childfilename), may contain${...}tokens -
iContent
the data as string instead of a file (childcontent) -
iFileinfo
the file pool, created on the first call ofgetInterface(FWSimVarMap, CONTENT_TYPE)
-
-
Constructor Details
-
FILEInterface
protected FILEInterface(String aName, FWSimInterface.INTERFACE_TYPE aType, org.jdom2.Element aInterfaceElement) Creates the interface from its element (childrenfilenameandcontent).- Parameters:
aName- name of the interfaceaType- type of the interfaceaInterfaceElement- theinterfaceelement
-
FILEInterface
public FILEInterface(String aName, int aPoolSize, FWSimInterface.INTERFACE_TYPE aType, String aFileName, String aContent) Creates the interface without element.- Parameters:
aName- name of the interfaceaPoolSize- number of pooled filesaType- type of the interfaceaFileName- the file name, may contain tokensaContent- the data as string instead of a file, may benull
-
-
Method Details
-
getInterface
Returns the file pool; it is created on the first call if a file name or content is given.- Specified by:
getInterfacein classFWSimInterface<FilePool>- Parameters:
aVarMap- variable map used for replacing tokens (e.g. in file names), may benullaContentType-resfor reading,outfor writing- Returns:
- the file pool, or
nullwithout file name and content - See Also:
-
getRegisteredOutputFiles
- Returns:
- the output files registered in the file pool of this interface (absolute paths; empty if the interface
was not used for writing), see
FilePool.getRegisteredFiles()
-
getFilename
- Returns:
- the file name (with tokens)
-
setFilename
- Parameters:
aFilename- the file name; an already created file pool is closed and created again on the next use
-
resetFilePool
protected void resetFilePool()Closes and discards the file pool, so it is created again with the current settings on the next use (e.g. after the settings were changed in the GUI). -
toXML
public org.jdom2.Element toXML()Adds thefilenameandcontentelements (if set) to the element of the base class.- Overrides:
toXMLin classFWSimInterface<FilePool>- Returns:
- the
interfaceelement
-
finalize
Closes the files of the file pool.- Specified by:
finalizein classFWSimInterface<FilePool>- Throws:
Exception- if releasing fails- See Also:
-