Class FWSimInputAdapter
java.lang.Object
net.simplace.sim.io.FWSimIOAdapter
net.simplace.sim.io.resources.FWSimInputAdapter
- All Implemented Interfaces:
FWSimFieldContainer
- Direct Known Subclasses:
FWSimResourceAdapter, FWSimResourceAlias, FWSimResourceTransformer
Base class of the adapters that only read input data: resources (
resource element, reading from an
interface) and transformers (transform element, deriving data from another resource). The data is
provided as FWSimResourceCache by getData(FWSimVarMap); the header variables are the outputs of
the adapter.- Author:
- Andreas Enders
-
Nested Class Summary
Nested classes/interfaces inherited from class FWSimIOAdapter
FWSimIOAdapter.FREQUENCE -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected JexlRuleScriptcompiled rule of the adapter, created on demand bygetJexlScript()protected Booleanif the content of the resource cache should also be stored in the database (attributedbcache)Fields inherited from class FWSimIOAdapter
iArrayMode, iFieldcount, iFrequence, iHeaderVariables, iInterface, iJexlRule, iKeyMap, iName, iOrderNumber, iProcessTime, iResourceElement, iSession, iSourceKey -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFWSimInputAdapter(FWSimInputAdapter aAdapter, FWSimInterface<?> aInterface) Copy constructor used when the interface of an adapter is replaced.protectedFWSimInputAdapter(org.jdom2.Element aResourceElement, String aName, int aOrderNumber, FWSimInterface<?> aInterface, FWSimIOAdapter.FREQUENCE aFrequence, FWSimSession aFwSimSession) Creates the adapter from the graph panel.protectedFWSimInputAdapter(org.jdom2.Element aResourceElement, FWSimSession aSession, int aOrderNumber) Creates the adapter from a solution element. -
Method Summary
Modifier and TypeMethodDescriptionReturnsres.abstract FWSimResourceCachegetData(FWSimVarMap aVarMap) Reads the data of the resource for a simulation.Returns an empty list; input adapters have no input variables.Returns the header variables.Returns the variable map of the solution of the session, ornullif there is none.booleanvoidsetFrequenceAndRule(FWSimIOAdapter.FREQUENCE aFrequence, String aRule) Changes frequency and rule; the compiled rule is created again on the next use.booleanCreates the HTML documentation of the adapter for the solution overview: name, class, interface (or source resource for transformers), frequency and a table of the header variables (withoutsysvariables).Methods inherited from class FWSimIOAdapter
addProcessTime, addVariable, checkCondition, createFormFields, createVariables, finalize, getCreateFormXML, getEditFormXML, getFieldMap, getFrequence, getHeaderVariables, getHeaderXML, getInterface, getJexlRule, getKeyMap, getName, getOrderNumber, getVariable, isArrayMode, isConditionCheck, removeVariable, setInterface, setOrderNumber, toString, writeHeaderListMethods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface FWSimFieldContainer
toXML
-
Field Details
-
iShouldCacheToDB
if the content of the resource cache should also be stored in the database (attributedbcache) -
iJexlScript
compiled rule of the adapter, created on demand bygetJexlScript()
-
-
Constructor Details
-
FWSimInputAdapter
protected FWSimInputAdapter(org.jdom2.Element aResourceElement, FWSimSession aSession, int aOrderNumber) Creates the adapter from a solution element. The attributedbcachedefaults totruefor resources andfalsefor transformers.- Parameters:
aResourceElement- theresourceortransformelementaSession- the sessionaOrderNumber- order number of the adapter
-
FWSimInputAdapter
protected FWSimInputAdapter(org.jdom2.Element aResourceElement, String aName, int aOrderNumber, FWSimInterface<?> aInterface, FWSimIOAdapter.FREQUENCE aFrequence, FWSimSession aFwSimSession) Creates the adapter from the graph panel. The attributedbcachedefaults totruefor resources andfalsefor transformers (as for adapters from the solution).- Parameters:
aResourceElement- theresourceortransformelementaName- name (id) of the adapteraOrderNumber- order number of the adapteraInterface- interface to read fromaFrequence- frequency the data is read withaFwSimSession- the session
-
FWSimInputAdapter
Copy constructor used when the interface of an adapter is replaced.- Parameters:
aAdapter- the adapter to copy;nullonly for instantiation via reflection (then the adapter counts as transformer anddbcachestays unset)aInterface- the new interface
-
-
Method Details
-
getData
Reads the data of the resource for a simulation.- Parameters:
aVarMap- variable map of the simulation (e.g. for the key values of the rule)- Returns:
- the cache containing the data read
- Throws:
MissingSimResourceException- if the data cannot be read
-
getOutputVariables
Returns the header variables.- Returns:
- the output variables of the field map
- See Also:
-
getInputVariables
Returns an empty list; input adapters have no input variables.- Returns:
- the input variables of the field map
- See Also:
-
getContentType
Returnsres.- Returns:
- the content type of the variables of this container (e.g.
sys,mgm) - See Also:
-
getJexlScript
- Returns:
- the compiled rule of the adapter; created on the first call
-
setFrequenceAndRule
Changes frequency and rule; the compiled rule is created again on the next use.- Overrides:
setFrequenceAndRulein classFWSimIOAdapter- Parameters:
aFrequence- the frequencyaRule- the rule, empty for none (required for COMPLEX and BOOLEAN)- See Also:
-
getVarMap
Returns the variable map of the solution of the session, ornullif there is none.- Returns:
- the var map this container belongs to
- See Also:
-
toHTMLTablestring
Creates the HTML documentation of the adapter for the solution overview: name, class, interface (or source resource for transformers), frequency and a table of the header variables (withoutsysvariables).- Returns:
- the HTML fragment
-
isTransformer
public boolean isTransformer()- Returns:
trueif the adapter was created from atransformelement
-
shouldCacheToDB
public boolean shouldCacheToDB()- Returns:
trueif the resource cache should also be stored in the database (falseif not set, e.g. for adapters created via reflection)
-