Package net.simplace.sim.util
Klasse FWSimHelper
java.lang.Object
net.simplace.sim.util.FWSimHelper
Helper instance consisting of helper methods with instances of an operation tree parser to evaluate
rules while replacing parameters in variables
- Autor:
- Andreas Enders
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungstatic final Pattern[!]static final Pattern[!]static Comparator<FWSimFieldContainer> static final Pattern[$][{][^},^{]*[}]static final Pattern[$][{][^},^{]*[}]static final Comparator<FWSimVariable<?>> Instantiates the Comparator for SimVariables to order them within the SimComponent (used for nice output) -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic FileaddResourceFiles(String aWorkDir, String aSimulationExperimentPath, String aSolutionFileName, String aProjectFileName) static LinkedHashMap<String, String> ArrayToLinkedMap(Object[] aArray) converts a Object[] to a LinkedHashMapArrayToMap(Double[] aArray) converts a double[] to a tree mapstatic BooleancheckForAction(LocalDateTime aCurrentDate, FWSimIOAdapter.FREQUENCE aFrequence, JexlRuleScript aJexlScript, FWSimVarMap aVarMap) static voidedit(FWSimFieldContainer aContainer, boolean aEnabled) static HashMap<String, FWSimVariable<?>> filterVarMap(HashMap<String, FWSimVariable<?>> aMap, String aRegexp) static Collection<String> findResources(String aPackage, String aRegexp) static StringgenerateSimulationID(Integer aProjectIteration, String aProjectID, String aSimulationName, Integer aSimulationNumber) static FWSimVariable.DATA_TYPEgetDataTypeFromValue(String aFirstValue) static Object[][]getObjectArrayFromVarMap(FWSimVarMap aVarMap) static StringgetParameterName(String aKey) getParametersFromString(Pattern pattern, String aString) static ObjectgetValueFromSpecialParameter(FWSimVarMap aParamMap, String aKey, Object aDefault) getting parameter value from key if value is Map, Array, List or Date using '!'static voidlogInitialInfo(boolean aForce) Log system information at beginning of the application startstatic PreparedStatementprepareCountSelect(String aTableName, String aConnectionPoolDefault) static PreparedStatementprepareDatabase(String aTableName, HashMap<String, FWSimVariable<?>> aHeaderVariables, String aConnectionPoolDefault, boolean aDropIfExists, boolean aDoCreateTable) static PreparedStatementprepareLimitedSelect(String aTableName, HashMap<String, FWSimVariable<?>> aFieldMap, String aConnectionPoolDefault) static StringreplaceParamTokens(FWSimVarMap aParamMap, String aValue, Object aDefault) replaces Parameters instatic voidshowFields(FWSimFieldContainer aVertex) splitProjectDataByNumberOfCores(File aProjectDataFile, String aDivider, int[] aListOfCores) static LinkedHashMap<String, String> splitProjectDataBySimulationCount(File aProjectDataFile, String aDivider, int aSplitCount) static LinkedHashMap<String, String> splitProjectDataBySimulationCount(File aProjectDataFile, String aDivider, int aSplitNumber, String[][] aReadCSVtoArray) static ObjectunzipArray(FWSimVariable<?> aTargetVariable, ArrayList<String> aFieldMapIndizes, Object[] aSourceArray, Set<String> aParametersFromString, FWSimFieldContainer aContainer) Implement rules for expressions like !static ObjectzipArray(FWSimVariable<?> aTargetVariable, ArrayList<String> aFieldMapIndizes, Object[] aSourceArray, Set<String> aParametersFromString, FWSimFieldContainer aContainer) Implemented rules for expressions like !
-
Felddetails
-
PARAMPATTERN
[$][{][^},^{]*[}] -
PARAMSEARCHPATTERN
[$][{][^},^{]*[}] -
EXPRESSIONPATTERN
[!][A-Z]*:.*[!] -
ARRAYVALUEPATTERN
[!][A-Z]*:.*[!] -
FIELD_COMPERATOR
-
SIM_VAR_COMARATOR
Instantiates the Comparator for SimVariables to order them within the SimComponent (used for nice output)
-
-
Konstruktordetails
-
FWSimHelper
public FWSimHelper()
-
-
Methodendetails
-
replaceParamTokens
replaces Parameters in- Parameter:
aParamMap-aValue- matching the regexp '.*[${].*[}].*' with given parameters inaDefault-- Gibt zurück:
- aNewValue
-
getValueFromSpecialParameter
public static Object getValueFromSpecialParameter(FWSimVarMap aParamMap, String aKey, Object aDefault) getting parameter value from key if value is Map, Array, List or Date using '!' as a separator.- Parameter:
aParamMap-aKey-aDefault-- Gibt zurück:
- the new value object - if not retrieved the default.
-
getParametersFromString
- Parameter:
pattern-aString-- Gibt zurück:
- parameters from a given aString
-
ArrayToLinkedMap
converts a Object[] to a LinkedHashMap- Parameter:
aArray-- Gibt zurück:
- the fixed ordered tree map
-
ArrayToMap
converts a double[] to a tree map- Parameter:
aArray-- Gibt zurück:
- the fixed ordered tree map
-
findSimComponents
- Gibt zurück:
- a List of Strings representing the Classes extended from FWSimComponent
-
findResources
- Parameter:
aPackage-aRegexp-- Gibt zurück:
- a List of Strings representing the Classes extended from FWSimComponent
-
findResourceTransformers
- Gibt zurück:
- a List of Strings representing the Classes extended from FWSimResourceTransformer
-
findSelectors
- Gibt zurück:
- a List of Strings representing the Classes extended from FWSimulationSelector
-
findGenerators
- Gibt zurück:
- a List of Strings representing the Classes extended from FWSimulationSelector
-
findIterators
- Gibt zurück:
- a List of Strings representing the Classes extended from FWSimulationSelector
-
showFields
- Parameter:
aVertex-
-
edit
- Parameter:
aContainer-aEnabled-
-
getDataTypeFromValue
- Parameter:
aFirstValue-- Gibt zurück:
- the fitting data type
-
getObjectArrayFromVarMap
- Parameter:
aVarMap-- Gibt zurück:
- the Object Array containing keys and values of the data
-
getParameterName
- Parameter:
aKey-- Gibt zurück:
- the first parameter in the key string
-
unzipArray
public static Object unzipArray(FWSimVariable<?> aTargetVariable, ArrayList<String> aFieldMapIndizes, Object[] aSourceArray, Set<String> aParametersFromString, FWSimFieldContainer aContainer) Implement rules for expressions like !UNZIP_KEYS(${C[])! = A[] !UNZIP_VALUES(${C[]})! = B[]- Parameter:
aTargetVariable-aFieldMapIndizes-aSourceArray-aParametersFromString-aContainer-- Gibt zurück:
- the unzipped array
-
zipArray
public static Object zipArray(FWSimVariable<?> aTargetVariable, ArrayList<String> aFieldMapIndizes, Object[] aSourceArray, Set<String> aParametersFromString, FWSimFieldContainer aContainer) Implemented rules for expressions like !ZIP(${A[]},${B[]})! = C[]- Parameter:
aTargetVariable-aFieldMapIndizes-aSourceArray-aParametersFromString-aContainer-- Gibt zurück:
- the zipped Array
-
filterVarMap
public static HashMap<String,FWSimVariable<?>> filterVarMap(HashMap<String, FWSimVariable<?>> aMap, String aRegexp) - Parameter:
aMap-aRegexp-- Gibt zurück:
- returns a
HashMapthat contains only the entries whose keys matched the regexp
-
addResourceFiles
public static File addResourceFiles(String aWorkDir, String aSimulationExperimentPath, String aSolutionFileName, String aProjectFileName) throws MissingSimResourceException - Parameter:
aWorkDir-aSimulationExperimentPath-aSolutionFileName-aProjectFileName-- Gibt zurück:
- the ZipFile with all resources of the simulation experiment.
- Löst aus:
MissingSimResourceException
-
logInitialInfo
public static void logInitialInfo(boolean aForce) Log system information at beginning of the application start- Parameter:
aForce-
-
prepareDatabase
public static PreparedStatement prepareDatabase(String aTableName, HashMap<String, FWSimVariable<?>> aHeaderVariables, String aConnectionPoolDefault, boolean aDropIfExists, boolean aDoCreateTable) throws SQLException- Parameter:
aTableName-aHeaderVariables-aConnectionPoolDefault-aDropIfExists-aDoCreateTable-- Gibt zurück:
- the preparedStatement
- Löst aus:
SQLException
-
prepareLimitedSelect
public static PreparedStatement prepareLimitedSelect(String aTableName, HashMap<String, FWSimVariable<?>> aFieldMap, String aConnectionPoolDefault) throws SQLException- Parameter:
aTableName-aFieldMap-aConnectionPoolDefault-aSimulationsList-- Gibt zurück:
- the prepared select Statement
- Löst aus:
SQLException
-
prepareCountSelect
public static PreparedStatement prepareCountSelect(String aTableName, String aConnectionPoolDefault) throws SQLException - Parameter:
aTableName-aConnectionPoolDefault-- Gibt zurück:
- Löst aus:
SQLException
-
generateSimulationID
-
splitProjectDataBySimulationCount
public static LinkedHashMap<String,String> splitProjectDataBySimulationCount(File aProjectDataFile, String aDivider, int aSplitCount) - Parameter:
aProjectDataFile-aDivider-aSplitCount-- Gibt zurück:
- a list divided by aSplitNumber
-
splitProjectDataBySimulationCount
-
splitProjectDataByNumberOfCores
public static List<String> splitProjectDataByNumberOfCores(File aProjectDataFile, String aDivider, int[] aListOfCores) - Parameter:
aProjectDataFile-aDivider-aListOfCores-- Gibt zurück:
- a list divided by aListOfCores
-
checkForAction
public static Boolean checkForAction(LocalDateTime aCurrentDate, FWSimIOAdapter.FREQUENCE aFrequence, JexlRuleScript aJexlScript, FWSimVarMap aVarMap)
-