Klasse FWSimVariable<T>

java.lang.Object
net.simplace.sim.util.FWSimVariable<T>
Typparameter:
T -
Bekannte direkte Unterklassen:
FWSimCalibrationVariable

public class FWSimVariable<T> extends Object
Autor:
Andreas Enders
  • Konstruktordetails

  • Methodendetails

    • createSimVariable

      public static FWSimVariable<?> createSimVariable(org.jdom2.Element aVarElement, FWSimFieldContainer aFWSimFieldContainer)
      factory method to create a FWSimVariable (Typed)
      Parameter:
      aVarElement -
      aFWSimFieldContainer -
      Gibt zurück:
      the new created Variable
    • createSimVariable

      public static FWSimVariable<?> createSimVariable(String aName, String aDesc, FWSimVariable.DATA_TYPE aDataType, FWSimVariable.CONTENT_TYPE aContentType, String aUnit, Number aMin, Number aMax, Object aDefault, FWSimFieldContainer aSourceSimComponent)
      factory method to create a component sim variable for FWSimVariable.CONTENT_TYPE out use method above
      Parameter:
      aName -
      aDesc -
      aDataType -
      aContentType -
      aUnit -
      aMin -
      aMax -
      aDefault -
      aSourceSimComponent -
      Gibt zurück:
      the new created Variable
    • createOutputSimVariable

      public static FWSimVariable<?> createOutputSimVariable(String aName, String aDesc, String aRule, FWSimVariable.DATA_TYPE aDataType, String aUnit, String aOutputFormat, Object aDefault, FWSimVariable.MODE_TYPE aModeType, FWSimFieldContainer aTarget)
      factory method to create an output (system-output - not component output) sim variable for FWSimVariable.CONTENT_TYPE out use method above.
      Parameter:
      aName -
      aDesc -
      aRule -
      aDataType -
      aUnit -
      aOutputFormat -
      aDefault -
      aModeType -
      aTarget -
      Gibt zurück:
      the new created Variable
    • createSimVariable

      public static FWSimVariable<?> createSimVariable(String aName, String aDesc, String aRule, FWSimVariable.DATA_TYPE aDataType, FWSimVariable.CONTENT_TYPE aContentType, String aUnit, Object aValue, Number aMin, Number aMax, Object aDefault, Integer[] aCount, FWSimVariable.MODE_TYPE aModeType, FWSimVarMap aVarMap, FWSimFieldContainer aSourceSimComponent)
      standard constructor for FWSimVariable - called from clone, too.
      Parameter:
      aName - Variable name
      aDesc - Description
      aRule -
      aDataType - Data type
      aContentType - Input, output, etc
      aUnit - Units
      aValue - (internal use, not for initializing)
      aMin - Minimum
      aMax - Maximum
      aDefault - Default, use when initializing constants or inputs
      aCount -
      aModeType -
      aVarMap - (internal use, not for initializing)
      aSourceSimComponent - SimModel declaring the variable
      Gibt zurück:
    • fillMetaDataFromSource

      public void fillMetaDataFromSource(FWSimVarMap aVarMap)
      Parameter:
      aVarMap -
    • isNumber

      public boolean isNumber()
      Gibt zurück:
      if Variable is a Number (int or double)
    • hasRule

      public boolean hasRule()
      Gibt zurück:
      true if has a rule implemented
    • isDouble

      public boolean isDouble()
      Gibt zurück:
      true if variable is double or array of double
    • isInt

      public boolean isInt()
      Gibt zurück:
      true if variable contains int or array of int
    • isBoolean

      public boolean isBoolean()
      Gibt zurück:
      true if variable is boolean
    • isString

      public boolean isString()
      Gibt zurück:
      true if variable is char type
    • isDate

      public boolean isDate()
      Gibt zurück:
      true if variable is of date type
    • isArray

      public boolean isArray()
      Gibt zurück:
      true if variable is an array (int or double)
    • isOutputContent

      public boolean isOutputContent()
      Gibt zurück:
      false if this is of type Input field: input or constant, else true
    • isInputContent

      public boolean isInputContent()
      Gibt zurück:
      true if this is of type Input field: input or constant, else false
    • isMeasData

      public boolean isMeasData()
      Gibt zurück:
      the isMeasData
    • getDescription

      public String getDescription()
      Gibt zurück:
      description of this variable
    • getOrder

      public String getOrder()
      Gibt zurück:
      order of this variable
    • getDataType

      public FWSimVariable.DATA_TYPE getDataType()
      Gibt zurück:
      the dataType
    • getContentType

      public FWSimVariable.CONTENT_TYPE getContentType()
      Gibt zurück:
      the contentType
    • getCategory

      public FWSimVariable.VARIABLE_CATEGORY getCategory()
    • getModeType

      public FWSimVariable.MODE_TYPE getModeType()
      Gibt zurück:
      the modeType
    • getMax

      public Number getMax()
      Gibt zurück:
      the max
    • getMin

      public Number getMin()
      Gibt zurück:
      the min
    • getValue

      public T getValue()
      Use this method to get value out of the variable by default!
      Gibt zurück:
      the value
    • getArrayValue

      public Number getArrayValue(int aIndex)
      Use this method to get value out of the variable by default!
      Parameter:
      aIndex -
      Gibt zurück:
      the value
    • getMatrixValue

      public Double getMatrixValue(int aXIndex, int aYIndex)
      Use this method to get value out of the variable by default!
      Parameter:
      aXIndex -
      aYIndex -
      Gibt zurück:
      the value
    • forceDoubleMapValue

      public TreeMap<Double,Double> forceDoubleMapValue() throws SimFieldTypeException
      Gibt zurück:
      a Tree Map with fixed order derived from a double array
      Löst aus:
      SimFieldTypeException - if value was NO double array
    • forceBooleanValue

      public boolean forceBooleanValue(boolean aDefault)
      forces a value to be returned as boolean !!! don't use this method for variables type Boolean !!!
      Parameter:
      aDefault - - taken if conversion is not successful
      Gibt zurück:
      the boolean parameter - or the default
    • forceDoubleValue

      public double forceDoubleValue()
      forces a value to be returned as double !!! don't use this method for variables type double !!!
      Gibt zurück:
      the double parameter
    • forceIntValue

      public int forceIntValue()
      forces a value to be returned as integer !!! don't use this method for variables type integer !!!
      Gibt zurück:
      the integer parameter
    • forceStringValue

      public String forceStringValue()
      forces a value to be returned as string !!! don't use this method for variables type string !!!
      Gibt zurück:
      the string parameter
    • setDefaultValue

      public void setDefaultValue()
      replaces the value with the default - even if default is null value
    • reset

      public void reset()
      replaces the value with the default - even if default is null value
    • setVarMap

      public void setVarMap(FWSimVarMap aFwSimvarMap)
      Parameter:
      aFwSimvarMap -
    • setModeType

      public void setModeType(FWSimVariable.MODE_TYPE aModeType)
      Parameter:
      aModeType -
    • setRule

      public void setRule(String aRule)
      Parameter:
      aRule -
    • setName

      public void setName(String aNewName)
      Parameter:
      aNewName - only used for generator purpose
    • changeDefaultValue

      public void changeDefaultValue(T aValue)
      changes default value
      Parameter:
      aValue -
    • setNull

      public void setNull(FWSimFieldContainer aSource)
      sets value to null: - checks for authentication - sets the current date when the value had changed last time - but only if SimModel was registered
      Parameter:
      aSource - Component who wants to set this value - for checking purpose
      Löst aus:
      SimLinkInvalidException
    • setValue

      public void setValue(T aValue, FWSimFieldContainer aSource)
      standard set Value method: - checks for min and max limits - sets the current date when the value had changed last time - but only if SimModel was registered
      Parameter:
      aValue - the value to set
      aSource - Component who wants to set this value - for checking purpose
      Löst aus:
      SimValueOutOfRangeException - if new value exceeds the limits of Min and Max value
      SimLinkInvalidException
    • setValue

      public void setValue(FWSimVariable<T> aVariable, FWSimFieldContainer aSource) throws SimValueOutOfRangeException, SimLinkInvalidException
      standard set Value method: - checks for min and max limits - sets the current date when the value had changed last time - but only if SimModel was registered
      Parameter:
      aVariable - the value to set
      aSource - Component who wants to set this value - for checking purpose
      Löst aus:
      SimValueOutOfRangeException - if new value exceeds the limits of Min and Max value
      SimLinkInvalidException
    • addValue

      public void addValue(T aValue, FWSimFieldContainer aSource) throws SimValueOutOfRangeException
      standard set Value method: - checks for min and max limits - sets the current date when the value had changed last time - but only if SimModel was registered
      Parameter:
      aValue - the value to set
      aSource - Component who wants to set this value - for checking purpose
      Löst aus:
      SimValueOutOfRangeException - if new value exceeds the limits of Min and Max value
    • addValue

      public void addValue(FWSimVariable<T> aVariable, FWSimFieldContainer aSource) throws SimValueOutOfRangeException
      standard set Value method: - checks for min and max limits - sets the current date when the value had changed last time - but only if SimModel was registered
      Parameter:
      aVariable - the value to set
      aSource - Component who wants to set this value - for checking purpose
      Löst aus:
      SimValueOutOfRangeException - if new value exceeds the limits of Min and Max value
    • multiplyValue

      public void multiplyValue(Number aValue, FWSimFieldContainer aSource) throws SimValueOutOfRangeException
      standard set Value method: - checks for min and max limits - sets the current date when the value had changed last time - but only if SimModel was registered
      Parameter:
      aValue - the value to set
      aSource - Component who wants to set this value - for checking purpose
      Löst aus:
      SimValueOutOfRangeException - if new value exceeds the limits of Min and Max value
    • setArrayValue

      public void setArrayValue(int aIndex, Number aValue, FWSimFieldContainer aSource) throws SimValueOutOfRangeException, SimFieldTypeException
      special method for setting values to an array type variable
      Parameter:
      aIndex - of the array value should be set to
      aValue - the value to set
      aSource - Component who wants to set this value - for checking purpose
      Löst aus:
      SimValueOutOfRangeException - if new value exceeds the limits of Min and Max value
      SimFieldTypeException - if variable is NO array
    • setArrayValue

      public void setArrayValue(int aIndex, String aValue, FWSimFieldContainer aSource) throws SimValueOutOfRangeException, SimFieldTypeException
      special method for setting values to an array type variable
      Parameter:
      aIndex - of the array value should be set to
      aValue - the value to set
      aSource - Component who wants to set this value - for checking purpose
      Löst aus:
      SimValueOutOfRangeException - if new value exceeds the limits of Min and Max value
      SimFieldTypeException - if variable is NO array
    • getName

      public String getName()
      Gibt zurück:
      the name
    • getInternalName

      public String getInternalName()
      Gibt zurück:
      The Name of the Variable without the component Name
    • getUnit

      public String getUnit()
      Gibt zurück:
      the unit
    • getFormat

      public String getFormat()
      Gibt zurück:
      the format
    • getFormatter

      public Object getFormatter()
      Gibt zurück:
      the format
    • getStringUnit

      public String getStringUnit()
      Gibt zurück:
      the unit
    • getDefault

      public T getDefault()
      Gibt zurück:
      the default
    • getRule

      public String getRule()
      Gibt zurück:
      the rule implemented in the variable
    • calculateValue

      public Object calculateValue(FWSimVarMap aVarMap)
      Parameter:
      aVarMap -
      Gibt zurück:
      the result of the rule implemented in the variable will be set to the value field.
    • evaluate

      public Object evaluate(FWSimVarMap aVarMap)
      Parameter:
      aVarMap -
      Gibt zurück:
      the result of the rule implemented in the variable
    • evaluate

      public Object evaluate()
      Gibt zurück:
      the result of the rule implemented in the variable
    • toString

      public String toString()
      Setzt außer Kraft:
      toString in Klasse Object
      Siehe auch:
    • getStringValue

      public String getStringValue()
      Gibt zurück:
      a fromatted string value
      Siehe auch:
    • toShortString

      public String toShortString()
      Gibt zurück:
      the name as short string
    • toDebugString

      public String toDebugString()
      Gibt zurück:
      long debugging string value with all content of the variable
    • toXML

      public org.jdom2.Element toXML()
      Gibt zurück:
      the Element of the variable with all needed values
    • toCalVarXML

      public org.jdom2.Element toCalVarXML(String aMinVal, String aMaxVal, Integer aCount)
      Gibt zurück:
      the Element of the variable with all needed values 1000 2000 21
    • toCalVarXML

      public org.jdom2.Element toCalVarXML(String aCommaSeperatedList)
      Gibt zurück:
      the Element of the variable with all needed values 1000 2000 21
    • toOutVarXML

      public org.jdom2.Element toOutVarXML(String aMode)
      Gibt zurück:
      the Element of the variable with all needed values
    • getFieldName

      public String getFieldName()
      Gibt zurück:
      the short name without container information
    • getCount

      public Integer[] getCount()
      Gibt zurück:
      the count of items in the array
    • setCount

      public Integer[] setCount(int aCount)
      Parameter:
      aCount - count of the params
      Gibt zurück:
      the count of items in the array
    • setCount

      public void setCount(Integer[] aArray)
      Parameter:
      aArray - of the counts
    • setFormat

      public void setFormat(String aFormat)
      Parameter:
      aFormat -
    • setValueAndDefault

      public static <F> F setValueAndDefault(Object aObject, FWSimVariable<F> aSimVariable, FWSimFieldContainer aSourceComponent) throws SimValueOutOfRangeException, SimLinkInvalidException
      static factory implementation for setting unknown object type to a given FWSimVariable with type F
      Typparameter:
      F -
      Parameter:
      aObject - value
      aSimVariable - to which the value is to be set
      aSourceComponent - Component who wants to set this value - for checking purpose
      Gibt zurück:
      the Value set with correct type
      Löst aus:
      SimValueOutOfRangeException
      SimLinkInvalidException
    • setValue

      public static <F> F setValue(Object aObject, FWSimVariable<F> aSimVariable, FWSimFieldContainer aSourceComponent) throws SimValueOutOfRangeException, SimLinkInvalidException
      static factory implementation for setting unknown object type to a given FWSimVariable with type F
      Typparameter:
      F -
      Parameter:
      aObject - value
      aSimVariable - to which the value is to be set
      aSourceComponent - Component who wants to set this value - for checking purpose
      Gibt zurück:
      the Value set with correct type
      Löst aus:
      SimValueOutOfRangeException
      SimLinkInvalidException
    • transformDataType

      public static Object transformDataType(String aObject, FWSimVariable.DATA_TYPE aDataType) throws NumberFormatException
      static implementation of a data converter if possible use static setValue()-Method instead
      Parameter:
      aObject -
      aDataType -
      Gibt zurück:
      the transformed data object
      Löst aus:
      NumberFormatException
    • transformDataType

      public static Object transformDataType(String aObject, FWSimVariable<?> aSimVariable) throws NumberFormatException
      static implementation of a data converter if possible use static setValue()-Method instead
      Parameter:
      aObject -
      aSimVariable -
      Gibt zurück:
      the transformed data object
      Löst aus:
      NumberFormatException
    • transformDataTypeToDB

      public static String transformDataTypeToDB(FWSimVariable.DATA_TYPE aDataType)
      transforms from Database type to FWSimVariable.DATA_TYPE
      Parameter:
      aDataType - used in database
      Gibt zurück:
      the FWSimVariable.DATA_TYPE
    • transformDBDataType

      public static FWSimVariable.DATA_TYPE transformDBDataType(String dataType)
      transforms from Database type to FWSimVariable.DATA_TYPE
      Parameter:
      dataType - used in database
      Gibt zurück:
      the FWSimVariable.DATA_TYPE
    • transformJavaDataType

      public static String transformJavaDataType(FWSimVariable.DATA_TYPE aDataType)
      Parameter:
      aDataType -
      Gibt zurück:
      the Java Type Name
    • transformJavaDataType

      public static FWSimVariable.DATA_TYPE transformJavaDataType(String dataType)
      transforms from written code style type to FWSimVariable.DATA_TYPE
      Parameter:
      dataType - used in java code
      Gibt zurück:
      the FWSimVariable.DATA_TYPE
    • transformContentType

      public static String transformContentType(FWSimVariable.CONTENT_TYPE aContentType)
      Parameter:
      aContentType -
      Gibt zurück:
      good toString information
    • getPrefix

      public String getPrefix()
      Gibt zurück:
      the matching prefix
    • addPrefix

      public String addPrefix(String aFieldName)
      Parameter:
      aFieldName -
      Gibt zurück:
      the field name with matching prefix
    • check

      public String check(FWSimVariable<?> aOutputVar)
      checking routine for 2 different SimVariables that are to be linked together
      Parameter:
      aOutputVar -
      Gibt zurück:
      an error string - if string is null everything seems to be perfect!
    • getSource

      public FWSimFieldContainer getSource()
      Gibt zurück:
      the component registered as source component
    • getVarMap

      public FWSimVarMap getVarMap()
      Gibt zurück:
      the VarMap connected to this Variable
    • setSource

      public void setSource(FWSimFieldContainer aComponent)
      changing registered source component for this variable ! use this with care! should not be used by default
      Parameter:
      aComponent -
    • addOutputLink

      public void addOutputLink(String aFieldName) throws SimLinkInvalidException
      adding a link to the output-part of the link.
      Parameter:
      aFieldName -
      Löst aus:
      SimLinkInvalidException - if variable is no output field!
    • addInputLink

      public void addInputLink(String aFieldName) throws SimLinkInvalidException
      adding a link to the output-part of the link.
      Parameter:
      aFieldName -
      Löst aus:
      SimLinkInvalidException - if variable is no output field!
    • removeLink

      public void removeLink(String aName)
      Parameter:
      aName -
    • isInputLinked

      public boolean isInputLinked() throws SimLinkInvalidException
      Gibt zurück:
      if is linked to another field as input
      Löst aus:
      SimLinkInvalidException - if field is no input
    • isOutputLinked

      public boolean isOutputLinked()
      Gibt zurück:
      if is linked to another field as output
    • getRuleComplexity

      public JexlRuleScript.COMPLEXITY getRuleComplexity()
      Gibt zurück:
      the complexRule
    • clone

      public FWSimVariable<T> clone(FWSimVarMap aVarMap)
      deep clone of the SimVariable copying all fields to a new variable
      Parameter:
      aVarMap -
      Gibt zurück:
      a new cloned FWSimVariable with identical meta data
      Siehe auch:
    • deepClone

      public FWSimVariable<T> deepClone(FWSimVarMap aVarMap)
      Parameter:
      aVarMap -
      Gibt zurück:
    • setContentType

      public void setContentType(FWSimVariable.CONTENT_TYPE aContentType)
      Parameter:
      aContentType -
    • createFormFields

      public static org.jdom2.Element createFormFields(FWSimVariable<?> aVariable, FWSimVariable.CONTENT_TYPE aComponentContentType, String aDescription, String aFrequence, String aVisible, String aEnabled, boolean aMultipleVarType)
      Parameter:
      aVariable -
      aComponentContentType -
      aDescription -
      aFrequence -
      aVisible -
      aEnabled -
      aMultipleVarType -
      Gibt zurück:
      the FormElement
    • createFormFields

      public static org.jdom2.Element createFormFields(String aName, String aDescription, String aContentTypeDefault, String aVisible, String aEnabled, FWSimVariable.CONTENT_TYPE aComponentContentType)
      Parameter:
      aName -
      aDescription -
      aContentTypeDefault -
      aVisible -
      aEnabled -
      aComponentContentType -
      Gibt zurück:
      the FormElement
    • createMultipleFormElement

      public static org.jdom2.Element createMultipleFormElement(FWSimVariable<?> aVariable, String aName, String aDescription, String aVisible, String aEnabled, String aContentType, String tModeType, boolean aModeNeeded, String aFrequence, String tDataType, String tUnit, String tMax, String tMin, String tRule, String tDesc, String tDefault, FWSimVariable.CONTENT_TYPE aComponentContentType)
      Parameter:
      aVariable -
      aName -
      aDescription -
      aVisible -
      aEnabled -
      aContentType -
      tModeType -
      aModeNeeded -
      aFrequence -
      tDataType -
      tUnit -
      tMax -
      tMin -
      tRule -
      tDesc -
      tDefault -
      aComponentContentType -
      Gibt zurück:
      the Form Element
    • createFormElement

      public static org.jdom2.Element createFormElement(FWSimVariable<?> aVariable, String aName, String aDescription, String aVisible, String aEnabled, String aContentType, String aModeType, boolean aModeNeeded, String tDataType, String tUnit, String tMax, String tMin, String tRule, String tDesc, String tDefault, FWSimVariable.CONTENT_TYPE aComponentContentType)
      Parameter:
      aVariable -
      aName -
      aDescription -
      aVisible -
      aEnabled -
      aContentType -
      aModeType -
      aModeNeeded -
      tDataType -
      tUnit -
      tMax -
      tMin -
      tRule -
      tDesc -
      tDefault -
      aComponentContentType -
      Gibt zurück:
      the Form Element
    • updateFields

      public void updateFields(org.jdom2.Element aVarElement)
      Parameter:
      aVarElement -
    • updateFields

      public static FWSimVariable<?> updateFields(FWSimVariable<?> aVariable, FWObservable aObservable) throws SimLinkInvalidException, SimValueOutOfRangeException
      Parameter:
      aVariable -
      aObservable -
      Gibt zurück:
      a new created sim variable
      Löst aus:
      SimValueOutOfRangeException
      SimLinkInvalidException
    • getFormComponentXML

      public org.jdom2.Element getFormComponentXML()
      Gibt zurück:
      the generated form xml
    • getDateFormatter

      public FWSimVariable.DateFormatter getDateFormatter(String aPattern)
    • equals

      public boolean equals(Object aObj)
      Setzt außer Kraft:
      equals in Klasse Object
    • toHTMLTablestring

      public String toHTMLTablestring()
      Gibt zurück:
      the HTML Table String