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>listStateChartsList of charts composing this modelprotected Map<String,String>modelTagValuesModel tagged valuesprotected StringnameName of this modelprotected StringversionVersion 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 voidaddAllStateCharts(Collection<StateModelStateChart> charts)Add a list of stateCharts into current modelvoidaddStateChart(StateModelStateChart chart)Add chart.voidaddStereotype(String stereotype)voidaddTagValue(String key, String value)Adds the givenvalueassociated to thetagValue.<O> OgetExtension(String reference, Class<O> extensionClass)Get the extension associated to the reference (unique).StringgetModelType()StringgetName()Returns the name of this model.List<StateModelStateChart>getStateCharts()Return the collection of chartsSet<String>getStereotypes()StringgetTagValue(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.StringgetVersion()Returns the version of this model.booleanhasStereotype(String stereotypeName)booleanhasTagValue(String tagValue)Returns whether this element has a tagValue corresponding to the given name, or not.voidremoveStereotype(String stereotype)voidremoveTagValue(String tagvalue)voidsetName(String name)Set model name.voidsetVersion(String version)Set model version.
-
-
-
Method Detail
-
getModelType
public String getModelType()
- Specified by:
getModelTypein interfaceModel- Returns:
- the type of model.
-
getName
public String getName()
Description copied from interface:ModelReturns the name of this model.
-
getStereotypes
public Set<String> getStereotypes()
- Specified by:
getStereotypesin interfaceWithTagValuesOrStereotypes
-
hasStereotype
public boolean hasStereotype(String stereotypeName)
- Specified by:
hasStereotypein interfaceWithTagValuesOrStereotypes
-
addStereotype
public void addStereotype(String stereotype)
- Specified by:
addStereotypein interfaceWithTagValuesOrStereotypes
-
removeStereotype
public void removeStereotype(String stereotype)
- Specified by:
removeStereotypein 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:StateModelReturn the collection of charts- Specified by:
getStateChartsin 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:WithTagValuesOrStereotypesReturns 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:
getTagValuesin interfaceWithTagValuesOrStereotypes- Returns:
- a Map containing all tagValues associated with this element
-
addTagValue
public void addTagValue(String key, String value)
Description copied from interface:WithTagValuesOrStereotypesAdds the givenvalueassociated to thetagValue. Note: If a previous tag value was definied, then it will be replaced.- Specified by:
addTagValuein interfaceWithTagValuesOrStereotypes- Parameters:
key- the name of the tag valuevalue- the value to associate
-
getTagValue
public String getTagValue(String key)
Description copied from interface:WithTagValuesOrStereotypesReturns the tagValue corresponding to the given name, or null if the element has no associated tagValue for this name.- Specified by:
getTagValuein 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:WithTagValuesOrStereotypesReturns whether this element has a tagValue corresponding to the given name, or not.- Specified by:
hasTagValuein 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:
removeTagValuein interfaceWithTagValuesOrStereotypes
-
setVersion
public void setVersion(String version)
Set model version.- Parameters:
version- model version
-
getVersion
public String getVersion()
Description copied from interface:ModelReturns the version of this model.- Specified by:
getVersionin 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:
getExtensionin 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
-
-