text: #include "umlReflectionExec/TimeIntervalObject.hpp"
  
  //General Includes
  #include "abstractDataTypes/SubsetUnion.hpp"
  #include "uml/TimeInterval.hpp"
  #include "umlReflection/UMLPackage.hpp"
  #include "fUML/Semantics/Loci/Locus.hpp"
  #include "uml/Class.hpp"
  //Includes From Composite Structures
  /*Not done for metamodel object classes*/
  //Execution Engine Includes
  #include "abstractDataTypes/Any.hpp"
  #include "PSCS/Semantics/StructuredClassifiers/StructuredClassifiersFactory.hpp"
  #include "PSCS/Semantics/StructuredClassifiers/CS_Reference.hpp"
  #include "fUML/Semantics/SimpleClassifiers/SimpleClassifiersFactory.hpp"
  #include "fUML/Semantics/Values/Value.hpp"
  #include "fUML/Semantics/SimpleClassifiers/FeatureValue.hpp"
  #include "PSCS/Semantics/StructuredClassifiers/CS_Link.hpp"
  #include "PSCS/Semantics/StructuredClassifiers/CS_InteractionPoint.hpp"
  #include "fUML/Semantics/CommonBehavior/Execution.hpp"
  #include "fUML/Semantics/CommonBehavior/CommonBehaviorFactory.hpp"
  #include "fUML/Semantics/Loci/ExecutionFactory.hpp"
  #include "fUML/Semantics/Loci/ChoiceStrategy.hpp"
  //UML Includes
  #include "uml/umlPackage.hpp"
  #include "uml/Association.hpp"
  #include "uml/Connector.hpp"
  #include "uml/ConnectorEnd.hpp"
  #include "uml/Operation.hpp"
  #include "uml/Property.hpp"
  #include "uml/Port.hpp"
  //Property Includes
  #include "uml/Comment.hpp"
  #include "umlReflectionExec/CommentObject.hpp"
  #include "uml/Element.hpp"
  #include "umlReflectionExec/ElementObject.hpp"
  #include "uml/Element.hpp"
  #include "umlReflectionExec/ElementObject.hpp"
  #include "uml/Dependency.hpp"
  #include "umlReflectionExec/DependencyObject.hpp"
  #include "fUML/Semantics/SimpleClassifiers/StringValue.hpp"
  #include "uml/StringExpression.hpp"
  #include "umlReflectionExec/StringExpressionObject.hpp"
  #include "uml/Namespace.hpp"
  #include "umlReflectionExec/NamespaceObject.hpp"
  #include "fUML/Semantics/SimpleClassifiers/StringValue.hpp"
  #include "fUML/Semantics/SimpleClassifiers/EnumerationValue.hpp"
  #include "uml/VisibilityKind.hpp"
  #include "fUML/Semantics/SimpleClassifiers/EnumerationValue.hpp"
  #include "uml/VisibilityKind.hpp"
  #include "uml/TemplateParameter.hpp"
  #include "umlReflectionExec/TemplateParameterObject.hpp"
  #include "uml/TemplateParameter.hpp"
  #include "umlReflectionExec/TemplateParameterObject.hpp"
  #include "uml/TimeExpression.hpp"
  #include "umlReflectionExec/TimeExpressionObject.hpp"
  #include "uml/TimeExpression.hpp"
  #include "umlReflectionExec/TimeExpressionObject.hpp"
  #include "uml/Type.hpp"
  #include "umlReflectionExec/TypeObject.hpp"
  //Property Packages Includes
  #include "primitivetypesReflection/PrimitiveTypesPackage.hpp"
  
  
  using namespace UML;
  
  TimeIntervalObject::TimeIntervalObject(std::shared_ptr<uml::TimeInterval> _element):
  
  	m_TimeIntervalValue(_element)
  {		
  	this->getTypes()->insert(this->getTypes()->begin(), UML::UMLPackage::eInstance()->get_UML_TimeInterval());
  }
  
  TimeIntervalObject::TimeIntervalObject(TimeIntervalObject &obj):
  	CS_ObjectImpl(obj)
  {
  }
  
  TimeIntervalObject::TimeIntervalObject()
  {	
  	this->getTypes()->insert(this->getTypes()->begin(), UML::UMLPackage::eInstance()->get_UML_TimeInterval());
  }
  
  TimeIntervalObject::~TimeIntervalObject()
  {
  }
  
  std::shared_ptr<ecore::EObject> TimeIntervalObject::copy()
  {
  	std::shared_ptr<TimeIntervalObject> element(new TimeIntervalObject(*this));
  	element->setThisTimeIntervalObjectPtr(element);
  	return element;
  }
  
  void TimeIntervalObject::destroy()
  {	
  	m_TimeIntervalValue.reset();
  
  	fUML::Semantics::StructuredClassifiers::ObjectImpl::destroy();
  }
  
  std::shared_ptr<uml::Element> TimeIntervalObject::getUmlValue() const
  {
  	return getTimeIntervalValue();
  }
  
  std::shared_ptr<uml::TimeInterval> TimeIntervalObject::getTimeIntervalValue() const
  {
  	return m_TimeIntervalValue;
  }
  
  void TimeIntervalObject::setUmlValue(std::shared_ptr<uml::Element> _element)
  {
  	setTimeIntervalValue(std::dynamic_pointer_cast<uml::TimeInterval>(_element));
  }
  
  void TimeIntervalObject::setTimeIntervalValue(std::shared_ptr<uml::TimeInterval> _TimeIntervalElement)
  {
  	m_TimeIntervalValue = _TimeIntervalElement;
  	//set super type values
  	UML::IntervalObject::setIntervalValue(_TimeIntervalElement);
  }
  
  void TimeIntervalObject::setThisTimeIntervalObjectPtr(std::weak_ptr<TimeIntervalObject> thisObjectPtr)
  {
  	setThisCS_ObjectPtr(thisObjectPtr);
  }
  
  bool TimeIntervalObject::equals(std::shared_ptr<fUML::Semantics::Values::Value> otherValue)
  {
  	bool isEqual = false;
  	
  	std::shared_ptr<TimeIntervalObject> otherTimeIntervalObject = std::dynamic_pointer_cast<TimeIntervalObject>(otherValue);
  
  	if(otherTimeIntervalObject != nullptr)
  	{
  		if(this->getTimeIntervalValue() == otherTimeIntervalObject->getTimeIntervalValue())
  		{
  			isEqual = true;
  		}
  	}
  
  	return isEqual;
  }
  
  std::string TimeIntervalObject::toString()
  {
  	std::string buffer = "Instance of 'TimeIntervalObject', " + std::to_string(getTypes()->size()) + " types (";
  	for(unsigned int i = 0; i < getTypes()->size(); ++i)
  	{
  		buffer += "type{" + std::to_string(i) + "}: '" + getTypes()->at(i)->getName() + "', ";
  	}
  	buffer +=")";
  
  	return buffer;
  }
  
  std::shared_ptr<Bag<PSCS::Semantics::StructuredClassifiers::CS_Object>> TimeIntervalObject::getDirectContainers()
  {   
  	std::shared_ptr<Bag<PSCS::Semantics::StructuredClassifiers::CS_Object>> directContainers(new Bag<PSCS::Semantics::StructuredClassifiers::CS_Object>());
  
  	/*Not done for metamodel object classes*/
  
  	return directContainers;
  }
  
  std::shared_ptr<Bag<PSCS::Semantics::StructuredClassifiers::CS_Link>> TimeIntervalObject::getLinks(std::shared_ptr<PSCS::Semantics::StructuredClassifiers::CS_InteractionPoint> interactionPoint)
  {
  	std::shared_ptr<Bag<PSCS::Semantics::StructuredClassifiers::CS_Link>> allLinks(new Bag<PSCS::Semantics::StructuredClassifiers::CS_Link>());
  
  	/*Not done for metamodel object classes*/
  
  	return allLinks;
  }
  
  std::shared_ptr<Bag<fUML::Semantics::Values::Value>> TimeIntervalObject::retrieveEndValueAsInteractionPoint(std::shared_ptr<fUML::Semantics::Values::Value> endValue, std::shared_ptr<uml::ConnectorEnd> end)
  {
  	/*Not done for metamodel object classes*/
  
  	return nullptr;
  }
  
  void TimeIntervalObject::removeValue(std::shared_ptr<uml::StructuralFeature> feature, std::shared_ptr<fUML::Semantics::Values::Value> value)
  {
  	if (feature->getMetaElementID() != uml::umlPackage::PROPERTY_CLASS && feature->getMetaElementID() != uml::umlPackage::PORT_CLASS && feature->getMetaElementID() != uml::umlPackage::EXTENSIONEND_CLASS)
  	{
  		std::cerr << __PRETTY_FUNCTION__ << ": feature is null or not kind of uml::Property" << std::endl;
  		throw "feature is null or not kind of uml::Property";
  	}
  
  	if (m_TimeIntervalValue == nullptr)
  	{
  		std::cerr << __PRETTY_FUNCTION__ << ": no value stored inside TimeIntervalObject (property: " << feature->getName() << ")" << std::endl;
  		throw "NullPointerException";	
  	}
  
  	if (feature == UML::UMLPackage::eInstance()->get_UML_Element_ownedComment())
  	{
  		if (value == nullptr) // clear mode
  		{
  			m_TimeIntervalValue->getOwnedComment()->clear();
  		}
  		else
  		{
  			/* Should use PSCS::CS_Reference but dynamic_pointer_cast fails --> using fUML::Reference instead
  			std::shared_ptr<PSCS::Semantics::StructuredClassifiers::CS_Reference> reference = std::dynamic_pointer_cast<PSCS::Semantics::StructuredClassifiers::CS_Reference>(value); */
  			std::shared_ptr<fUML::Semantics::StructuredClassifiers::Reference> reference = std::dynamic_pointer_cast<fUML::Semantics::StructuredClassifiers::Reference>(value);
  			std::shared_ptr<UML::CommentObject> inputValue = std::dynamic_pointer_cast<UML::CommentObject>(reference->getReferent());
  			if (inputValue != nullptr)
  			{
  				m_TimeIntervalValue->getOwnedComment()->erase(inputValue->getCommentValue());
  			}
  		}
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_NamedElement_name())
  	{
  				// no default value defined, clear not realized
  
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_NamedElement_nameExpression())
  	{
  				m_TimeIntervalValue->getNameExpression().reset();
  
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_NamedElement_visibility())
  	{
  				// no default value defined, clear not realized
  
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_PackageableElement_visibility())
  	{
  				m_TimeIntervalValue->setVisibility(uml::VisibilityKind::PUBLIC /*defined default value*/);
  
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_ParameterableElement_owningTemplateParameter())
  	{
  				m_TimeIntervalValue->getOwningTemplateParameter().reset();
  
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_ParameterableElement_templateParameter())
  	{
  				m_TimeIntervalValue->getTemplateParameter().reset();
  
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_TimeInterval_max())
  	{
  				m_TimeIntervalValue->getMax().reset();
  
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_TimeInterval_min())
  	{
  				m_TimeIntervalValue->getMin().reset();
  
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_TypedElement_type())
  	{
  				m_TimeIntervalValue->getType().reset();
  
  	}
  }
  
  
  std::shared_ptr<Bag<fUML::Semantics::Values::Value>> TimeIntervalObject::getValues(std::shared_ptr<uml::StructuralFeature> feature, std::shared_ptr<Bag<fUML::Semantics::SimpleClassifiers::FeatureValue>> featureValues)
  {
  	if (feature->getMetaElementID() != uml::umlPackage::PROPERTY_CLASS && feature->getMetaElementID() != uml::umlPackage::PORT_CLASS && feature->getMetaElementID() != uml::umlPackage::EXTENSIONEND_CLASS)
  	{
  		std::cerr << __PRETTY_FUNCTION__ << ": feature is null or not kind of uml::Property" << std::endl;
  		throw "feature is null or not kind of uml::Property";
  	}
  
  	if (m_TimeIntervalValue == nullptr)
  	{
  		std::cerr << __PRETTY_FUNCTION__ << ": no value stored inside TimeIntervalObject (property: " << feature->getName() << ")" << std::endl;
  		throw "NullPointerException";	
  	}
  
  	std::shared_ptr<Bag<fUML::Semantics::Values::Value>> values(new Bag<fUML::Semantics::Values::Value>());
  	if (feature == UML::UMLPackage::eInstance()->get_UML_Element_ownedComment())
  	{
  		std::shared_ptr<Bag<uml::Comment>> ownedCommentList = m_TimeIntervalValue->getOwnedComment();
  		Bag<uml::Comment>::iterator iter = ownedCommentList->begin();
  		Bag<uml::Comment>::iterator end = ownedCommentList->end();
  		while (iter != end)
  		{
  			std::shared_ptr<UML::CommentObject> value(new UML::CommentObject());
  			value->setThisCommentObjectPtr(value);
  			value->setLocus(this->getLocus());
  			value->setCommentValue(*iter);
  			std::shared_ptr<PSCS::Semantics::StructuredClassifiers::CS_Reference> reference = PSCS::Semantics::StructuredClassifiers::StructuredClassifiersFactory::eInstance()->createCS_Reference();
  			reference->setReferent(value);
  			reference->setCompositeReferent(value);
  			values->add(reference);
  			iter++;
  		} 
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_Element_ownedElement())
  	{
  		std::shared_ptr<Bag<uml::Element>> ownedElementList = m_TimeIntervalValue->getOwnedElement();
  		Bag<uml::Element>::iterator iter = ownedElementList->begin();
  		Bag<uml::Element>::iterator end = ownedElementList->end();
  		while (iter != end)
  		{
  			std::shared_ptr<UML::ElementObject> value(new UML::ElementObject());
  			value->setThisElementObjectPtr(value);
  			value->setLocus(this->getLocus());
  			value->setElementValue(*iter);
  			std::shared_ptr<PSCS::Semantics::StructuredClassifiers::CS_Reference> reference = PSCS::Semantics::StructuredClassifiers::StructuredClassifiersFactory::eInstance()->createCS_Reference();
  			reference->setReferent(value);
  			reference->setCompositeReferent(value);
  			values->add(reference);
  			iter++;
  		} 
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_Element_owner())
  	{
  		std::shared_ptr<UML::ElementObject> value(new UML::ElementObject());
  		value->setThisElementObjectPtr(value);
  		value->setLocus(this->getLocus());
  		value->setElementValue(m_TimeIntervalValue->getOwner().lock());
  		std::shared_ptr<PSCS::Semantics::StructuredClassifiers::CS_Reference> reference = PSCS::Semantics::StructuredClassifiers::StructuredClassifiersFactory::eInstance()->createCS_Reference();
  		reference->setReferent(value);
  		values->add(reference);
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_NamedElement_clientDependency())
  	{
  		std::shared_ptr<Bag<uml::Dependency>> clientDependencyList = m_TimeIntervalValue->getClientDependency();
  		Bag<uml::Dependency>::iterator iter = clientDependencyList->begin();
  		Bag<uml::Dependency>::iterator end = clientDependencyList->end();
  		while (iter != end)
  		{
  			std::shared_ptr<UML::DependencyObject> value(new UML::DependencyObject());
  			value->setThisDependencyObjectPtr(value);
  			value->setLocus(this->getLocus());
  			value->setDependencyValue(*iter);
  			std::shared_ptr<PSCS::Semantics::StructuredClassifiers::CS_Reference> reference = PSCS::Semantics::StructuredClassifiers::StructuredClassifiersFactory::eInstance()->createCS_Reference();
  			reference->setReferent(value);
  			values->add(reference);
  			iter++;
  		} 
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_NamedElement_name())
  	{
  		std::shared_ptr<fUML::Semantics::SimpleClassifiers::StringValue> value = fUML::Semantics::SimpleClassifiers::SimpleClassifiersFactory::eInstance()->createStringValue();
  		value->setValue(m_TimeIntervalValue->getName());
  		values->add(value);
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_NamedElement_nameExpression())
  	{
  		std::shared_ptr<UML::StringExpressionObject> value(new UML::StringExpressionObject());
  		value->setThisStringExpressionObjectPtr(value);
  		value->setLocus(this->getLocus());
  		value->setStringExpressionValue(m_TimeIntervalValue->getNameExpression());
  		std::shared_ptr<PSCS::Semantics::StructuredClassifiers::CS_Reference> reference = PSCS::Semantics::StructuredClassifiers::StructuredClassifiersFactory::eInstance()->createCS_Reference();
  		reference->setReferent(value);
  		reference->setCompositeReferent(value);
  		values->add(reference);
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_NamedElement_namespace())
  	{
  		std::shared_ptr<UML::NamespaceObject> value(new UML::NamespaceObject());
  		value->setThisNamespaceObjectPtr(value);
  		value->setLocus(this->getLocus());
  		value->setNamespaceValue(m_TimeIntervalValue->getNamespace().lock());
  		std::shared_ptr<PSCS::Semantics::StructuredClassifiers::CS_Reference> reference = PSCS::Semantics::StructuredClassifiers::StructuredClassifiersFactory::eInstance()->createCS_Reference();
  		reference->setReferent(value);
  		values->add(reference);
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_NamedElement_qualifiedName())
  	{
  		std::shared_ptr<fUML::Semantics::SimpleClassifiers::StringValue> value = fUML::Semantics::SimpleClassifiers::SimpleClassifiersFactory::eInstance()->createStringValue();
  		value->setValue(m_TimeIntervalValue->getQualifiedName());
  		values->add(value);
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_NamedElement_visibility())
  	{
  		uml::VisibilityKind visibility = m_TimeIntervalValue->getVisibility();
  		std::shared_ptr<fUML::Semantics::SimpleClassifiers::EnumerationValue> value = fUML::Semantics::SimpleClassifiers::SimpleClassifiersFactory::eInstance()->createEnumerationValue();
  		if (visibility == uml::VisibilityKind::PUBLIC)
  		{
  			value->setLiteral(UML::UMLPackage::eInstance()->get_UML_VisibilityKind_public());
  		}
  		if (visibility == uml::VisibilityKind::PRIVATE)
  		{
  			value->setLiteral(UML::UMLPackage::eInstance()->get_UML_VisibilityKind_private());
  		}
  		if (visibility == uml::VisibilityKind::PROTECTED)
  		{
  			value->setLiteral(UML::UMLPackage::eInstance()->get_UML_VisibilityKind_protected());
  		}
  		if (visibility == uml::VisibilityKind::PACKAGE)
  		{
  			value->setLiteral(UML::UMLPackage::eInstance()->get_UML_VisibilityKind_package());
  		}
  		values->add(value);
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_PackageableElement_visibility())
  	{
  		uml::VisibilityKind visibility = m_TimeIntervalValue->getVisibility();
  		std::shared_ptr<fUML::Semantics::SimpleClassifiers::EnumerationValue> value = fUML::Semantics::SimpleClassifiers::SimpleClassifiersFactory::eInstance()->createEnumerationValue();
  		if (visibility == uml::VisibilityKind::PUBLIC)
  		{
  			value->setLiteral(UML::UMLPackage::eInstance()->get_UML_VisibilityKind_public());
  		}
  		if (visibility == uml::VisibilityKind::PRIVATE)
  		{
  			value->setLiteral(UML::UMLPackage::eInstance()->get_UML_VisibilityKind_private());
  		}
  		if (visibility == uml::VisibilityKind::PROTECTED)
  		{
  			value->setLiteral(UML::UMLPackage::eInstance()->get_UML_VisibilityKind_protected());
  		}
  		if (visibility == uml::VisibilityKind::PACKAGE)
  		{
  			value->setLiteral(UML::UMLPackage::eInstance()->get_UML_VisibilityKind_package());
  		}
  		values->add(value);
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_ParameterableElement_owningTemplateParameter())
  	{
  		std::shared_ptr<UML::TemplateParameterObject> value(new UML::TemplateParameterObject());
  		value->setThisTemplateParameterObjectPtr(value);
  		value->setLocus(this->getLocus());
  		value->setTemplateParameterValue(m_TimeIntervalValue->getOwningTemplateParameter().lock());
  		std::shared_ptr<PSCS::Semantics::StructuredClassifiers::CS_Reference> reference = PSCS::Semantics::StructuredClassifiers::StructuredClassifiersFactory::eInstance()->createCS_Reference();
  		reference->setReferent(value);
  		values->add(reference);
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_ParameterableElement_templateParameter())
  	{
  		std::shared_ptr<UML::TemplateParameterObject> value(new UML::TemplateParameterObject());
  		value->setThisTemplateParameterObjectPtr(value);
  		value->setLocus(this->getLocus());
  		value->setTemplateParameterValue(m_TimeIntervalValue->getTemplateParameter());
  		std::shared_ptr<PSCS::Semantics::StructuredClassifiers::CS_Reference> reference = PSCS::Semantics::StructuredClassifiers::StructuredClassifiersFactory::eInstance()->createCS_Reference();
  		reference->setReferent(value);
  		values->add(reference);
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_TimeInterval_max())
  	{
  		std::shared_ptr<UML::TimeExpressionObject> value(new UML::TimeExpressionObject());
  		value->setThisTimeExpressionObjectPtr(value);
  		value->setLocus(this->getLocus());
  		value->setTimeExpressionValue(std::dynamic_pointer_cast<uml::TimeExpression>(m_TimeIntervalValue->getMax()));
  		std::shared_ptr<PSCS::Semantics::StructuredClassifiers::CS_Reference> reference = PSCS::Semantics::StructuredClassifiers::StructuredClassifiersFactory::eInstance()->createCS_Reference();
  		reference->setReferent(value);
  		values->add(reference);
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_TimeInterval_min())
  	{
  		std::shared_ptr<UML::TimeExpressionObject> value(new UML::TimeExpressionObject());
  		value->setThisTimeExpressionObjectPtr(value);
  		value->setLocus(this->getLocus());
  		value->setTimeExpressionValue(std::dynamic_pointer_cast<uml::TimeExpression>(m_TimeIntervalValue->getMin()));
  		std::shared_ptr<PSCS::Semantics::StructuredClassifiers::CS_Reference> reference = PSCS::Semantics::StructuredClassifiers::StructuredClassifiersFactory::eInstance()->createCS_Reference();
  		reference->setReferent(value);
  		values->add(reference);
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_TypedElement_type())
  	{
  		std::shared_ptr<UML::TypeObject> value(new UML::TypeObject());
  		value->setThisTypeObjectPtr(value);
  		value->setLocus(this->getLocus());
  		value->setTypeValue(m_TimeIntervalValue->getType());
  		std::shared_ptr<PSCS::Semantics::StructuredClassifiers::CS_Reference> reference = PSCS::Semantics::StructuredClassifiers::StructuredClassifiersFactory::eInstance()->createCS_Reference();
  		reference->setReferent(value);
  		values->add(reference);
  	}
  	return values;
  }
  
  std::shared_ptr<fUML::Semantics::SimpleClassifiers::FeatureValue> TimeIntervalObject::retrieveFeatureValue(std::shared_ptr<uml::StructuralFeature> feature)
  {
  	std::shared_ptr<fUML::Semantics::SimpleClassifiers::FeatureValue> featureValue(fUML::Semantics::SimpleClassifiers::SimpleClassifiersFactory::eInstance()->createFeatureValue());
  	featureValue->setFeature(feature);
  
  	std::shared_ptr<Bag<fUML::Semantics::SimpleClassifiers::FeatureValue>> featureValues(new Bag<fUML::Semantics::SimpleClassifiers::FeatureValue>());
  	std::shared_ptr<Bag<fUML::Semantics::Values::Value>> values = this->getValues(feature, featureValues);
  	
  	unsigned int valuesSize = values->size();
  	for(unsigned int i = 0; i < valuesSize; i++)
  	{
  		featureValue->getValues()->add(values->at(i));
  	}
  
  	return featureValue;
  }
  
  
  void TimeIntervalObject::setFeatureValue(std::shared_ptr<uml::StructuralFeature> feature, std::shared_ptr<Bag<fUML::Semantics::Values::Value>> values, int position)
  {
  	if (feature->getMetaElementID() != uml::umlPackage::PROPERTY_CLASS && feature->getMetaElementID() != uml::umlPackage::PORT_CLASS && feature->getMetaElementID() != uml::umlPackage::EXTENSIONEND_CLASS)
  	{
  		std::cerr << __PRETTY_FUNCTION__ << ": feature is null or not kind of uml::Property" << std::endl;
  		throw "feature is null or not kind of uml::Property";
  	}
  
  	if (m_TimeIntervalValue == nullptr)
  	{
  		std::cerr << __PRETTY_FUNCTION__ << ": no value stored inside TimeIntervalObject (property: " << feature->getName() << ")" << std::endl;
  		throw "NullPointerException";	
  	}
  
  	if (values->size() == 0)
  	{
  		std::cout << __PRETTY_FUNCTION__ << ": no input value given" << std::endl;
  		return;
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_Element_ownedComment())
  	{
  		Bag<fUML::Semantics::Values::Value>::iterator iter = values->begin();
  		Bag<fUML::Semantics::Values::Value>::iterator end = values->end();
  		m_TimeIntervalValue->getOwnedComment()->clear();
  		while (iter != end)
  		{
  			std::shared_ptr<fUML::Semantics::Values::Value> inputValue = *iter;
  			std::shared_ptr<PSCS::Semantics::StructuredClassifiers::CS_Reference> reference = std::dynamic_pointer_cast<PSCS::Semantics::StructuredClassifiers::CS_Reference>(inputValue);
  			std::shared_ptr<UML::CommentObject> value = std::dynamic_pointer_cast<UML::CommentObject>(reference->getReferent());
  			if (value != nullptr)
  			{
  				m_TimeIntervalValue->getOwnedComment()->push_back(value->getCommentValue());
  			}
  			
  			iter++;
  		}
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_NamedElement_name())
  	{
  		std::shared_ptr<fUML::Semantics::Values::Value> inputValue = values->at(0);
  		std::shared_ptr<fUML::Semantics::SimpleClassifiers::StringValue> valueObject = std::dynamic_pointer_cast<fUML::Semantics::SimpleClassifiers::StringValue>(inputValue);
  		if (valueObject != nullptr)
  		{
  			m_TimeIntervalValue->setName(valueObject->getValue());
  		}
  		
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_NamedElement_nameExpression())
  	{
  		std::shared_ptr<fUML::Semantics::Values::Value> inputValue = values->at(0);
  		std::shared_ptr<PSCS::Semantics::StructuredClassifiers::CS_Reference> reference = std::dynamic_pointer_cast<PSCS::Semantics::StructuredClassifiers::CS_Reference>(inputValue);
  		std::shared_ptr<UML::StringExpressionObject> value = std::dynamic_pointer_cast<UML::StringExpressionObject>(reference->getReferent());
  		if (value != nullptr)
  		{
  			m_TimeIntervalValue->setNameExpression(value->getStringExpressionValue());
  		}
  		
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_NamedElement_visibility())
  	{
  		std::shared_ptr<fUML::Semantics::Values::Value> inputValue = values->at(0);
  		std::shared_ptr<fUML::Semantics::SimpleClassifiers::EnumerationValue> enumValue = std::dynamic_pointer_cast<fUML::Semantics::SimpleClassifiers::EnumerationValue>(inputValue);
  		std::shared_ptr<uml::EnumerationLiteral> literal = enumValue->getLiteral();
  		if (literal == UML::UMLPackage::eInstance()->get_UML_VisibilityKind_public())
  		{
  			m_TimeIntervalValue->setVisibility(uml::VisibilityKind::PUBLIC);
  		}
  		if (literal == UML::UMLPackage::eInstance()->get_UML_VisibilityKind_private())
  		{
  			m_TimeIntervalValue->setVisibility(uml::VisibilityKind::PRIVATE);
  		}
  		if (literal == UML::UMLPackage::eInstance()->get_UML_VisibilityKind_protected())
  		{
  			m_TimeIntervalValue->setVisibility(uml::VisibilityKind::PROTECTED);
  		}
  		if (literal == UML::UMLPackage::eInstance()->get_UML_VisibilityKind_package())
  		{
  			m_TimeIntervalValue->setVisibility(uml::VisibilityKind::PACKAGE);
  		}
  		
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_PackageableElement_visibility())
  	{
  		std::shared_ptr<fUML::Semantics::Values::Value> inputValue = values->at(0);
  		std::shared_ptr<fUML::Semantics::SimpleClassifiers::EnumerationValue> enumValue = std::dynamic_pointer_cast<fUML::Semantics::SimpleClassifiers::EnumerationValue>(inputValue);
  		std::shared_ptr<uml::EnumerationLiteral> literal = enumValue->getLiteral();
  		if (literal == UML::UMLPackage::eInstance()->get_UML_VisibilityKind_public())
  		{
  			m_TimeIntervalValue->setVisibility(uml::VisibilityKind::PUBLIC);
  		}
  		if (literal == UML::UMLPackage::eInstance()->get_UML_VisibilityKind_private())
  		{
  			m_TimeIntervalValue->setVisibility(uml::VisibilityKind::PRIVATE);
  		}
  		if (literal == UML::UMLPackage::eInstance()->get_UML_VisibilityKind_protected())
  		{
  			m_TimeIntervalValue->setVisibility(uml::VisibilityKind::PROTECTED);
  		}
  		if (literal == UML::UMLPackage::eInstance()->get_UML_VisibilityKind_package())
  		{
  			m_TimeIntervalValue->setVisibility(uml::VisibilityKind::PACKAGE);
  		}
  		
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_ParameterableElement_templateParameter())
  	{
  		std::shared_ptr<fUML::Semantics::Values::Value> inputValue = values->at(0);
  		std::shared_ptr<PSCS::Semantics::StructuredClassifiers::CS_Reference> reference = std::dynamic_pointer_cast<PSCS::Semantics::StructuredClassifiers::CS_Reference>(inputValue);
  		std::shared_ptr<UML::TemplateParameterObject> value = std::dynamic_pointer_cast<UML::TemplateParameterObject>(reference->getReferent());
  		if (value != nullptr)
  		{
  			m_TimeIntervalValue->setTemplateParameter(value->getTemplateParameterValue());
  		}
  		
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_TimeInterval_max())
  	{
  		std::shared_ptr<fUML::Semantics::Values::Value> inputValue = values->at(0);
  		std::shared_ptr<PSCS::Semantics::StructuredClassifiers::CS_Reference> reference = std::dynamic_pointer_cast<PSCS::Semantics::StructuredClassifiers::CS_Reference>(inputValue);
  		std::shared_ptr<UML::TimeExpressionObject> value = std::dynamic_pointer_cast<UML::TimeExpressionObject>(reference->getReferent());
  		if (value != nullptr)
  		{
  			m_TimeIntervalValue->setMax(value->getTimeExpressionValue());
  		}
  		
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_TimeInterval_min())
  	{
  		std::shared_ptr<fUML::Semantics::Values::Value> inputValue = values->at(0);
  		std::shared_ptr<PSCS::Semantics::StructuredClassifiers::CS_Reference> reference = std::dynamic_pointer_cast<PSCS::Semantics::StructuredClassifiers::CS_Reference>(inputValue);
  		std::shared_ptr<UML::TimeExpressionObject> value = std::dynamic_pointer_cast<UML::TimeExpressionObject>(reference->getReferent());
  		if (value != nullptr)
  		{
  			m_TimeIntervalValue->setMin(value->getTimeExpressionValue());
  		}
  		
  	}
  	if (feature == UML::UMLPackage::eInstance()->get_UML_TypedElement_type())
  	{
  		std::shared_ptr<fUML::Semantics::Values::Value> inputValue = values->at(0);
  		std::shared_ptr<PSCS::Semantics::StructuredClassifiers::CS_Reference> reference = std::dynamic_pointer_cast<PSCS::Semantics::StructuredClassifiers::CS_Reference>(inputValue);
  		std::shared_ptr<UML::TypeObject> value = std::dynamic_pointer_cast<UML::TypeObject>(reference->getReferent());
  		if (value != nullptr)
  		{
  			m_TimeIntervalValue->setType(value->getTypeValue());
  		}
  		
  	}
  }
  
  void TimeIntervalObject::assignFeatureValue(std::shared_ptr<uml::StructuralFeature> feature, std::shared_ptr<Bag<fUML::Semantics::Values::Value>> values, int position)
  {
  	this->setFeatureValue(feature, values, position);
  }
  
  std::shared_ptr<Bag<fUML::Semantics::SimpleClassifiers::FeatureValue>> TimeIntervalObject::retrieveFeatureValues()
  {
  	std::shared_ptr<uml::Classifier> type = this->getTypes()->at(0);
  	std::shared_ptr<Bag<uml::Property>> allAttributes = type->getAllAttributes();
  	std::shared_ptr<Bag<fUML::Semantics::SimpleClassifiers::FeatureValue>> featureValues(new Bag<fUML::Semantics::SimpleClassifiers::FeatureValue>());
  	
  	unsigned int allAttributesSize = allAttributes->size();
  
  	for(unsigned int i = 0; i < allAttributesSize; i++)
  	{
  		std::shared_ptr<uml::Property> property = allAttributes->at(i);
  		if (property == UML::UMLPackage::eInstance()->get_UML_Element_ownedComment() && m_TimeIntervalValue->getOwnedComment() != nullptr)
  		{
  			featureValues->add(this->retrieveFeatureValue(property));
  		}
  		if (property == UML::UMLPackage::eInstance()->get_UML_Element_ownedElement() && m_TimeIntervalValue->getOwnedElement() != nullptr)
  		{
  			featureValues->add(this->retrieveFeatureValue(property));
  		}
  		if (property == UML::UMLPackage::eInstance()->get_UML_Element_owner() && m_TimeIntervalValue->getOwner().lock() != nullptr)
  		{
  			featureValues->add(this->retrieveFeatureValue(property));
  		}
  		if (property == UML::UMLPackage::eInstance()->get_UML_NamedElement_clientDependency() && m_TimeIntervalValue->getClientDependency() != nullptr)
  		{
  			featureValues->add(this->retrieveFeatureValue(property));
  		}
  		if (property == UML::UMLPackage::eInstance()->get_UML_NamedElement_nameExpression() && m_TimeIntervalValue->getNameExpression() != nullptr)
  		{
  			featureValues->add(this->retrieveFeatureValue(property));
  		}
  		if (property == UML::UMLPackage::eInstance()->get_UML_NamedElement_namespace() && m_TimeIntervalValue->getNamespace().lock() != nullptr)
  		{
  			featureValues->add(this->retrieveFeatureValue(property));
  		}
  		if (property == UML::UMLPackage::eInstance()->get_UML_ParameterableElement_owningTemplateParameter() && m_TimeIntervalValue->getOwningTemplateParameter().lock() != nullptr)
  		{
  			featureValues->add(this->retrieveFeatureValue(property));
  		}
  		if (property == UML::UMLPackage::eInstance()->get_UML_ParameterableElement_templateParameter() && m_TimeIntervalValue->getTemplateParameter() != nullptr)
  		{
  			featureValues->add(this->retrieveFeatureValue(property));
  		}
  		if (property == UML::UMLPackage::eInstance()->get_UML_TimeInterval_max() && m_TimeIntervalValue->getMax() != nullptr)
  		{
  			featureValues->add(this->retrieveFeatureValue(property));
  		}
  		if (property == UML::UMLPackage::eInstance()->get_UML_TimeInterval_min() && m_TimeIntervalValue->getMin() != nullptr)
  		{
  			featureValues->add(this->retrieveFeatureValue(property));
  		}
  		if (property == UML::UMLPackage::eInstance()->get_UML_TypedElement_type() && m_TimeIntervalValue->getType() != nullptr)
  		{
  			featureValues->add(this->retrieveFeatureValue(property));
  		}
  	}
  	
  	return featureValues;
  }
  
  