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
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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 specifiedValueList
to theFeatureValue
(matched with the specifiedStructuralFeature
).static boolean
addObjectToValueList
(fUML.Semantics.Classes.Kernel.ValueList vList, Object object, Object owner) Create the newValue
from theobject
, and add to the last position of the specifiedValueList
.static String
buildStringFor
(Object object) Builds String representation for the given object.static String
buildStringFor
(Object object, com.nomagic.magicdraw.simulation.utils.ValueRepresentationParams params) Builds String representation for the given object.static String
buildStringFor
(Collection<?> collection, com.nomagic.magicdraw.simulation.utils.ValueRepresentationParams params, Map<Integer, Color> colors) Builds String representation for the given collection.static Object
callBehavior
(fUML.Semantics.Classes.Kernel.StructuredValue object, Behavior behavior, List<?> arguments, SimulationSession session, Boolean synchronous) Create theExecution
based on the specifiedBehavior
, and execute.static Object
callOperation
(fUML.Semantics.Classes.Kernel.StructuredValue object, Operation operation, List<?> arguments, SimulationSession session, Boolean synchronous) Call the specifiedOperation
.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
.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
(Object o, Object owner, fUML.Semantics.Loci.LociL1.Locus locus) Create the fUML value object with the specified object.static fUML.Semantics.Classes.Kernel.ValueList
createValueList
(Object value, Object owner) A convenience method for creating the instance ofValueList
with assigned values, and return it.static fUML.Semantics.Classes.Kernel.ValueList
createValueList
(Object value, Object owner, Type type) A convenience method for creating the instance ofValueList
with 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 specifiedport
from the specifiedvalue
.static StructuralFeature
getFeatureByName
(fUML.Semantics.Classes.Kernel.StructuredValue object, String featureName) Returns theStructuralFeature
of the specifiedCompoundValue
with the specified structural feature name.static fUML.Semantics.Classes.Kernel.FeatureValue
getFeatureValue
(fUML.Semantics.Classes.Kernel.StructuredValue object, StructuralFeature feature) Returns theFeatureValue
from the specifiedStructuredValue
andStructuralFeature
.static fUML.Semantics.Classes.Kernel.FeatureValue
getFeatureValue
(fUML.Semantics.Classes.Kernel.StructuredValue object, StructuralFeature feature, fUML.Semantics.Loci.LociL1.Locus locus) Returns theFeatureValue
from the specifiedStructuredValue
andStructuralFeature
.static fUML.Semantics.Classes.Kernel.FeatureValue
getFeatureValueByName
(fUML.Semantics.Classes.Kernel.StructuredValue object, String name) Returns theFeatureValue
from the specifiedStructuredValue
with the specified name.static fUML.Semantics.Classes.Kernel.FeatureValue
getFeatureValueByName
(fUML.Semantics.Classes.Kernel.StructuredValue object, String name, fUML.Semantics.Loci.LociL1.Locus locus) Returns theFeatureValue
from the specifiedStructuredValue
with the specified name andLocus
.static Object
getFirstObjectFromValueList
(fUML.Semantics.Classes.Kernel.ValueList valueList) Returns the first object in the given valueList if existed.static Object
getFirstObjectFromValueList
(fUML.Semantics.Classes.Kernel.ValueList valueList, boolean returnReference) Returns the first object in the given valueList if existed.static void
getNormativeValue
(Object object, Collection<String> normative) Gets the normative value.static Collection<String>
getNormativeValues
(Collection<?> values) Get fUML normative values.static Object
getObjectFromFeatureValue
(fUML.Semantics.Classes.Kernel.FeatureValue featureValue) Return the value or value list from the feature value.static Object
getObjectFromParameterValue
(fUML.Semantics.CommonBehaviors.BasicBehaviors.ParameterValue parameterValue) Return the value or value list from the parameter value.static Object
getObjectFromToken
(fUML.Semantics.Activities.IntermediateActivities.Token token) The theObject
value from the specifiedToken
.static Object
getObjectFromTokenList
(List<fUML.Semantics.Activities.IntermediateActivities.Token> tokenList) Return the value or value list from theTokenList
.static Object
getObjectFromValue
(fUML.Semantics.Classes.Kernel.Value value) Return the value of the specified fUML value object.static Object
getObjectFromValueList
(fUML.Semantics.Classes.Kernel.ValueList valueList, int upperMultiplicity) Return the value or value list from the fUML value list.static Object
getObjectFromValueList
(fUML.Semantics.Classes.Kernel.ValueList valueList, int upperMultiplicity, TypedElement convertToTypeOf) Return the value or value list from the fUML value list.static 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, String name) Returns the instance ofParameter
from the specifiedExecution
and parameter's name.static fUML.Semantics.CommonBehaviors.BasicBehaviors.ParameterValue
getParameterValueByName
(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 listFeatureValue
from the specifiedStructuredValue
with the specified structural feature.static List<fUML.Semantics.Classes.Kernel.FeatureValue>
Returns the listFeatureValue
from the specifiedStructuredValue
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 specifiedvalue
from theFeatureValue
that is matched with the specifiedfeature
.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 specifiedSignal
, and send it to the targetObject_
.static void
sendSignal
(fUML.Semantics.CommonBehaviors.Communications.SignalInstance signal, fUML.Semantics.Classes.Kernel.Object_ target) Send the specifiedSignalInstance
to the specified targetObject_
.static void
sendSignal
(fUML.Semantics.CommonBehaviors.Communications.SignalInstance signal, fUML.Semantics.Classes.Kernel.Object_ target, String targetPortName) Send the specifiedSignalInstance
to the specifiedtarget
andtargetPortName
.static void
sendSignal
(fUML.Semantics.CommonBehaviors.Communications.SignalInstance signal, String targetName) Send the specifiedSignalInstance
to the specifiedtargetName
.static void
sendSignal
(String signalName, fUML.Semantics.Classes.Kernel.Object_ target) Create SignalInstance instance of the specifiedSignal
name, and send it to the targetObject_
.static void
sendSignal
(String signalName, fUML.Semantics.Classes.Kernel.Object_ target, String targetPortName) Create SignalInstance instance of the specifiedSignal
name, and send it to the specifiedtarget
andtargetPortName
.static void
sendSignal
(String signalName, String targetName) Create SignalInstance instance of the specifiedSignal
name, and send it to the specifiedtargetName
.static void
setFeatureValue
(fUML.Semantics.Classes.Kernel.StructuredValue object, StructuralFeature feature, Object value) Find theFeatureValue
, and set its value with thevalue
.static void
setFeatureValue
(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 void
setFeatureValue
(fUML.Semantics.Classes.Kernel.StructuredValue object, String featureName, Object value) Find theStructuralFeature
from the specified object with the specified structural feature name, and delegates tosetFeatureValue(StructuredValue, StructuralFeature, Object)
.static void
setParameterValue
(fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution execution, Parameter parameter, Object value) Find theParameterValue
.static void
setParameterValue
(fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution execution, String name, Object value) Find theParameter
by name from the specifiedExecution
, and delegate tosetParameterValue(Execution, Parameter, Object)
.static void
setParameterValue
(fUML.Semantics.CommonBehaviors.BasicBehaviors.ParameterValue parameterValue, Object object, boolean isReplaceAll) Set the value to the specifiedParameterValue
.static boolean
Set the specified value to the fUML value object.
-
Constructor Details
-
fUMLHelper
public fUMLHelper()
-
-
Method Details
-
getFeatureValueByName
public static fUML.Semantics.Classes.Kernel.FeatureValue getFeatureValueByName(@CheckForNull fUML.Semantics.Classes.Kernel.StructuredValue object, String name) Returns theFeatureValue
from the specifiedStructuredValue
with the specified name. Find theStructuralFeature
bygetFeatureByName(fUML.Semantics.Classes.Kernel.StructuredValue, java.lang.String)
- Parameters:
object
- the specifiedStructuredValue
name
- feature value name- Returns:
- The matched
FeatureValue
from the specifiedCompoundValue
ornull
if 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 theFeatureValue
from the specifiedStructuredValue
with the specified name andLocus
. Find theStructuralFeature
bygetFeatureByName(fUML.Semantics.Classes.Kernel.StructuredValue, java.lang.String)
- Parameters:
object
- the specifiedStructuredValue
name
- feature value namelocus
- the specifiedLocus
- Returns:
- The matched
FeatureValue
from the specifiedCompoundValue
ornull
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 theFeatureValue
from the specifiedStructuredValue
andStructuralFeature
. IfStructuredValue.getFeatureValue(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.StructuralFeature)
cannot find theFeatureValue
, continue to find it fromLink
TheLocus
is necessary to findFeatureValue
fromLink
- Parameters:
object
- the specifiedStructuredValue
feature
- the specifiedStructuralFeature
locus
- the specifiedLocus
- Returns:
FeatureValue
- Throws:
NullPointerException
- ifobject
isnull
-
getFeatureValue
@CheckForNull public static fUML.Semantics.Classes.Kernel.FeatureValue getFeatureValue(fUML.Semantics.Classes.Kernel.StructuredValue object, StructuralFeature feature) Returns theFeatureValue
from the specifiedStructuredValue
andStructuralFeature
. IfStructuredValue.getFeatureValue(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.StructuralFeature)
cannot find theFeatureValue
, continue to find it fromLink
TheLocus
that being retrieved fromfUMLEngine
is necessary to findFeatureValue
fromLink
This method try to getLocus
fromfUMLEngine
of the active session.- Parameters:
object
- the specifiedStructuredValue
feature
- the specifiedStructuralFeature
- Returns:
FeatureValue
- Throws:
NullPointerException
- ifobject
isnull
-
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 specifiedExecution
name
- the parameter value name- Returns:
- the parameter value of the object
-
getParameterByName
public static Parameter getParameterByName(fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution object, String name) Returns the instance ofParameter
from the specifiedExecution
and parameter's name.- Parameters:
object
- the specifiedExecution
name
- 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 ofValueList
with assigned values, and return it. Ifvalue
is 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:
ValueList
with assigned values.
-
createValueList
public static fUML.Semantics.Classes.Kernel.ValueList createValueList(Object value, Object owner, Type type) A convenience method for creating the instance ofValueList
with assigned values, and return it. Ifvalue
is 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:
ValueList
with 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 theStructuralFeature
of the specifiedCompoundValue
with the specified structural feature name.- Parameters:
object
- the specifiedCompoundValue
(or subclasses) to be usedfeatureName
- the structural feature name- Returns:
- the
StructuralFeature
of 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
. Ifvalue
is instance ofValueList
, setvalue
to the foundFeatureValue
, otherwise create the newValueList
and its value and set to the foundFeatureValue
. If want to findFeatureValue
fromAssociation
(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
. Ifvalue
is instance ofValueList
, setvalue
to the foundFeatureValue
, otherwise create the newValueList
and 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 theStructuralFeature
from 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 theExecution
based 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 ofBehavior
arguments
- 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 specifiedOperation
arguments
- 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 specifiedOperation
arguments
- 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 theParameter
by name from the specifiedExecution
, and delegate tosetParameterValue(Execution, Parameter, Object)
.- Parameters:
execution
- the specifiedExecution
name
- namevalue
- value- See Also:
-
setParameterValue
public static void setParameterValue(fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution execution, Parameter parameter, Object value) Find theParameterValue
. The newValueList
is created fromvalue
and 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
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
public static Object getObjectFromToken(fUML.Semantics.Activities.IntermediateActivities.Token token) The theObject
value from the specifiedToken
.- Parameters:
token
- the specifiedToken
- Returns:
- the
Object
value
-
addObjectToValueList
public static boolean addObjectToValueList(fUML.Semantics.Classes.Kernel.ValueList vList, Object object, Object owner) Create the newValue
from theobject
, and add to the last position of the specifiedValueList
.- Parameters:
vList
- the specifiedValueList
object
- the object being used to createValue
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 specifiedValueList
to 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 specifiedport
from the specifiedvalue
.- Parameters:
value
- the specifiedvalue
port
- the specifiedport
session
- 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 specifiedvalue
from theFeatureValue
that 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 listFeatureValue
from the specifiedStructuredValue
with the specified feature name. FeatureValue from multipleLink
can be collected.- Parameters:
object
- the specifiedStructuredValue
featureName
- feature name- Returns:
- The list of matched
FeatureValue
from the specifiedStructuredValue
ornull
if not found
-
getValue
public static List<fUML.Semantics.Classes.Kernel.FeatureValue> getValue(fUML.Semantics.Classes.Kernel.StructuredValue object, StructuralFeature structuralFeature) Returns the listFeatureValue
from the specifiedStructuredValue
with the specified structural feature. FeatureValue from multipleLink
can be collected.- Parameters:
object
- the specifiedStructuredValue
structuralFeature
- structuralFeature- Returns:
- The list of matched
FeatureValue
from the specifiedStructuredValue
ornull
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
Create SignalInstance instance of the specifiedSignal
name, and send it to the targetObject_
. IfsignalName
contains "::", it will find the signal from the qualified name, the signal is found if its qualified name is ended withsignalName
.- Parameters:
signalName
- the specifiedSignal
nametarget
- the specified targetObject_
-
sendSignal
Create SignalInstance instance of the specifiedSignal
, and send it to the targetObject_
.- Parameters:
signal
- the specifiedSignal
elementtarget
- the specified targetObject_
-
sendSignal
Create SignalInstance instance of the specifiedSignal
name, and send it to the specifiedtargetName
. IfsignalName
contains "::", it will find the signal from the qualified name, the signal is found if its qualified name is ended withsignalName
. IftargetName
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 specifiedSignal
nametargetName
- 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(String signalName, fUML.Semantics.Classes.Kernel.Object_ target, String targetPortName) Create SignalInstance instance of the specifiedSignal
name, and send it to the specifiedtarget
andtargetPortName
. IfsignalName
contains "::", it will find the signal from the qualified name, the signal is found if its qualified name is ended withsignalName
.- Parameters:
signalName
- the specifiedSignal
nametarget
- 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 specifiedSignalInstance
to the specified targetObject_
.- Parameters:
signal
- the specifiedSignalInstance
target
- the specified targetObject_
-
sendSignal
public static void sendSignal(fUML.Semantics.CommonBehaviors.Communications.SignalInstance signal, String targetName) Send the specifiedSignalInstance
to the specifiedtargetName
. IftargetName
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 specifiedSignalInstance
targetName
- 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 specifiedSignalInstance
to the specifiedtarget
andtargetPortName
.- Parameters:
signal
- the specifiedSignalInstance
target
- the specified targettargetPortName
- the specified target port name
-