net.simplace.simulation.util.FWSimHelper
Helper instance consisting of helper methods with instances of an operation tree parser to evaluate
rules while replacing parameters in variables
public class FWSimHelper {
// Public Constructors
public FWSimHelper();
// Constants
public static final Pattern PARAMPATTERN;
public static final Pattern PARAMSEARCHPATTERN;
public static final Pattern EXPRESSIONPATTERN;
public static final Pattern ARRAYVALUEPATTERN;
public static final Comparator SIM_VAR_COMARATOR;
// Class Variables
public static Comparator FIELD_COMPERATOR;
// Class Methods public static String
replaceParamTokens(
FWSimVarMap aParamMap, String aValue,
Object aDefault);
replaces Parameters in
- aValue
matching the regexp '.*[${].*[}].*' with given parameters in
- aParamMap
- aDefault
returns aNewValue
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.
returns the new value object - if not retrieved the default.
public static Set
getParametersFromString(Pattern pattern, String aString);
returns parameters from a given aString
public static LinkedHashMap
ArrayToLinkedMap(Object[] aArray);
converts a Object[] to a LinkedHashMap
returns the fixed ordered tree map
public static TreeMap
ArrayToMap(Double[] aArray);
converts a double[] to a tree map
returns the fixed ordered tree map
public static List findSimComponents();
returns a List of Strings representing the Classes extended from FWSimComponent
public static Collection
findResources(String aPackage, String aRegexp);
returns a List of Strings representing the Classes extended from FWSimComponent
public static List findResourceTransformers();
returns a List of Strings representing the Classes extended from FWSimResourceTransformer
public static Object[][]
getObjectArrayFromVarMap(
FWSimVarMap aVarMap);
returns the Object Array containing keys and values of the data
public static String
getParameterName(String aKey);
returns the first parameter in the key string
public static Object
unzipArray(
FWSimVariable aTargetVariable, ArrayList
aFieldMapIndizes, Object[] aSourceArray, Set aParametersFromString,
FWSimFieldContainer aContainer);
Implement rules for expressions like
!UNZIP_KEYS(${C[])! = A[]
!UNZIP_VALUES(${C[]})! = B[]
- aTargetVariable
- aFieldMapIndizes
- aSourceArray
- aParametersFromString
- aContainer
returns the unzipped array
public static Object
zipArray(
FWSimVariable aTargetVariable, ArrayList
aFieldMapIndizes, Object[] aSourceArray, Set aParametersFromString,
FWSimFieldContainer aContainer);
Implemented rules for expressions like
!ZIP(${A[]},${B[]})! = C[]
- aTargetVariable
- aFieldMapIndizes
- aSourceArray
- aParametersFromString
- aContainer
returns the zipped Array
public static HashMap
filterVarMap(HashMap aMap, String aRegexp);
returns returns a {@link HashMap} that contains only the entries whose keys matched the regexp
public static File
addResourceFiles(File aSimulationExperimentPath, String
aSolutionFileName, String aProjectFileName);
- aSimulationExperimentPath
- aSolutionFileName
- aProjectFileName
returns the ZipFile with all resources of the simulation experiment.
public static void
logInitialInfo(boolean aForce);
Log system information at beginning of the application start
public static PreparedStatement
prepareDatabase(String aTableName, HashMap
aHeaderVariables, String aConnectionPoolDefault, boolean aDropIfExists,
boolean aDoCreateTable) throws SQLException;
- aTableName
- aHeaderVariables
- aConnectionPoolDefault
- aDropIfExists
- aDoCreateTable
returns the preparedStatement
public static PreparedStatement
prepareLimitedSelect(String aTableName,
HashMap aFieldMap, String aConnectionPoolDefault) throws SQLException;
- aTableName
- aFieldMap
- aSimulationsList
- aConnectionPoolDefault
returns the prepared select Statement
public static String generateSimulationID(Integer aProjectIteration, String
aProjectID, String aSimulationName, Integer aSimulationNumber);
}