Class fUMLHelper


  • @OpenApiAll
    public class fUMLHelper
    extends java.lang.Object
    The class contains helper methods for create, access, and modify the fUML object.
    Since:
    SIM 1.0
    • Constructor Summary

      Constructors 
      Constructor Description
      fUMLHelper()  
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static void addFeatureValues​(fUML.Semantics.Loci.LociL1.Locus locus, fUML.Semantics.Classes.Kernel.Value valueOwner, StructuralFeature feature, fUML.Semantics.Classes.Kernel.ValueList inputValues, int insertAt, boolean replaceAll)
      Add the specified ValueList to the FeatureValue(matched with the specified StructuralFeature).
      static boolean addObjectToValueList​(fUML.Semantics.Classes.Kernel.ValueList vList, java.lang.Object object, java.lang.Object owner)
      Create the new Value from the object, and add to the last position of the specified ValueList.
      static java.lang.String buildStringFor​(java.lang.Object object)
      Builds String representation for the given object.
      static java.lang.String buildStringFor​(java.lang.Object object, com.nomagic.magicdraw.simulation.utils.ValueRepresentationParams params)
      Builds String representation for the given object.
      static java.lang.String buildStringFor​(java.util.Collection<?> collection, com.nomagic.magicdraw.simulation.utils.ValueRepresentationParams params, java.util.Map<java.lang.Integer,​java.awt.Color> colors)
      Builds String representation for the given collection.
      static java.lang.Object callBehavior​(fUML.Semantics.Classes.Kernel.StructuredValue object, Behavior behavior, java.util.List<?> arguments, SimulationSession session, java.lang.Boolean synchronous)
      Create the Execution based on the specified Behavior, and execute.
      static java.lang.Object callOperation​(fUML.Semantics.Classes.Kernel.StructuredValue object, Operation operation, java.util.List<?> arguments, SimulationSession session, java.lang.Boolean synchronous)
      Call the specified Operation.
      static java.lang.Object callOperation​(fUML.Semantics.Classes.Kernel.StructuredValue object, Operation operation, java.util.List<?> arguments, SimulationSession session, java.lang.Boolean synchronous, fUML.Semantics.Classes.Kernel.StructuredValue caller)
      Call the specified Operation.
      static fUML.Semantics.Classes.Kernel.ValueList copyValueFrom​(fUML.Semantics.Classes.Kernel.ValueList valueList)
      Creates new ValueList, copy each value in the specified valueList to the new list.
      static fUML.Semantics.Classes.Kernel.Object_ createObject​(Class classifier, fUML.Semantics.Classes.Kernel.Object_ context)
      Create the runtime object from the specified classifier.
      static fUML.Semantics.Classes.Kernel.Value createValue​(java.lang.Object o, java.lang.Object owner, fUML.Semantics.Loci.LociL1.Locus locus)
      Create the fUML value object with the specified object.
      static fUML.Semantics.Classes.Kernel.ValueList createValueList​(java.lang.Object value, java.lang.Object owner)
      A convenience method for creating the instance of ValueList with assigned values, and return it.
      static fUML.Semantics.Classes.Kernel.ValueList createValueList​(java.lang.Object value, java.lang.Object owner, Type tp)
      A convenience method for creating the instance of ValueList with assigned values, and return it.
      static java.util.List<fUML.Semantics.Classes.Kernel.Object_> getConnectedObjectsViaPort​(fUML.Semantics.Classes.Kernel.Value value, Port port, SimulationSession session)
      Collect all connected objects via the specified port from the specified value.
      static StructuralFeature getFeatureByName​(fUML.Semantics.Classes.Kernel.StructuredValue object, java.lang.String featureName)
      Returns the StructuralFeature of the specified CompoundValue with the specified structural feature name.
      static fUML.Semantics.Classes.Kernel.FeatureValue getFeatureValue​(fUML.Semantics.Classes.Kernel.StructuredValue object, StructuralFeature feature)
      Returns the FeatureValue from the specified StructuredValue and StructuralFeature.
      static fUML.Semantics.Classes.Kernel.FeatureValue getFeatureValue​(fUML.Semantics.Classes.Kernel.StructuredValue object, StructuralFeature feature, fUML.Semantics.Loci.LociL1.Locus locus)
      Returns the FeatureValue from the specified StructuredValue and StructuralFeature.
      static fUML.Semantics.Classes.Kernel.FeatureValue getFeatureValueByName​(fUML.Semantics.Classes.Kernel.StructuredValue object, java.lang.String name)
      Returns the FeatureValue from the specified StructuredValue with the specified name.
      static fUML.Semantics.Classes.Kernel.FeatureValue getFeatureValueByName​(fUML.Semantics.Classes.Kernel.StructuredValue object, java.lang.String name, fUML.Semantics.Loci.LociL1.Locus locus)
      Returns the FeatureValue from the specified StructuredValue with the specified name and Locus.
      static java.lang.Object getFirstObjectFromValueList​(fUML.Semantics.Classes.Kernel.ValueList valueList)
      Returns the first object in the given valueList if existed.
      static java.lang.Object getFirstObjectFromValueList​(fUML.Semantics.Classes.Kernel.ValueList valueList, boolean returnReference)
      Returns the first object in the given valueList if existed.
      static void getNormativeValue​(java.lang.Object object, java.util.Collection<java.lang.String> normative)
      Gets the normative value.
      static java.util.Collection<java.lang.String> getNormativeValues​(java.util.Collection<?> values)
      Get fUML normative values.
      static java.lang.Object getObjectFromFeatureValue​(fUML.Semantics.Classes.Kernel.FeatureValue featureValue)
      Return the value or value list from the feature value.
      static java.lang.Object getObjectFromParameterValue​(fUML.Semantics.CommonBehaviors.BasicBehaviors.ParameterValue parameterValue)
      Return the value or value list from the parameter value.
      static java.lang.Object getObjectFromToken​(fUML.Semantics.Activities.IntermediateActivities.Token token)
      The the Object value from the specified Token.
      static java.lang.Object getObjectFromTokenList​(java.util.List<fUML.Semantics.Activities.IntermediateActivities.Token> tokenList)
      Return the value or value list from the TokenList.
      static java.lang.Object getObjectFromValue​(fUML.Semantics.Classes.Kernel.Value value)
      Return the value of the specified fUML value object.
      static java.lang.Object getObjectFromValueList​(fUML.Semantics.Classes.Kernel.ValueList valueList, int upperMultiplicity)
      Return the value or value list from the fUML value list.
      static java.lang.Object getObjectFromValueList​(fUML.Semantics.Classes.Kernel.ValueList valueList, int upperMultiplicity, TypedElement convertToTypeOf)
      Return the value or value list from the fUML value list.
      static java.lang.Object getObjectFromValueList​(fUML.Semantics.Classes.Kernel.ValueList valueList, Type type, int upperMultiplicity)
      Deprecated.
      kept for backwards compatibility.
      static Parameter getParameterByName​(fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution object, java.lang.String name)
      Returns the instance of Parameter from the specified Execution and parameter's name.
      static fUML.Semantics.CommonBehaviors.BasicBehaviors.ParameterValue getParameterValueByName​(fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution object, java.lang.String name)
      Returns the parameter value of the Execution.
      static java.util.List<Signal> getSignalsFromExecution​(fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution execution)
      Collect the list of signals from the execution.
      static java.util.List<Signal> getSignalsFromObject​(fUML.Semantics.Classes.Kernel.Object_ object)
      Return the list of signal with the specified object.
      static java.util.List<fUML.Semantics.Classes.Kernel.FeatureValue> getValue​(fUML.Semantics.Classes.Kernel.StructuredValue object, StructuralFeature strucuturalFeature)
      Returns the list FeatureValue from the specified StructuredValue with the specified structural feature.
      static java.util.List<fUML.Semantics.Classes.Kernel.FeatureValue> getValue​(fUML.Semantics.Classes.Kernel.StructuredValue object, java.lang.String featureName)
      Returns the list FeatureValue from the specified StructuredValue with the specified feature name.
      static void removeFeatureValue​(fUML.Semantics.Loci.LociL1.Locus locus, fUML.Semantics.Classes.Kernel.Value valueOwner, StructuralFeature feature, fUML.Semantics.Classes.Kernel.Value value, int removeAt, boolean isRemoveDuplicates)
      Removes the specified value from the FeatureValue that is matched with the specified feature.
      static boolean saveValueToInstance​(fUML.Semantics.Classes.Kernel.StructuredValue object, InstanceSpecification instance)
      Save the runtime values of the given object to the slots of the given InstanceSpecification.
      static void sendSignal​(Signal signal, fUML.Semantics.Classes.Kernel.Object_ target)
      Create SignalInstance instance of the specified Signal , and send it to the target Object_.
      static void sendSignal​(fUML.Semantics.CommonBehaviors.Communications.SignalInstance signal, fUML.Semantics.Classes.Kernel.Object_ target)
      Send the specified SignalInstance to the specified target Object_.
      static void sendSignal​(fUML.Semantics.CommonBehaviors.Communications.SignalInstance signal, fUML.Semantics.Classes.Kernel.Object_ target, java.lang.String targetPortName)
      Send the specified SignalInstance to the specified target and targetPortName.
      static void sendSignal​(fUML.Semantics.CommonBehaviors.Communications.SignalInstance signal, java.lang.String targetName)
      Send the specified SignalInstance to the specified targetName.
      static void sendSignal​(java.lang.String signalName, fUML.Semantics.Classes.Kernel.Object_ target)
      Create SignalInstance instance of the specified Signal name, and send it to the target Object_.
      static void sendSignal​(java.lang.String signalName, fUML.Semantics.Classes.Kernel.Object_ target, java.lang.String targetPortName)
      Create SignalInstance instance of the specified Signal name, and send it to the specified target and targetPortName.
      static void sendSignal​(java.lang.String signalName, java.lang.String targetName)
      Create SignalInstance instance of the specified Signal name, and send it to the specified targetName.
      static void setFeatureValue​(fUML.Semantics.Classes.Kernel.StructuredValue object, StructuralFeature feature, java.lang.Object value)
      Find the FeatureValue, and set its value with the value.
      static void setFeatureValue​(fUML.Semantics.Classes.Kernel.StructuredValue object, StructuralFeature feature, java.lang.Object value, fUML.Semantics.Loci.LociL1.Locus locus)
      Find the FeatureValue, and set its value with the value.
      static void setFeatureValue​(fUML.Semantics.Classes.Kernel.StructuredValue object, java.lang.String featureName, java.lang.Object value)
      Find the StructuralFeature from the specified object with the specified structural feature name, and delegates to setFeatureValue(StructuredValue, StructuralFeature, Object).
      static void setParameterValue​(fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution execution, Parameter parameter, java.lang.Object value)
      Find the ParameterValue.
      static void setParameterValue​(fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution execution, java.lang.String name, java.lang.Object value)
      Find the Parameter by name from the specified Execution, and delegate to setParameterValue(Execution, Parameter, Object).
      static void setParameterValue​(fUML.Semantics.CommonBehaviors.BasicBehaviors.ParameterValue parameterValue, java.lang.Object object, boolean isReplaceAll)
      Set the value to the specified ParameterValue.
      static boolean setValue​(fUML.Semantics.Classes.Kernel.Value value, java.lang.Object o)
      Set the specified value to the fUML value object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • fUMLHelper

        public fUMLHelper()
    • Method Detail

      • getFeatureValueByName

        public static fUML.Semantics.Classes.Kernel.FeatureValue getFeatureValueByName​(@CheckForNull
                                                                                       fUML.Semantics.Classes.Kernel.StructuredValue object,
                                                                                       java.lang.String name)
        Returns the FeatureValue from the specified StructuredValue with the specified name. Find the StructuralFeature by getFeatureByName(fUML.Semantics.Classes.Kernel.StructuredValue, java.lang.String)
        Parameters:
        object - the specified StructuredValue
        name - feature value name
        Returns:
        The matched FeatureValue from the specified CompoundValue or null if not found
      • getFeatureValueByName

        public static fUML.Semantics.Classes.Kernel.FeatureValue getFeatureValueByName​(fUML.Semantics.Classes.Kernel.StructuredValue object,
                                                                                       java.lang.String name,
                                                                                       fUML.Semantics.Loci.LociL1.Locus locus)
        Returns the FeatureValue from the specified StructuredValue with the specified name and Locus. Find the StructuralFeature by getFeatureByName(fUML.Semantics.Classes.Kernel.StructuredValue, java.lang.String)
        Parameters:
        object - the specified StructuredValue
        name - feature value name
        locus - the specified Locus
        Returns:
        The matched FeatureValue from the specified CompoundValue or null if not found
      • getFeatureValue

        public static fUML.Semantics.Classes.Kernel.FeatureValue getFeatureValue​(fUML.Semantics.Classes.Kernel.StructuredValue object,
                                                                                 StructuralFeature feature,
                                                                                 fUML.Semantics.Loci.LociL1.Locus locus)
        Returns the FeatureValue from the specified StructuredValue and StructuralFeature. If StructuredValue.getFeatureValue(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.StructuralFeature) cannot find the FeatureValue, continue to find it from Link The Locus is necessary to find FeatureValue from Link
        Parameters:
        object - the specified StructuredValue
        feature - the specified StructuralFeature
        locus - the specified Locus
        Returns:
        FeatureValue
        Throws:
        java.lang.NullPointerException - if object is null
      • getFeatureValue

        public static fUML.Semantics.Classes.Kernel.FeatureValue getFeatureValue​(fUML.Semantics.Classes.Kernel.StructuredValue object,
                                                                                 StructuralFeature feature)
        Returns the FeatureValue from the specified StructuredValue and StructuralFeature. If StructuredValue.getFeatureValue(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.StructuralFeature) cannot find the FeatureValue, continue to find it from Link The Locus that being retrieved from fUMLEngine is necessary to find FeatureValue from Link This method try to get Locus from fUMLEngine of the active session.
        Parameters:
        object - the specified StructuredValue
        feature - the specified StructuralFeature
        Returns:
        FeatureValue
        Throws:
        java.lang.NullPointerException - if object is null
      • getParameterValueByName

        @CheckForNull
        public static fUML.Semantics.CommonBehaviors.BasicBehaviors.ParameterValue getParameterValueByName​(fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution object,
                                                                                                           java.lang.String name)
        Returns the parameter value of the Execution.
        Parameters:
        object - the specified Execution
        name - the parameter value name
        Returns:
        the parameter value of the object
      • getParameterByName

        public static Parameter getParameterByName​(fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution object,
                                                   java.lang.String name)
        Returns the instance of Parameter from the specified Execution and parameter's name.
        Parameters:
        object - the specified Execution
        name - the parameter name
        Returns:
        the instance of matched Parameter
      • createValue

        @CheckForNull
        public static fUML.Semantics.Classes.Kernel.Value createValue​(java.lang.Object o,
                                                                      java.lang.Object owner,
                                                                      @CheckForNull
                                                                      fUML.Semantics.Loci.LociL1.Locus locus)
        Create the fUML value object with the specified object.
        Parameters:
        o - the specified object
        owner - the specified owner
        locus - locus
        Returns:
        the fUML value object
      • createValueList

        public static fUML.Semantics.Classes.Kernel.ValueList createValueList​(@CheckForNull
                                                                              java.lang.Object value,
                                                                              @CheckForNull
                                                                              java.lang.Object owner)
        A convenience method for creating the instance of ValueList with assigned values, and return it. If value is instance of ValueList, just return value
        Parameters:
        value - the specified value, It can be collections, arrays, or even the single value.
        owner - of the created value
        Returns:
        ValueList with assigned values.
      • createValueList

        public static fUML.Semantics.Classes.Kernel.ValueList createValueList​(java.lang.Object value,
                                                                              java.lang.Object owner,
                                                                              Type tp)
        A convenience method for creating the instance of ValueList with assigned values, and return it. If value is instance of ValueList, just return value
        Parameters:
        value - the specified value, It can be collections, arrays, or even the single value.
        owner - of the created value
        tp - Type of value
        Returns:
        ValueList with assigned values.
      • getObjectFromValueList

        @CheckForNull
        public static java.lang.Object getObjectFromValueList​(fUML.Semantics.Classes.Kernel.ValueList valueList,
                                                              int upperMultiplicity)
        Return the value or value list from the fUML value list.
        Parameters:
        valueList - the specified fUML value list
        upperMultiplicity - upper multiplicity
        Returns:
        the value if the size of the value list is 1, otherwise returns the value list
      • getObjectFromValueList

        @Deprecated
        @CheckForNull
        public static java.lang.Object getObjectFromValueList​(fUML.Semantics.Classes.Kernel.ValueList valueList,
                                                              @CheckForNull
                                                              Type type,
                                                              int upperMultiplicity)
        Deprecated.
        kept for backwards compatibility. Type argument is not used. Use getObjectFromValueList(ValueList, int, TypedElement) instead, if primitive type conversion is needed. Use getObjectFromValueList(ValueList, int) to retrieve actual values from fUML model.
      • getObjectFromValueList

        @CheckForNull
        public static java.lang.Object getObjectFromValueList​(fUML.Semantics.Classes.Kernel.ValueList valueList,
                                                              int upperMultiplicity,
                                                              @CheckForNull
                                                              TypedElement convertToTypeOf)
        Return the value or value list from the fUML value list.
        Parameters:
        valueList - the specified fUML value list
        convertToTypeOf - in case of the PrimitiveValue, converts the value to the type of this TypedElement. Providing null will return actual value from the list.
        upperMultiplicity - upper multiplicity
        Returns:
        the value if the size of the value list is 1, otherwise returns the value list
      • getObjectFromFeatureValue

        @CheckForNull
        public static java.lang.Object getObjectFromFeatureValue​(fUML.Semantics.Classes.Kernel.FeatureValue featureValue)
        Return the value or value list from the feature value.
        Parameters:
        featureValue - the specified feature value
        Returns:
        the value if the size of the value list of the feature value is 1, otherwise returns the value list
      • getObjectFromParameterValue

        @CheckForNull
        public static java.lang.Object getObjectFromParameterValue​(fUML.Semantics.CommonBehaviors.BasicBehaviors.ParameterValue parameterValue)
        Return the value or value list from the parameter value.
        Parameters:
        parameterValue - the specified parameter value
        Returns:
        the value if the size of the value list of the parameter value is 1, otherwise returns the value list
      • getObjectFromValue

        @CheckForNull
        public static java.lang.Object getObjectFromValue​(@CheckForNull
                                                          fUML.Semantics.Classes.Kernel.Value value)
        Return the value of the specified fUML value object.
        Parameters:
        value - the fUML object value
        Returns:
        the value of the specified fUML value object
      • getFirstObjectFromValueList

        @CheckForNull
        public static java.lang.Object getFirstObjectFromValueList​(fUML.Semantics.Classes.Kernel.ValueList valueList)
        Returns the first object in the given valueList if existed.
        Parameters:
        valueList - ValueList
        Returns:
        the first object in the given valueList if existed
      • getFirstObjectFromValueList

        @CheckForNull
        public static java.lang.Object getFirstObjectFromValueList​(fUML.Semantics.Classes.Kernel.ValueList valueList,
                                                                   boolean returnReference)
        Returns the first object in the given valueList if existed.
        Parameters:
        valueList - ValueList
        returnReference - if this flag is true, if the value is Object_, it will return Reference of that Object_ instead
        Returns:
        the first object in the given valueList if existed
      • getSignalsFromObject

        public static java.util.List<Signal> getSignalsFromObject​(fUML.Semantics.Classes.Kernel.Object_ object)
        Return the list of signal with the specified object.
        Parameters:
        object - the specified object
        Returns:
        the list of signal
      • getSignalsFromExecution

        public static java.util.List<Signal> getSignalsFromExecution​(fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution execution)
        Collect the list of signals from the execution. It will find a behavior from the execution and collect signals from that behavior.
        Parameters:
        execution - the specified execution
        Returns:
        the list of signals
      • getFeatureByName

        @CheckForNull
        public static StructuralFeature getFeatureByName​(@CheckForNull
                                                         fUML.Semantics.Classes.Kernel.StructuredValue object,
                                                         java.lang.String featureName)
        Returns the StructuralFeature of the specified CompoundValue with the specified structural feature name.
        Parameters:
        object - the specified CompoundValue(or subclasses) to be used
        featureName - the structural feature name
        Returns:
        the StructuralFeature of the specified CompoundValue
      • setFeatureValue

        public static void setFeatureValue​(fUML.Semantics.Classes.Kernel.StructuredValue object,
                                           StructuralFeature feature,
                                           java.lang.Object value,
                                           fUML.Semantics.Loci.LociL1.Locus locus)
        Find the FeatureValue, and set its value with the value. If value is instance of ValueList, set value to the found FeatureValue, otherwise create the new ValueList and its value and set to the found FeatureValue.
        Parameters:
        object - the specified object
        feature - the structural feature
        value - the specified value
        locus - execution locus
      • setValue

        public static boolean setValue​(fUML.Semantics.Classes.Kernel.Value value,
                                       @CheckForNull
                                       java.lang.Object o)
        Set the specified value to the fUML value object.
        Parameters:
        value - the fUML value object
        o - the specified value
        Returns:
        true if value was actually set, false if value was not compatible
      • copyValueFrom

        public static fUML.Semantics.Classes.Kernel.ValueList copyValueFrom​(fUML.Semantics.Classes.Kernel.ValueList valueList)
        Creates new ValueList, copy each value in the specified valueList to the new list.
        Parameters:
        valueList - the ValueList to be copied value.
        Returns:
        the new ValueList which contains the same value as the valueList.
      • callBehavior

        public static java.lang.Object callBehavior​(fUML.Semantics.Classes.Kernel.StructuredValue object,
                                                    Behavior behavior,
                                                    java.util.List<?> arguments,
                                                    SimulationSession session,
                                                    java.lang.Boolean synchronous)
        Create the Execution based on the specified Behavior, and execute. The arguments are passed to create the parameter value of the created Execution.
        Parameters:
        object - a context
        behavior - an instance of subclasses of Behavior
        arguments - argument lists
        session - the specified session
        synchronous - true if call synchronously.
        Returns:
        the return value of this execution
      • callOperation

        public static java.lang.Object callOperation​(fUML.Semantics.Classes.Kernel.StructuredValue object,
                                                     Operation operation,
                                                     java.util.List<?> arguments,
                                                     SimulationSession session,
                                                     java.lang.Boolean synchronous)
        Call the specified Operation.
        Parameters:
        object - the specified object
        operation - the specified Operation
        arguments - argument lists
        session - the running session
        synchronous - is synchronous or not
        Returns:
        the return value of this execution
      • callOperation

        public static java.lang.Object callOperation​(fUML.Semantics.Classes.Kernel.StructuredValue object,
                                                     Operation operation,
                                                     java.util.List<?> arguments,
                                                     SimulationSession session,
                                                     java.lang.Boolean synchronous,
                                                     fUML.Semantics.Classes.Kernel.StructuredValue caller)
        Call the specified Operation.
        Parameters:
        object - the specified object
        operation - the specified Operation
        arguments - argument lists
        session - the running session
        synchronous - is synchronous or not
        caller - the specified calling Object_
        Returns:
        the return value of this execution
      • createObject

        @CheckForNull
        public static fUML.Semantics.Classes.Kernel.Object_ createObject​(Class classifier,
                                                                         fUML.Semantics.Classes.Kernel.Object_ context)
        Create the runtime object from the specified classifier.
        Parameters:
        classifier - the specified classifier
        context - the creating object
        Returns:
        the created runtime object
      • setParameterValue

        public static void setParameterValue​(fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution execution,
                                             Parameter parameter,
                                             java.lang.Object value)
        Find the ParameterValue. The new ValueList is created from value and set to the found Parameter.
        Parameters:
        execution - the specified execution
        parameter - the specified parameter
        value - the value to be set to ParameterValue
      • setParameterValue

        public static void setParameterValue​(fUML.Semantics.CommonBehaviors.BasicBehaviors.ParameterValue parameterValue,
                                             java.lang.Object object,
                                             boolean isReplaceAll)
        Set the value to the specified ParameterValue. Now it supports only isReplaceAll == true.
        Parameters:
        parameterValue - the specified ParameterValue.
        object - the specified value
        isReplaceAll - if true, replace all existing value
      • getObjectFromTokenList

        public static java.lang.Object getObjectFromTokenList​(java.util.List<fUML.Semantics.Activities.IntermediateActivities.Token> tokenList)
        Return the value or value list from the TokenList.
        Parameters:
        tokenList - the specified fUML token list
        Returns:
        the value if the size of the value list is 1, otherwise returns the value list
      • getObjectFromToken

        public static java.lang.Object getObjectFromToken​(fUML.Semantics.Activities.IntermediateActivities.Token token)
        The the Object value from the specified Token.
        Parameters:
        token - the specified Token
        Returns:
        the Object value
      • addObjectToValueList

        public static boolean addObjectToValueList​(fUML.Semantics.Classes.Kernel.ValueList vList,
                                                   java.lang.Object object,
                                                   java.lang.Object owner)
        Create the new Value from the object, and add to the last position of the specified ValueList.
        Parameters:
        vList - the specified ValueList
        object - the object being used to create Value
        owner - the specified owner
        Returns:
        true (as specified by Collection.add(E))
      • addFeatureValues

        public static void addFeatureValues​(fUML.Semantics.Loci.LociL1.Locus locus,
                                            fUML.Semantics.Classes.Kernel.Value valueOwner,
                                            StructuralFeature feature,
                                            fUML.Semantics.Classes.Kernel.ValueList inputValues,
                                            int insertAt,
                                            boolean replaceAll)
        Add the specified ValueList to the FeatureValue(matched with the specified StructuralFeature). This method supports insertAt, and replaceAll.
        Parameters:
        locus - the specified locus
        valueOwner - Value
        feature - StructuralFeature
        inputValues - ValueList
        insertAt - the added position
        replaceAll - if true, remove all existing values.
      • getNormativeValues

        public static java.util.Collection<java.lang.String> getNormativeValues​(java.util.Collection<?> values)
        Get fUML normative values.
        Parameters:
        values - the specified values
        Returns:
        the collection of String representing the specified values
      • buildStringFor

        public static java.lang.String buildStringFor​(java.lang.Object object)
        Builds String representation for the given object.
        Parameters:
        object - Object
        Returns:
        String representation of the given object
      • buildStringFor

        public static java.lang.String buildStringFor​(java.lang.Object object,
                                                      com.nomagic.magicdraw.simulation.utils.ValueRepresentationParams params)
        Builds String representation for the given object.
        Parameters:
        object - Object
        params - representation parameters
        Returns:
        String representation of the given object
      • buildStringFor

        public static java.lang.String buildStringFor​(java.util.Collection<?> collection,
                                                      com.nomagic.magicdraw.simulation.utils.ValueRepresentationParams params,
                                                      @CheckForNull
                                                      java.util.Map<java.lang.Integer,​java.awt.Color> colors)
        Builds String representation for the given collection.
        Parameters:
        collection - Collection
        params - representation parameters
        Returns:
        String representation of the given collection
      • getConnectedObjectsViaPort

        public static java.util.List<fUML.Semantics.Classes.Kernel.Object_> getConnectedObjectsViaPort​(fUML.Semantics.Classes.Kernel.Value value,
                                                                                                       Port port,
                                                                                                       SimulationSession session)
        Collect all connected objects via the specified port from the specified value.
        Parameters:
        value - the specified value
        port - the specified port
        session - the specified session
        Returns:
        all connected objects
      • getNormativeValue

        public static void getNormativeValue​(java.lang.Object object,
                                             java.util.Collection<java.lang.String> normative)
        Gets the normative value.
        Parameters:
        object - the object
        normative - the normative
      • removeFeatureValue

        public static void removeFeatureValue​(fUML.Semantics.Loci.LociL1.Locus locus,
                                              fUML.Semantics.Classes.Kernel.Value valueOwner,
                                              StructuralFeature feature,
                                              @CheckForNull
                                              fUML.Semantics.Classes.Kernel.Value value,
                                              int removeAt,
                                              boolean isRemoveDuplicates)
        Removes the specified value from the FeatureValue that is matched with the specified feature.
        Parameters:
        locus - Locus
        valueOwner - Value
        feature - StructuralFeature
        value - Value
        removeAt - int
        isRemoveDuplicates - boolean
      • getValue

        public static java.util.List<fUML.Semantics.Classes.Kernel.FeatureValue> getValue​(fUML.Semantics.Classes.Kernel.StructuredValue object,
                                                                                          java.lang.String featureName)
        Returns the list FeatureValue from the specified StructuredValue with the specified feature name. FeatureValue from multiple Link can be collected.
        Parameters:
        object - the specified StructuredValue
        featureName - feature name
        Returns:
        The list of matched FeatureValue from the specified StructuredValue or null if not found
      • getValue

        public static java.util.List<fUML.Semantics.Classes.Kernel.FeatureValue> getValue​(fUML.Semantics.Classes.Kernel.StructuredValue object,
                                                                                          StructuralFeature strucuturalFeature)
        Returns the list FeatureValue from the specified StructuredValue with the specified structural feature. FeatureValue from multiple Link can be collected.
        Parameters:
        object - the specified StructuredValue
        strucuturalFeature - strucuturalFeature
        Returns:
        The list of matched FeatureValue from the specified StructuredValue or null if not found
      • saveValueToInstance

        public static boolean saveValueToInstance​(fUML.Semantics.Classes.Kernel.StructuredValue object,
                                                  InstanceSpecification instance)
        Save the runtime values of the given object to the slots of the given InstanceSpecification.
        Parameters:
        object - is the given runtime object, whose values will be saved to the InstanceSpecification.
        instance - is the given InstanceSpecification for storing the runtime values to its slots.
        Returns:
        true if the runtime values are saved to the given InstanceSpecification successfully. Otherwise, false is returned.
      • sendSignal

        public static void sendSignal​(java.lang.String signalName,
                                      fUML.Semantics.Classes.Kernel.Object_ target)
        Create SignalInstance instance of the specified Signal name, and send it to the target Object_.

        If signalName contains "::", it will find the signal from the qualified name, the signal is found if its qualified name is ended with signalName.

        Parameters:
        signalName - the specified Signal name
        target - the specified target Object_
      • sendSignal

        public static void sendSignal​(Signal signal,
                                      fUML.Semantics.Classes.Kernel.Object_ target)
        Create SignalInstance instance of the specified Signal , and send it to the target Object_.

        Parameters:
        signal - the specified Signal element
        target - the specified target Object_
      • sendSignal

        public static void sendSignal​(java.lang.String signalName,
                                      java.lang.String targetName)
        Create SignalInstance instance of the specified Signal name, and send it to the specified targetName.

        If signalName contains "::", it will find the signal from the qualified name, the signal is found if its qualified name is ended with signalName.

        If targetName is defined, there are two possible cases.

        • It will find target objects from all waiting objects that have their parts name matched with targetName
        • It will find target objects via connected port, which port name is matched with the specified targetName
        Parameters:
        signalName - the specified Signal name
        targetName - the specified target object name
      • sendSignal

        public static void sendSignal​(java.lang.String signalName,
                                      fUML.Semantics.Classes.Kernel.Object_ target,
                                      java.lang.String targetPortName)
        Create SignalInstance instance of the specified Signal name, and send it to the specified target and targetPortName.

        If signalName contains "::", it will find the signal from the qualified name, the signal is found if its qualified name is ended with signalName.

        Parameters:
        signalName - the specified Signal name
        target - the specified target
        targetPortName - the specified target port name
      • sendSignal

        public static void sendSignal​(fUML.Semantics.CommonBehaviors.Communications.SignalInstance signal,
                                      fUML.Semantics.Classes.Kernel.Object_ target)
        Send the specified SignalInstance to the specified target Object_.
        Parameters:
        signal - the specified SignalInstance
        target - the specified target Object_
      • sendSignal

        public static void sendSignal​(fUML.Semantics.CommonBehaviors.Communications.SignalInstance signal,
                                      java.lang.String targetName)
        Send the specified SignalInstance to the specified targetName. If targetName is defined, there are two possible cases.
        • It will find target objects from all waiting objects that have their parts name matched with targetName
        • It will find target objects via connected port, which port name is matched with the specified targetName
        Parameters:
        signal - the specified SignalInstance
        targetName - the specified target object name
      • sendSignal

        public static void sendSignal​(fUML.Semantics.CommonBehaviors.Communications.SignalInstance signal,
                                      fUML.Semantics.Classes.Kernel.Object_ target,
                                      java.lang.String targetPortName)
        Send the specified SignalInstance to the specified target and targetPortName.
        Parameters:
        signal - the specified SignalInstance
        target - the specified target
        targetPortName - the specified target port name