Class StateModelImpl
- java.lang.Object
-
- org.nuiton.eugene.models.state.xml.StateModelImpl
-
- All Implemented Interfaces:
WithTagValuesOrStereotypes
,Model
,StateModel
@Component(role=Model.class, hint="statemodel") public class StateModelImpl extends Object implements StateModel
Implementation of theStateModel
.- Author:
- chatellier
-
-
Field Summary
Fields Modifier and Type Field Description protected List<StateModelStateChart>
listStateCharts
List of charts composing this modelprotected Map<String,String>
modelTagValues
Model tagged valuesprotected String
name
Name of this modelprotected String
version
Version of this model-
Fields inherited from interface org.nuiton.eugene.models.state.StateModel
NAME
-
-
Constructor Summary
Constructors Constructor Description StateModelImpl()
Construteur
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAllStateCharts(Collection<StateModelStateChart> charts)
Add a list of stateCharts into current modelvoid
addStateChart(StateModelStateChart chart)
Add chart.void
addStereotype(String stereotype)
void
addTagValue(String key, String value)
Adds the givenvalue
associated to thetagValue
.<O> O
getExtension(String reference, Class<O> extensionClass)
Get the extension associated to the reference (unique).String
getModelType()
String
getName()
Returns the name of this model.List<StateModelStateChart>
getStateCharts()
Return the collection of chartsSet<String>
getStereotypes()
String
getTagValue(String key)
Returns the tagValue corresponding to the given name, or null if the element has no associated tagValue for this name.Map<String,String>
getTagValues()
Returns the tagValues associated with this element.String
getVersion()
Returns the version of this model.boolean
hasStereotype(String stereotypeName)
boolean
hasTagValue(String tagValue)
Returns whether this element has a tagValue corresponding to the given name, or not.void
removeStereotype(String stereotype)
void
removeTagValue(String tagvalue)
void
setName(String name)
Set model name.void
setVersion(String version)
Set model version.
-
-
-
Method Detail
-
getModelType
public String getModelType()
- Specified by:
getModelType
in interfaceModel
- Returns:
- the type of model.
-
getName
public String getName()
Description copied from interface:Model
Returns the name of this model.
-
getStereotypes
public Set<String> getStereotypes()
- Specified by:
getStereotypes
in interfaceWithTagValuesOrStereotypes
-
hasStereotype
public boolean hasStereotype(String stereotypeName)
- Specified by:
hasStereotype
in interfaceWithTagValuesOrStereotypes
-
addStereotype
public void addStereotype(String stereotype)
- Specified by:
addStereotype
in interfaceWithTagValuesOrStereotypes
-
removeStereotype
public void removeStereotype(String stereotype)
- Specified by:
removeStereotype
in interfaceWithTagValuesOrStereotypes
-
setName
public void setName(String name)
Set model name.- Parameters:
name
- model name
-
addStateChart
public void addStateChart(StateModelStateChart chart)
Add chart.- Parameters:
chart
- chart
-
getStateCharts
public List<StateModelStateChart> getStateCharts()
Description copied from interface:StateModel
Return the collection of charts- Specified by:
getStateCharts
in interfaceStateModel
- Returns:
- collection of charts
-
addAllStateCharts
public void addAllStateCharts(Collection<StateModelStateChart> charts)
Add a list of stateCharts into current model- Parameters:
charts
- list
-
getTagValues
public Map<String,String> getTagValues()
Description copied from interface:WithTagValuesOrStereotypes
Returns the tagValues associated with this element. For each entry, the key is the name of the tagValue, the value is the value of the tagValue :-)- Specified by:
getTagValues
in interfaceWithTagValuesOrStereotypes
- Returns:
- a Map containing all tagValues associated with this element
-
addTagValue
public void addTagValue(String key, String value)
Description copied from interface:WithTagValuesOrStereotypes
Adds the givenvalue
associated to thetagValue
. Note: If a previous tag value was definied, then it will be replaced.- Specified by:
addTagValue
in interfaceWithTagValuesOrStereotypes
- Parameters:
key
- the name of the tag valuevalue
- the value to associate
-
getTagValue
public String getTagValue(String key)
Description copied from interface:WithTagValuesOrStereotypes
Returns the tagValue corresponding to the given name, or null if the element has no associated tagValue for this name.- Specified by:
getTagValue
in interfaceWithTagValuesOrStereotypes
- Parameters:
key
- tag value key- Returns:
- the value of the found tagValue, or null if the element has no associated tagValue for this name.
-
hasTagValue
public boolean hasTagValue(String tagValue)
Description copied from interface:WithTagValuesOrStereotypes
Returns whether this element has a tagValue corresponding to the given name, or not.- Specified by:
hasTagValue
in interfaceWithTagValuesOrStereotypes
- Parameters:
tagValue
- tag value name- Returns:
- a boolean indicating whether this element has a tagValue corresponding to the given name, or not.
-
removeTagValue
public void removeTagValue(String tagvalue)
- Specified by:
removeTagValue
in interfaceWithTagValuesOrStereotypes
-
setVersion
public void setVersion(String version)
Set model version.- Parameters:
version
- model version
-
getVersion
public String getVersion()
Description copied from interface:Model
Returns the version of this model.- Specified by:
getVersion
in interfaceModel
- Returns:
- the version of this model.
-
getExtension
public <O> O getExtension(String reference, Class<O> extensionClass) throws RuntimeException
Get the extension associated to the reference (unique). Create it if not exist.- Specified by:
getExtension
in interfaceModel
- Type Parameters:
O
- object type returned- Parameters:
reference
- unique corresponding to the extension to getextensionClass
- class of the extension- Returns:
- the object value for the extension
- Throws:
ClassCastException
- when extensionClass is not validRuntimeException
- when instantiation problem to create new extension
-
-