Class fUMLHelper
java.lang.Object
com.nomagic.magicdraw.simulation.fuml.fUMLHelper
The class contains helper methods for create, access, and modify the fUML object.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddFeatureValues(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 specifiedValueListto theFeatureValue(matched with the specifiedStructuralFeature).static booleanaddObjectToValueList(fUML.Semantics.Classes.Kernel.ValueList vList, Object object, Object owner) Create the newValuefrom theobject, and add to the last position of the specifiedValueList.static StringbuildStringFor(Object object) Builds String representation for the given object.static StringbuildStringFor(Object object, com.nomagic.magicdraw.simulation.utils.ValueRepresentationParams params) Builds String representation for the given object.static StringbuildStringFor(Collection<?> collection, com.nomagic.magicdraw.simulation.utils.ValueRepresentationParams params, Map<Integer, Color> colors) Builds String representation for the given collection.static ObjectcallBehavior(fUML.Semantics.Classes.Kernel.StructuredValue object, Behavior behavior, List<?> arguments, SimulationSession session, Boolean synchronous) Create theExecutionbased on the specifiedBehavior, and execute.static ObjectcallOperation(fUML.Semantics.Classes.Kernel.StructuredValue object, Operation operation, List<?> arguments, SimulationSession session, Boolean synchronous) Call the specifiedOperation.static ObjectcallOperation(fUML.Semantics.Classes.Kernel.StructuredValue object, Operation operation, List<?> arguments, SimulationSession session, Boolean synchronous, fUML.Semantics.Classes.Kernel.StructuredValue caller) Call the specifiedOperation.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.ValuecreateValue(Object o, Object owner, fUML.Semantics.Loci.LociL1.Locus locus) Create the fUML value object with the specified object.static fUML.Semantics.Classes.Kernel.ValueListcreateValueList(Object value, Object owner) A convenience method for creating the instance ofValueListwith assigned values, and return it.static fUML.Semantics.Classes.Kernel.ValueListcreateValueList(Object value, Object owner, Type type) A convenience method for creating the instance ofValueListwith assigned values, and return it.static List<fUML.Semantics.Classes.Kernel.Object_>getConnectedObjectsViaPort(fUML.Semantics.Classes.Kernel.Value value, Port port, SimulationSession session) Collect all connected objects via the specifiedportfrom the specifiedvalue.static StructuralFeaturegetFeatureByName(fUML.Semantics.Classes.Kernel.StructuredValue object, String featureName) Returns theStructuralFeatureof the specifiedCompoundValuewith the specified structural feature name.static fUML.Semantics.Classes.Kernel.FeatureValuegetFeatureValue(fUML.Semantics.Classes.Kernel.StructuredValue object, StructuralFeature feature) Returns theFeatureValuefrom the specifiedStructuredValueandStructuralFeature.static fUML.Semantics.Classes.Kernel.FeatureValuegetFeatureValue(fUML.Semantics.Classes.Kernel.StructuredValue object, StructuralFeature feature, fUML.Semantics.Loci.LociL1.Locus locus) Returns theFeatureValuefrom the specifiedStructuredValueandStructuralFeature.static fUML.Semantics.Classes.Kernel.FeatureValuegetFeatureValueByName(fUML.Semantics.Classes.Kernel.StructuredValue object, String name) Returns theFeatureValuefrom the specifiedStructuredValuewith the specified name.static fUML.Semantics.Classes.Kernel.FeatureValuegetFeatureValueByName(fUML.Semantics.Classes.Kernel.StructuredValue object, String name, fUML.Semantics.Loci.LociL1.Locus locus) Returns theFeatureValuefrom the specifiedStructuredValuewith the specified name andLocus.static ObjectgetFirstObjectFromValueList(fUML.Semantics.Classes.Kernel.ValueList valueList) Returns the first object in the given valueList if existed.static ObjectgetFirstObjectFromValueList(fUML.Semantics.Classes.Kernel.ValueList valueList, boolean returnReference) Returns the first object in the given valueList if existed.static voidgetNormativeValue(Object object, Collection<String> normative) Gets the normative value.static Collection<String>getNormativeValues(Collection<?> values) Get fUML normative values.static ObjectgetObjectFromFeatureValue(fUML.Semantics.Classes.Kernel.FeatureValue featureValue) Return the value or value list from the feature value.static ObjectgetObjectFromParameterValue(fUML.Semantics.CommonBehaviors.BasicBehaviors.ParameterValue parameterValue) Return the value or value list from the parameter value.static ObjectgetObjectFromToken(fUML.Semantics.Activities.IntermediateActivities.Token token) TheObjectvalue from the specifiedToken.static ObjectgetObjectFromTokenList(List<fUML.Semantics.Activities.IntermediateActivities.Token> tokenList) Return the value or value list from theTokenList.static ObjectgetObjectFromValue(fUML.Semantics.Classes.Kernel.Value value) Return the value of the specified fUML value object.static ObjectgetObjectFromValueList(fUML.Semantics.Classes.Kernel.ValueList valueList, int upperMultiplicity) Return the value or value list from the fUML value list.static ObjectgetObjectFromValueList(fUML.Semantics.Classes.Kernel.ValueList valueList, int upperMultiplicity, TypedElement convertToTypeOf) Return the value or value list from the fUML value list.static ObjectgetObjectFromValueList(fUML.Semantics.Classes.Kernel.ValueList valueList, Type type, int upperMultiplicity) Deprecated.kept for backwards compatibility.static ParametergetParameterByName(fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution object, String name) Returns the instance ofParameterfrom the specifiedExecutionand parameter's name.static fUML.Semantics.CommonBehaviors.BasicBehaviors.ParameterValuegetParameterValueByName(fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution object, String name) Returns the parameter value of theExecution.getSignalsFromExecution(fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution execution) Collect the list of signals from the execution.getSignalsFromObject(fUML.Semantics.Classes.Kernel.Object_ object) Return the list of signal with the specified object.static List<fUML.Semantics.Classes.Kernel.FeatureValue>getValue(fUML.Semantics.Classes.Kernel.StructuredValue object, StructuralFeature structuralFeature) Returns the listFeatureValuefrom the specifiedStructuredValuewith the specified structural feature.static List<fUML.Semantics.Classes.Kernel.FeatureValue>Returns the listFeatureValuefrom the specifiedStructuredValuewith the specified feature name.static voidremoveFeatureValue(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 specifiedvaluefrom theFeatureValuethat is matched with the specifiedfeature.static booleansaveValueToInstance(fUML.Semantics.Classes.Kernel.StructuredValue object, InstanceSpecification instance) Save the runtime values of the given object to the slots of the given InstanceSpecification.static voidsendSignal(Signal signal, fUML.Semantics.Classes.Kernel.Object_ target) Create SignalInstance instance of the specifiedSignal, and send it to the targetObject_.static voidsendSignal(fUML.Semantics.CommonBehaviors.Communications.SignalInstance signal, fUML.Semantics.Classes.Kernel.Object_ target) Send the specifiedSignalInstanceto the specified targetObject_.static voidsendSignal(fUML.Semantics.CommonBehaviors.Communications.SignalInstance signal, fUML.Semantics.Classes.Kernel.Object_ target, String targetPortName) Send the specifiedSignalInstanceto the specifiedtargetandtargetPortName.static voidsendSignal(fUML.Semantics.CommonBehaviors.Communications.SignalInstance signal, String targetName) Send the specifiedSignalInstanceto the specifiedtargetName.static voidsendSignal(String signalName, fUML.Semantics.Classes.Kernel.Object_ target) Create SignalInstance instance of the specifiedSignalname, and send it to the targetObject_.static voidsendSignal(String signalName, fUML.Semantics.Classes.Kernel.Object_ target, String targetPortName) Create SignalInstance instance of the specifiedSignalname, and send it to the specifiedtargetandtargetPortName.static voidsendSignal(String signalName, String targetName) Deprecated.use any other overloaded version which provides target Object_ or/and SignalInstancestatic voidsetFeatureValue(fUML.Semantics.Classes.Kernel.StructuredValue object, StructuralFeature feature, Object value) Find theFeatureValue, and set its value with thevalue.static voidsetFeatureValue(fUML.Semantics.Classes.Kernel.StructuredValue object, StructuralFeature feature, Object value, fUML.Semantics.Loci.LociL1.Locus locus) Find theFeatureValue, and set its value with thevalue.static voidsetFeatureValue(fUML.Semantics.Classes.Kernel.StructuredValue object, String featureName, Object value) Find theStructuralFeaturefrom the specified object with the specified structural feature name, and delegates tosetFeatureValue(StructuredValue, StructuralFeature, Object).static voidsetParameterValue(fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution execution, Parameter parameter, Object value) Find theParameterValue.static voidsetParameterValue(fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution execution, String name, Object value) Find theParameterby name from the specifiedExecution, and delegate tosetParameterValue(Execution, Parameter, Object).static voidsetParameterValue(fUML.Semantics.CommonBehaviors.BasicBehaviors.ParameterValue parameterValue, Object object, boolean isReplaceAll) Set the value to the specifiedParameterValue.static booleanSet the specified value to the fUML value object.
-
Constructor Details
-
fUMLHelper
public fUMLHelper()
-
-
Method Details
-
getFeatureValueByName
@CheckForNull public static fUML.Semantics.Classes.Kernel.FeatureValue getFeatureValueByName(@CheckForNull fUML.Semantics.Classes.Kernel.StructuredValue object, String name) Returns theFeatureValuefrom the specifiedStructuredValuewith the specified name. Find theStructuralFeaturebygetFeatureByName(fUML.Semantics.Classes.Kernel.StructuredValue, java.lang.String)- Parameters:
object- the specifiedStructuredValuename- feature value name- Returns:
- The matched
FeatureValuefrom the specifiedCompoundValueornullif not found
-
getFeatureValueByName
public static fUML.Semantics.Classes.Kernel.FeatureValue getFeatureValueByName(fUML.Semantics.Classes.Kernel.StructuredValue object, String name, fUML.Semantics.Loci.LociL1.Locus locus) Returns theFeatureValuefrom the specifiedStructuredValuewith the specified name andLocus. Find theStructuralFeaturebygetFeatureByName(fUML.Semantics.Classes.Kernel.StructuredValue, java.lang.String)- Parameters:
object- the specifiedStructuredValuename- feature value namelocus- the specifiedLocus- Returns:
- The matched
FeatureValuefrom the specifiedCompoundValueornullif 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 theFeatureValuefrom the specifiedStructuredValueandStructuralFeature. IfStructuredValue.getFeatureValue(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.StructuralFeature)cannot find theFeatureValue, continue to find it fromLinkThe
Locusis necessary to findFeatureValuefromLink- Parameters:
object- the specifiedStructuredValuefeature- the specifiedStructuralFeaturelocus- the specifiedLocus- Returns:
FeatureValue- Throws:
NullPointerException- ifobjectisnull
-
getFeatureValue
@CheckForNull public static fUML.Semantics.Classes.Kernel.FeatureValue getFeatureValue(fUML.Semantics.Classes.Kernel.StructuredValue object, StructuralFeature feature) Returns theFeatureValuefrom the specifiedStructuredValueandStructuralFeature. IfStructuredValue.getFeatureValue(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.StructuralFeature)cannot find theFeatureValue, continue to find it fromLinkThe
Locusthat being retrieved fromfUMLEngineis necessary to findFeatureValuefromLinkThis method try to getLocusfromfUMLEngineof the active session.- Parameters:
object- the specifiedStructuredValuefeature- the specifiedStructuralFeature- Returns:
FeatureValue- Throws:
NullPointerException- ifobjectisnull
-
getParameterValueByName
@CheckForNull public static fUML.Semantics.CommonBehaviors.BasicBehaviors.ParameterValue getParameterValueByName(fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution object, String name) Returns the parameter value of theExecution.- Parameters:
object- the specifiedExecutionname- the parameter value name- Returns:
- the parameter value of the object
-
getParameterByName
@CheckForNull public static Parameter getParameterByName(fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution object, String name) Returns the instance ofParameterfrom the specifiedExecutionand parameter's name.- Parameters:
object- the specifiedExecutionname- the parameter name- Returns:
- the instance of matched
Parameter
-
createValue
@CheckForNull public static fUML.Semantics.Classes.Kernel.Value createValue(Object o, Object owner, @CheckForNull fUML.Semantics.Loci.LociL1.Locus locus) Create the fUML value object with the specified object.- Parameters:
o- the specified objectowner- the specified ownerlocus- locus- Returns:
- the fUML value object
-
createValueList
public static fUML.Semantics.Classes.Kernel.ValueList createValueList(@CheckForNull Object value, @CheckForNull Object owner) A convenience method for creating the instance ofValueListwith assigned values, and return it. Ifvalueis instance ofValueList, just returnvalue- Parameters:
value- the specified value, It can be collections, arrays, or even the single value.owner- of the created value- Returns:
ValueListwith assigned values.
-
createValueList
public static fUML.Semantics.Classes.Kernel.ValueList createValueList(Object value, Object owner, Type type) A convenience method for creating the instance ofValueListwith assigned values, and return it. Ifvalueis instance ofValueList, just returnvalue- Parameters:
value- the specified value, It can be collections, arrays, or even the single value.owner- of the created valuetype- Type of value- Returns:
ValueListwith assigned values.
-
getObjectFromValueList
@CheckForNull public static 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 listupperMultiplicity- upper multiplicity- Returns:
- the value if the size of the value list is 1, otherwise returns the value list
-
getObjectFromValueList
@Deprecated @CheckForNull public static Object getObjectFromValueList(fUML.Semantics.Classes.Kernel.ValueList valueList, @CheckForNull Type type, int upperMultiplicity) Deprecated.kept for backwards compatibility. Type argument is not used. UsegetObjectFromValueList(ValueList, int, TypedElement)instead, if primitive type conversion is needed. UsegetObjectFromValueList(ValueList, int)to retrieve actual values from fUML model. -
getObjectFromValueList
@CheckForNull public static 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 listconvertToTypeOf- 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 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 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 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 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 Object getFirstObjectFromValueList(fUML.Semantics.Classes.Kernel.ValueList valueList, boolean returnReference) Returns the first object in the given valueList if existed.- Parameters:
valueList- ValueListreturnReference- 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
Return the list of signal with the specified object.- Parameters:
object- the specified object- Returns:
- the list of signal
-
getSignalsFromExecution
public static 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, String featureName) Returns theStructuralFeatureof the specifiedCompoundValuewith the specified structural feature name.- Parameters:
object- the specifiedCompoundValue(or subclasses) to be usedfeatureName- the structural feature name- Returns:
- the
StructuralFeatureof the specifiedCompoundValue
-
setFeatureValue
public static void setFeatureValue(fUML.Semantics.Classes.Kernel.StructuredValue object, StructuralFeature feature, Object value) Find theFeatureValue, and set its value with thevalue. Ifvalueis instance ofValueList, setvalueto the foundFeatureValue, otherwise create the newValueListand its value and set to the foundFeatureValue.If want to find
FeatureValuefromAssociation(Link), useaddFeatureValues(Locus locus, Value valueOwner, StructuralFeature feature, ValueList inputValues, int insertAt, boolean replaceAll)- Parameters:
object- the specified objectfeature- the structural featurevalue- the specified value- See Also:
-
setFeatureValue
public static void setFeatureValue(@CheckForNull fUML.Semantics.Classes.Kernel.StructuredValue object, StructuralFeature feature, Object value, fUML.Semantics.Loci.LociL1.Locus locus) Find theFeatureValue, and set its value with thevalue. Ifvalueis instance ofValueList, setvalueto the foundFeatureValue, otherwise create the newValueListand its value and set to the foundFeatureValue.- Parameters:
object- the specified objectfeature- the structural featurevalue- the specified valuelocus- execution locus
-
setFeatureValue
public static void setFeatureValue(fUML.Semantics.Classes.Kernel.StructuredValue object, String featureName, Object value) Find theStructuralFeaturefrom the specified object with the specified structural feature name, and delegates tosetFeatureValue(StructuredValue, StructuralFeature, Object).- Parameters:
object- the specified objectfeatureName- the structural feature namevalue- the specified value- See Also:
-
setValue
Set the specified value to the fUML value object.- Parameters:
value- the fUML value objecto- the specified value- Returns:
- true if value was actually set, false if value was not compatible
-
callBehavior
public static Object callBehavior(fUML.Semantics.Classes.Kernel.StructuredValue object, Behavior behavior, List<?> arguments, SimulationSession session, Boolean synchronous) Create theExecutionbased on the specifiedBehavior, and execute. The arguments are passed to create the parameter value of the createdExecution.- Parameters:
object- a contextbehavior- an instance of subclasses ofBehaviorarguments- argument listssession- the specified sessionsynchronous- true if call synchronously.- Returns:
- the return value of this execution
-
callOperation
public static Object callOperation(fUML.Semantics.Classes.Kernel.StructuredValue object, Operation operation, List<?> arguments, SimulationSession session, Boolean synchronous) Call the specifiedOperation.- Parameters:
object- the specified objectoperation- the specifiedOperationarguments- argument listssession- the running sessionsynchronous- is synchronous or not- Returns:
- the return value of this execution
-
callOperation
public static Object callOperation(fUML.Semantics.Classes.Kernel.StructuredValue object, Operation operation, List<?> arguments, SimulationSession session, Boolean synchronous, fUML.Semantics.Classes.Kernel.StructuredValue caller) Call the specifiedOperation.- Parameters:
object- the specified objectoperation- the specifiedOperationarguments- argument listssession- the running sessionsynchronous- is synchronous or notcaller- the specified callingObject_- 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 classifiercontext- the creating object- Returns:
- the created runtime object
-
setParameterValue
public static void setParameterValue(fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution execution, String name, Object value) Find theParameterby name from the specifiedExecution, and delegate tosetParameterValue(Execution, Parameter, Object).- Parameters:
execution- the specifiedExecutionname- namevalue- value- See Also:
-
setParameterValue
public static void setParameterValue(fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution execution, Parameter parameter, Object value) Find theParameterValue. The newValueListis created fromvalueand set to the foundParameter.- Parameters:
execution- the specified executionparameter- the specified parametervalue- the value to be set toParameterValue
-
setParameterValue
public static void setParameterValue(fUML.Semantics.CommonBehaviors.BasicBehaviors.ParameterValue parameterValue, Object object, boolean isReplaceAll) Set the value to the specifiedParameterValue. Now it supports only isReplaceAll == true.- Parameters:
parameterValue- the specifiedParameterValue.object- the specified valueisReplaceAll- if true, replace all existing value
-
getObjectFromTokenList
@CheckForNull public static Object getObjectFromTokenList(List<fUML.Semantics.Activities.IntermediateActivities.Token> tokenList) Return the value or value list from theTokenList.- 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
@CheckForNull public static Object getObjectFromToken(fUML.Semantics.Activities.IntermediateActivities.Token token) TheObjectvalue from the specifiedToken.- Parameters:
token- the specifiedToken- Returns:
- the
Objectvalue
-
addObjectToValueList
public static boolean addObjectToValueList(fUML.Semantics.Classes.Kernel.ValueList vList, Object object, Object owner) Create the newValuefrom theobject, and add to the last position of the specifiedValueList.- Parameters:
vList- the specifiedValueListobject- the object being used to createValueowner- 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 specifiedValueListto theFeatureValue(matched with the specifiedStructuralFeature). This method supports insertAt, and replaceAll.- Parameters:
locus- the specified locusvalueOwner- Valuefeature- StructuralFeatureinputValues- ValueListinsertAt- the added positionreplaceAll- if true, remove all existing values.
-
getNormativeValues
Get fUML normative values.- Parameters:
values- the specifiedvalues- Returns:
- the collection of String representing the specified
values
-
buildStringFor
Builds String representation for the given object.- Parameters:
object- Object- Returns:
- String representation of the given object
-
buildStringFor
public static String buildStringFor(Object object, com.nomagic.magicdraw.simulation.utils.ValueRepresentationParams params) Builds String representation for the given object.- Parameters:
object- Objectparams- representation parameters- Returns:
- String representation of the given object
-
buildStringFor
public static String buildStringFor(Collection<?> collection, com.nomagic.magicdraw.simulation.utils.ValueRepresentationParams params, @CheckForNull Map<Integer, 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 List<fUML.Semantics.Classes.Kernel.Object_> getConnectedObjectsViaPort(fUML.Semantics.Classes.Kernel.Value value, Port port, SimulationSession session) Collect all connected objects via the specifiedportfrom the specifiedvalue.- Parameters:
value- the specifiedvalueport- the specifiedportsession- the specified session- Returns:
- all connected objects
-
getNormativeValue
Gets the normative value.- Parameters:
object- the objectnormative- 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 specifiedvaluefrom theFeatureValuethat is matched with the specifiedfeature.- Parameters:
locus- LocusvalueOwner- Valuefeature- StructuralFeaturevalue- ValueremoveAt- intisRemoveDuplicates- boolean
-
getValue
public static List<fUML.Semantics.Classes.Kernel.FeatureValue> getValue(fUML.Semantics.Classes.Kernel.StructuredValue object, String featureName) Returns the listFeatureValuefrom the specifiedStructuredValuewith the specified feature name. FeatureValue from multipleLinkcan be collected.- Parameters:
object- the specifiedStructuredValuefeatureName- feature name- Returns:
- The list of matched
FeatureValuefrom the specifiedStructuredValueornullif not found
-
getValue
public static List<fUML.Semantics.Classes.Kernel.FeatureValue> getValue(fUML.Semantics.Classes.Kernel.StructuredValue object, StructuralFeature structuralFeature) Returns the listFeatureValuefrom the specifiedStructuredValuewith the specified structural feature. FeatureValue from multipleLinkcan be collected.- Parameters:
object- the specifiedStructuredValuestructuralFeature- structuralFeature- Returns:
- The list of matched
FeatureValuefrom the specifiedStructuredValueornullif 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
Create SignalInstance instance of the specifiedSignalname, and send it to the targetObject_. IfsignalNamecontains "::", it will find the signal from the qualified name, the signal is found if its qualified name is ended withsignalName.- Parameters:
signalName- the specifiedSignalnametarget- the specified targetObject_
-
sendSignal
Create SignalInstance instance of the specifiedSignal, and send it to the targetObject_.- Parameters:
signal- the specifiedSignalelementtarget- the specified targetObject_
-
sendSignal
Deprecated.use any other overloaded version which provides target Object_ or/and SignalInstanceTo be removed -
sendSignal
public static void sendSignal(String signalName, fUML.Semantics.Classes.Kernel.Object_ target, String targetPortName) Create SignalInstance instance of the specifiedSignalname, and send it to the specifiedtargetandtargetPortName. IfsignalNamecontains "::", it will find the signal from the qualified name, the signal is found if its qualified name is ended withsignalName.- Parameters:
signalName- the specifiedSignalnametarget- the specified targettargetPortName- the specified target port name
-
sendSignal
public static void sendSignal(fUML.Semantics.CommonBehaviors.Communications.SignalInstance signal, fUML.Semantics.Classes.Kernel.Object_ target) Send the specifiedSignalInstanceto the specified targetObject_.- Parameters:
signal- the specifiedSignalInstancetarget- the specified targetObject_
-
sendSignal
public static void sendSignal(fUML.Semantics.CommonBehaviors.Communications.SignalInstance signal, String targetName) Send the specifiedSignalInstanceto the specifiedtargetName.If
targetNameis 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 specifiedSignalInstancetargetName- the specified target object name
- It will find target objects from all waiting objects that have their parts name matched with
-
sendSignal
public static void sendSignal(fUML.Semantics.CommonBehaviors.Communications.SignalInstance signal, fUML.Semantics.Classes.Kernel.Object_ target, String targetPortName) Send the specifiedSignalInstanceto the specifiedtargetandtargetPortName.- Parameters:
signal- the specifiedSignalInstancetarget- the specified targettargetPortName- the specified target port name
-