Klasse FWSimVarMap

java.lang.Object
net.simplace.sim.util.FWSimVarMap
Alle implementierten Schnittstellen:
org.apache.commons.jexl3.JexlContext

public class FWSimVarMap extends Object implements org.apache.commons.jexl3.JexlContext
Each parameter has a "string" name Value is given as implemented member of Variable Variable has last changed date instance, creator reference and value Has a general simulation (model run) and project (project run) id Implements a HashMap Ungültige Eingabe: "<"String, Object> Has replacement method for parameter tokens Linking Variables can hereby be checked for: Unit, DataType and ContentType Setting Value can be checked for DataType, Source of Data, Min/Max Debugging can be done using Description, Unit, Date last changed (same day yesterday, ), Source of value
Autor:
Andreas Enders
  • Felddetails

    • CURRENT_DATE

      public static final String CURRENT_DATE
      signifying the string used as id for the current date in the VarMap
      Siehe auch:
    • CURRENT_YEAR

      public static final String CURRENT_YEAR
      signifying the string used as id for the current year in the VarMap
      Siehe auch:
    • CURRENT_DAY

      public static final String CURRENT_DAY
      signifying the string used as id for the current day of month
      Siehe auch:
    • CURRENT_MONTH

      public static final String CURRENT_MONTH
      signifying the string used as id for the current month in the VarMap
      Siehe auch:
    • CURRENT_DOY

      public static final String CURRENT_DOY
      signifying the string used as id for the current day of year
      Siehe auch:
    • PROJECT_ID

      public static final String PROJECT_ID
      signifying the string used as id for the current date in the VarMap
      Siehe auch:
    • PROJECT_ITERATION

      public static final String PROJECT_ITERATION
      signifying the string used as id for the current date in the VarMap
      Siehe auch:
    • SIMULATION_ID

      public static final String SIMULATION_ID
      signifying the string used as id for the current date in the VarMap
      Siehe auch:
    • SIMULATION_NAME

      public static final String SIMULATION_NAME
      signifying the string used as id for the current date in the VarMap
      Siehe auch:
    • SIMULATION_NUMBER

      public static final String SIMULATION_NUMBER
      signifying the string used as id for the current date in the VarMap
      Siehe auch:
    • SESSION_ID

      public static final String SESSION_ID
      signifying the string used as id for the current date in the VarMap
      Siehe auch:
    • SPINUP_DAYS

      public static final String SPINUP_DAYS
      signifying the integer number of spin up days in the VarMap
      Siehe auch:
    • SPINUP_DO_RESET

      public static final String SPINUP_DO_RESET
      signifying whether date has to be reset after spinup
      Siehe auch:
    • SPINUP_RESET

      public static final String SPINUP_RESET
      signifying whether date was reset after spinup
      Siehe auch:
    • SYNCHRONIZE_FREQUENCE

      public static final String SYNCHRONIZE_FREQUENCE
      signifying whether threads are synchronized within one project (true) or not (false)
      Siehe auch:
    • SYNCHRONIZE_RULE

      public static final String SYNCHRONIZE_RULE
      the rule for the data synchronized within one project if FREQUENCE is COMPLEX
      Siehe auch:
    • PROJECT_LINES

      public static final String PROJECT_LINES
      projectlines that are read from project file
      Siehe auch:
    • SIMULATIONS_SELECTED

      public static final String SIMULATIONS_SELECTED
      signifying whether date has to be reset after spinup
      Siehe auch:
    • END_DATE

      public static final String END_DATE
      signifying the string used as id for the end date in the VarMap
      Siehe auch:
    • START_DATE

      public static final String START_DATE
      signifying the string used as id for the end date in the VarMap
      Siehe auch:
    • DATE_FORMAT

      public static final DateTimeFormatter DATE_FORMAT
      Parser for operations to be calculated
  • Konstruktordetails

    • FWSimVarMap

      public FWSimVarMap(HashMap<String,FWSimVariable<?>> aFormInputParameterMap, FWSimModel aModel, String aProjectID, FWSimSession aCurrentSession)
      Parameter:
      aFormInputParameterMap -
      aModel -
      aProjectID -
      aCurrentSession -
    • FWSimVarMap

      public FWSimVarMap(HashMap<String,FWSimVariable<?>> aParameterMap)
      Parameter:
      aParameterMap -
    • FWSimVarMap

      public FWSimVarMap()
      For documentation reasons
  • Methodendetails

    • setWaiting

      public void setWaiting(boolean shouldWait) throws InterruptedException
      Löst aus:
      InterruptedException
    • getVarMap

      public HashMap<String,FWSimVariable<?>> getVarMap()
      Gibt zurück:
      the parameterMap
    • getStringValue

      public String getStringValue(String aKey)
      Parameter:
      aKey -
      Gibt zurück:
      one parameter value for given key - null if key was not set
    • forceIntegerValue

      public Integer forceIntegerValue(String aKey)
      Parameter:
      aKey -
      Gibt zurück:
      one parameter converted to Integer value for given key - null if key was not set or value not convertible
    • forceDoubleValue

      public Double forceDoubleValue(String aKey)
      Parameter:
      aKey -
      Gibt zurück:
      one parameter converted to Double value for given key - null if key was not set or value not convertible
    • forceBooleanValue

      public boolean forceBooleanValue(String aParamKey)
      used if generic type of the SimVariable is different but convertable to boolean. otherwise use getValue()!
      Parameter:
      aParamKey -
      Gibt zurück:
      boolean value to be forced from other data type
    • forceDateValue

      public LocalDateTime forceDateValue(String aParamKey)
      used if generic type of the SimVariable is different but convertable to date. otherwise use getValue()!
      Parameter:
      aParamKey -
      Gibt zurück:
      the date that was retrieved from convert.
    • forceDoubleArrayValue

      public Double[] forceDoubleArrayValue(String aString)
      used if generic type of the SimVariable is different but convertible to double array. otherwise use getValue()!
      Parameter:
      aString -
      Gibt zurück:
      the converted value
    • forceDoubleMapValue

      public TreeMap<Double,Double> forceDoubleMapValue(String aKey)
      used if generic type of the SimVariable is different but convertible to Double Map from array. otherwise use getValue()!
      Parameter:
      aKey -
      Gibt zurück:
      the converted value
    • forceIntegerArrayValue

      public Integer[] forceIntegerArrayValue(String aString)
      used if generic type of the SimVariable is different but convertible to integer array. otherwise use getValue()!
      Parameter:
      aString -
      Gibt zurück:
      the converted value
    • replaceParamTokens

      public String replaceParamTokens(String aString, Object aDefault)
      Replacement of parameters in a string is performed.
      Parameter:
      aString -
      aDefault -
      Gibt zurück:
      the new String after replacement of the different variable tags
      Siehe auch:
    • getValue

      public Object getValue(String aKey)
      Parameter:
      aKey -
      Gibt zurück:
      object value of the FWSimVariable registered with key
    • getValue

      public Object getValue(String aKey, Object aDefault)
      Parameter:
      aKey -
      aDefault -
      Gibt zurück:
      object value of the FWSimVariable registered with key
    • setValue

      public void setValue(String aKey, Object aValue, FWSimVariable.DATA_TYPE aDataType, FWSimVariable.CONTENT_TYPE aContentType, FWSimFieldContainer aSourceComponent) throws SimValueOutOfRangeException
      sets the value to the FWSimVariable. If Max or Min rule is not successfully evaluated SimValueOutOfRangeException is thrown. It is typeof RuntimeException and need not to be handled If FWSimVariable is not existing it will be created with a warn Message in log.
      Parameter:
      aKey -
      aValue -
      aDataType -
      aContentType -
      aSourceComponent -
      Löst aus:
      SimValueOutOfRangeException
    • initValue

      public void initValue(String aKey, FWSimVariable<?> aFWSimVariable)
      new SimVariable is initialized and put to simVarMap
      Parameter:
      aKey -
      aFWSimVariable -
    • addVariable

      public void addVariable(String aKey, FWSimVariable<?> aFWSimVariable, boolean isLink)
      new SimVariable is initialized and put to simVarMap
      Parameter:
      aKey -
      aFWSimVariable -
      isLink -
    • getProjectID

      public String getProjectID()
      Gibt zurück:
      Identifier of this Functionality
    • getSimulationID

      public String getSimulationID()
      Returns the number of observers of this Observable object.
      Gibt zurück:
      the number of observers of this object.
    • generateSimulationID

      public String generateSimulationID()
      Returns the number of observers of this Observable object.
      Gibt zurück:
      the number of observers of this object.
    • setSimulationName

      public void setSimulationName(String aSimulationName)
      Parameter:
      aSimulationName -
    • getSimulationName

      public String getSimulationName()
      Gibt zurück:
      simulation name
    • getSimulationNumber

      public Integer getSimulationNumber()
      Gibt zurück:
      the simulation number
    • getIteration

      public Integer getIteration()
      Gibt zurück:
      the iteration number
    • getCurrentSession

      public FWSimSession getCurrentSession()
      Gibt zurück:
      the current session
    • isSynchronized

      public boolean isSynchronized()
      Gibt zurück:
      if session is synchronized
    • getSynchronizedFrequence

      public FWSimIOAdapter.FREQUENCE getSynchronizedFrequence()
      Gibt zurück:
      if session is synchronized
    • getSynchronizeRule

      public String getSynchronizeRule()
      Gibt zurück:
    • isWaiting

      public boolean isWaiting()
      Gibt zurück:
    • getCurrentDateString

      public String getCurrentDateString()
      calculates statistics
      Gibt zurück:
      Current model date toFormated string
    • getStartDate

      public LocalDateTime getStartDate()
      Gibt zurück:
      Start Date Variable
    • getEndDate

      public LocalDateTime getEndDate()
      Gibt zurück:
      End Date Variable
    • calculateStatistics

      public void calculateStatistics()
      calculates statistics
    • setProjectID

      public void setProjectID(String aProjectID)
      Parameter:
      aProjectID -
    • setSessionID

      public void setSessionID(String aSessionID)
      Parameter:
      aSessionID -
    • setSimulationNumber

      public void setSimulationNumber(Integer aSimulationNumber)
      Parameter:
      aSimulationNumber -
    • setCurrentSession

      public void setCurrentSession(FWSimSession aFwSimSession)
      Parameter:
      aFwSimSession -
    • removeVariable

      public void removeVariable(String aElement)
      use with care! Variable might be needed
      Parameter:
      aElement -
    • filterData

      public Object[] filterData(HashMap<String,FWSimVariable<?>> aFilterMap)
      filters data from the map and returns it as Object[]
      Parameter:
      aFilterMap -
      Gibt zurück:
    • filterData

      public Object[] filterData(Set<String> aKeySet)
      filters data from the map and returns it as Object[]
      Parameter:
      aKeySet -
      Gibt zurück:
    • putAllVariables

      public void putAllVariables(Map<String,FWSimVariable<?>> aVarMap)
      number of variables are added to the VarMap
      Parameter:
      aVarMap -
    • isVariableAvailable

      public boolean isVariableAvailable(String aKey)
      Parameter:
      aKey -
      Gibt zurück:
      s if a SimVariable is available
    • isSpinupPeriode

      public boolean isSpinupPeriode()
      Gibt zurück:
      s if system is in spin up period
    • doSpinupReset

      public boolean doSpinupReset()
      Gibt zurück:
    • toString

      public String toString()
      simple output of VarMap
      Setzt außer Kraft:
      toString in Klasse Object
      Siehe auch:
    • toArray

      public String[][] toArray()
      Gibt zurück:
      Key, SimVarName and Value as Array
    • addLink

      public void addLink(String aKey, FWSimVariable<?> aVar, boolean performChecks) throws SimLinkInvalidException
      Link between 2 SimVariables is added. If Link cannot be established a SimLinkInvalidException is thrown
      Parameter:
      aKey - of the target part of the link
      aVar - with the source part of the link
      performChecks -
      Löst aus:
      SimLinkInvalidException
    • removeLink

      public void removeLink(String aName, FWSimVariable<?> aFwSimVariable)
      Parameter:
      aName -
      aFwSimVariable -
    • initializeCurrentDate

      public void initializeCurrentDate(LocalDateTime aDate)
      Initializes the Current Date of the VarMap
      Parameter:
      aDate -
    • updateCurrentDate

      public void updateCurrentDate()
      used to set the current model date to the VarMap
    • getCurrentDate

      public LocalDateTime getCurrentDate()
      Gibt zurück:
      the current model date
    • setCurrentDate

      public void setCurrentDate(LocalDateTime aCurrentDate)
      Parameter:
      aCurrentDate - the current model date
    • getCurrentDOY

      public int getCurrentDOY()
      Gibt zurück:
      current DayOfYear
    • getCurrentYear

      public int getCurrentYear()
      Gibt zurück:
      current Year
    • getCurrentDayOfMonth

      public int getCurrentDayOfMonth()
      Gibt zurück:
      current Day of Month
    • getCurrentMonth

      public int getCurrentMonth()
      Gibt zurück:
      current Month
    • hasSimulationEnded

      public Boolean hasSimulationEnded()
      Gibt zurück:
      the simulationEnd
    • setSimulationEnd

      public void setSimulationEnd()
      sets the simulation end
    • clone

      public FWSimVarMap clone(FWSimSession aSession)
      deep clone on the SimVarMap - no references will stay same!
      Parameter:
      aSession -
      Gibt zurück:
      Siehe auch:
    • cloneToControlMap

      public FWSimVarMap cloneToControlMap()
      deep clone on the SimVarMap - no references will stay same!
      Gibt zurück:
      Siehe auch:
    • getSimLinks

      public HashMap<String,String> getSimLinks()
      Gibt zurück:
      a MultiHashMap containing all Links
    • reset

      public void reset()
      set all variables to default values
    • hasSimVariable

      public boolean hasSimVariable(String aRule)
      Parameter:
      aRule -
      Gibt zurück:
      if the registered FWSimVariable is available for the given key!
    • getSimVariable

      public FWSimVariable<?> getSimVariable(String aKey) throws SimFieldMissingException
      Parameter:
      aKey -
      Gibt zurück:
      the registered FWSimVariable - need not be the one with the given key!
      Löst aus:
      SimFieldMissingException
    • getValueToDatabaseString

      public String getValueToDatabaseString(String aSourceKey) throws SimFieldMissingException
      mainly used for Date, DoubleArray and IntArray to get String format of the values
      Parameter:
      aSourceKey -
      Gibt zurück:
      the value as converted database string
      Löst aus:
      SimFieldMissingException
    • getVariables

      public Set<FWSimVariable<?>> getVariables(FWSimVariable.CONTENT_TYPE aContentType)
      Parameter:
      aContentType -
      Gibt zurück:
      a list of Variables having this content type
    • getVariables

      Parameter:
      aContainer -
      aContentType -
      Gibt zurück:
      a list of Variables having this source container
    • has

      public boolean has(String aName)
      Decorates the class as MapContext
      Angegeben von:
      has in Schnittstelle org.apache.commons.jexl3.JexlContext
      Siehe auch:
      • Ungültige Referenz
        org.apache.commons.jexl2.MapContext#has(java.lang.String)
    • get

      public Object get(String aName)
      Decorates the class as MapContext
      Angegeben von:
      get in Schnittstelle org.apache.commons.jexl3.JexlContext
      Siehe auch:
      • Ungültige Referenz
        org.apache.commons.jexl2.MapContext#get(java.lang.String)
    • set

      public void set(String aName, Object aValue)
      Decorates the class as MapContext
      Angegeben von:
      set in Schnittstelle org.apache.commons.jexl3.JexlContext
      Siehe auch:
      • Ungültige Referenz
        org.apache.commons.jexl2.MapContext#set(java.lang.String, java.lang.Object)
    • isInternal

      public static boolean isInternal(String aVarName)
    • checkInternal

      public boolean checkInternal(FWSimVariable<?> aFwSimVariable)