[GME-commit] GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Rep AspectRep.cpp,1.8,1.9 AspectRep.h,1.6,1.7 Dumper.cpp,1.17,1.18 ModelRep.cpp,1.11,1.12 ReferenceRep.cpp,1.9,1.10 SetRep.cpp,1.4,1.5

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Wed Jun 16 14:56:54 CDT 2004


Update of /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Rep
In directory braindrain:/tmp/cvs-serv25910/Rep

Modified Files:
	AspectRep.cpp AspectRep.h Dumper.cpp ModelRep.cpp 
	ReferenceRep.cpp SetRep.cpp 
Log Message:
Bug corrected: Aspect membership of a Role needs to be derived to roles in the derived models.

Instead of bitmaps icons with transparent background used on the Aspect Order Dialogue buttons.


CVS User: zolmol

Index: AspectRep.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Rep/AspectRep.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** AspectRep.cpp	14 May 2004 00:54:05 -0000	1.8
--- AspectRep.cpp	16 Jun 2004 18:56:52 -0000	1.9
***************
*** 37,45 ****
  	, m_priority( 0)
  	, m_respPointer( resp_ptr)
! { 
! 	m_fcoInitialList.clear();
! 	m_fcoFinalList.clear();
! 	m_partsMap.clear();
  
  	if (m_respPointer == BON::FCO()) 
  	{
--- 37,47 ----
  	, m_priority( 0)
  	, m_respPointer( resp_ptr)
! 	, m_fcoInitialList()
! 	, m_roleInitialList()
! 	, m_fcoFinalList()
! 	, m_roleFinalList()
! 	, m_partsMap()
  
+ { 
  	if (m_respPointer == BON::FCO()) 
  	{
***************
*** 53,57 ****
--- 55,61 ----
  {
  	m_fcoInitialList.clear();
+ 	m_roleInitialList.clear();
  	m_fcoFinalList.clear();
+ 	m_roleFinalList.clear();
  	m_partsMap.clear();
  }
***************
*** 172,176 ****
  void AspectRep::extendAspectWithDescendants()
  {
! 	std::string an = getName();
  	std::vector<FCO*>::iterator init_it = m_fcoInitialList.begin();
  	for( ; init_it != m_fcoInitialList.end(); ++init_it)
--- 176,203 ----
  void AspectRep::extendAspectWithDescendants()
  {
! 	// 1st scenario
! 	// expand aspect membership ( if FCOA is selected to appear in AspA)
! 	// M1<>---------FCOA -set_member----AspA
! 	//               |
! 	//              /^\
! 	//          FCOB   FCOC
! 	//
! 	// if FCOA is member of AspA aspect, then FCOB and FCOC is also a member of AspA
! 	//  
! 	//
! 	// 2nd scenario
! 	// in case when only a role (of FCOA in a model) is specified as part of an aspect 
! 	// that role should be extended for FCOB and FCOC as well and for the model
! 	// descendants inherited from the model. I.e.
! 	//
! 	// AspA-----<>M1<>-------FCOA
! 	//            |
! 	//           /^\
! 	//         M2   M3
! 	//           
! 	//
! 	// if the role between M1--FCOA is specified as an aspect member then M2,M3 in AspA should show
! 	// FCOA and its descendants
! 
  	std::vector<FCO*>::iterator init_it = m_fcoInitialList.begin();
  	for( ; init_it != m_fcoInitialList.end(); ++init_it)
***************
*** 188,191 ****
--- 215,219 ----
  	}
  
+ 	// a task similar to ModelRep::inherit needs to be done
  	std::vector< RoleRep>::iterator r_init_it = m_roleInitialList.begin();
  	for( ; r_init_it != m_roleInitialList.end(); ++r_init_it)
***************
*** 195,212 ****
  		fco_ptr->getIntDescendants( children);
  		children.push_back( fco_ptr);
  		for( unsigned int i = 0; i < children.size(); ++i)
  		{
! 			RoleRep r(
! 				r_init_it->getOnlyRoleName(),
! 				children[i],
! 				r_init_it->getModelRepPtr(),
! 				r_init_it->isPort(),
! 				r_init_it->getCardinality(),
! 				r_init_it->isInheritedRole(), // true <!>
! 				r_init_it->isLongForm()
! 				);
! 			if ( m_roleFinalList.end() == // not found
! 				std::find( m_roleFinalList.begin(), m_roleFinalList.end(), r)) 
! 				m_roleFinalList.push_back( r);
  		}
  	}
--- 223,253 ----
  		fco_ptr->getIntDescendants( children);
  		children.push_back( fco_ptr);
+ 
+ 		ModelRep* model_ptr = r_init_it->getModelRepPtr();
+ 		std::vector<FCO*> model_descendants;
+ 		model_ptr->getImpDescendants( model_descendants);
+ 		model_descendants.push_back( model_ptr);
+ 
  		for( unsigned int i = 0; i < children.size(); ++i)
  		{
! 			for( unsigned int j = 0; j < model_descendants.size(); ++j)
! 			{
! 				ModelRep * model_desc = dynamic_cast<ModelRep *>(model_descendants[j]);
! 				if (!model_desc) global_vars.err << "Error: model descendant badly casted to model\n";
! 
! 				RoleRep r(
! 					r_init_it->getOnlyRoleName(),
! 					children[i],
! 					model_desc,
! 					r_init_it->isPort(),
! 					r_init_it->getCardinality(),
! 					j + 1 == model_descendants.size(),//r_init_it->isInheritedRole(),
! 					r_init_it->isLongForm()
! 					);
! 
! 				if ( m_roleFinalList.end() == // not found
! 					std::find( m_roleFinalList.begin(), m_roleFinalList.end(), r)) 
! 					m_roleFinalList.push_back( r);
! 			}
  		}
  	}

Index: AspectRep.h
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Rep/AspectRep.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** AspectRep.h	14 May 2004 00:51:34 -0000	1.6
--- AspectRep.h	16 Jun 2004 18:56:52 -0000	1.7
***************
*** 68,86 ****
  	static const std::string m_aspectMetaRefsRoot;
  protected:
  	/**
  	 * inital and final list of FCO-s intended to be part of the Aspect
  	 *
  	 */
! 	std::vector<FCO*>	m_fcoInitialList;
! 	std::vector<FCO*>	m_fcoFinalList;
! 	std::vector<RoleRep> m_roleInitialList;
! 	std::vector<RoleRep> m_roleFinalList;
  
! 	// this int is set if contains non-zero value
! 	// and if one of the aspects contains non-zero value it means that the aspects are
! 	// sorted based on this
! 	int m_priority;
! 	
! 	ModelPartsMap m_partsMap;
  
  	/**
--- 68,86 ----
  	static const std::string m_aspectMetaRefsRoot;
  protected:
+ 	// this int is set if contains non-zero value
+ 	// and if one of the aspects contains non-zero value it means that the aspects are
+ 	// sorted based on this
+ 	int		m_priority;
+ 	
  	/**
  	 * inital and final list of FCO-s intended to be part of the Aspect
  	 *
  	 */
! 	std::vector<FCO*>		m_fcoInitialList;
! 	std::vector<RoleRep>	m_roleInitialList;
! 	std::vector<FCO*>		m_fcoFinalList;
! 	std::vector<RoleRep>	m_roleFinalList;
  
! 	ModelPartsMap			m_partsMap;
  
  	/**

Index: Dumper.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Rep/Dumper.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** Dumper.cpp	14 May 2004 00:51:34 -0000	1.17
--- Dumper.cpp	16 Jun 2004 18:56:52 -0000	1.18
***************
*** 134,137 ****
--- 134,149 ----
  	//
  	// if FCOA is member of AspA aspect, then FCOB and FCOC is also a member of AspA
+ 	//
+ 	// in case when only a role (of FCOA in a model) is specified as part of an aspect 
+ 	// that role should be extended for FCOB and FCOC as well and for the model
+ 	// descendants inherited from the model. I.e.
+ 	//
+ 	// AspA-----<>M1<>-------FCOA
+ 	//            /\
+ 	//            |
+ 	//            M2
+ 	//
+ 	// if the role between M1--FCOA is specified as an aspect member then M2 in AspA should show
+ 	// FCOA?
  
  	// task 1
***************
*** 352,356 ****
  				if ( part.getFCOPtr()->getMyKind() == Any::REF)
  				{
! 					const ReferenceRep * ref_ptr = static_cast<const ReferenceRep *>( part.getFCOPtr());
  					std::string nn = ref_ptr->getName();
  					if (ref_ptr->pointsToModels()) is_ref_to_model = true;
--- 364,368 ----
  				if ( part.getFCOPtr()->getMyKind() == Any::REF)
  				{
! 					const ReferenceRep * ref_ptr = dynamic_cast<const ReferenceRep *>( part.getFCOPtr());
  					std::string nn = ref_ptr->getName();
  					if (ref_ptr->pointsToModels()) is_ref_to_model = true;
***************
*** 399,403 ****
  				else if ( is_model)
  				{
! 					const ModelRep * sub_model = static_cast<const ModelRep*>( part.getFCOPtr());
  					int sub_model_no_of_aspects = sub_model->howManyAspects();
  					if ( sub_model_no_of_aspects <= 1) // no more than one aspect
--- 411,415 ----
  				else if ( is_model)
  				{
! 					const ModelRep * sub_model = dynamic_cast<const ModelRep*>( part.getFCOPtr());
  					int sub_model_no_of_aspects = sub_model->howManyAspects();
  					if ( sub_model_no_of_aspects <= 1) // no more than one aspect
***************
*** 419,423 ****
  				else if ( is_ref_to_model)
  				{
! 					const ReferenceRep * reference = static_cast<const ReferenceRep*>( part.getFCOPtr());
  					std::vector< AspectRep *> asp_intersect = reference->getAspectsIntersection();
  					if ( asp_intersect.size() == 1)
--- 431,435 ----
  				else if ( is_ref_to_model)
  				{
! 					const ReferenceRep * reference = dynamic_cast<const ReferenceRep*>( part.getFCOPtr());
  					std::vector< AspectRep *> asp_intersect = reference->getAspectsIntersection();
  					if ( asp_intersect.size() == 1)
***************
*** 480,484 ****
  						if (is_ref_to_model) 
  						{
! 							const ReferenceRep * reference = static_cast<const ReferenceRep*>( part.getFCOPtr());
  							// calculating first the default_aspect_value
  							// does it have the asp_name aspect?
--- 492,496 ----
  						if (is_ref_to_model) 
  						{
! 							const ReferenceRep * reference = dynamic_cast<const ReferenceRep*>( part.getFCOPtr());
  							// calculating first the default_aspect_value
  							// does it have the asp_name aspect?
***************
*** 504,508 ****
  						else // model
  						{
! 							const ModelRep * sub_model = static_cast<const ModelRep*>( part.getFCOPtr());
  
  							// calculating first the default_aspect_value
--- 516,520 ----
  						else // model
  						{
! 							const ModelRep * sub_model = dynamic_cast<const ModelRep*>( part.getFCOPtr());
  
  							// calculating first the default_aspect_value
***************
*** 549,553 ****
  								if ( is_ref_to_model)
  								{
! 									const ReferenceRep * reference = static_cast<const ReferenceRep*>( part.getFCOPtr());
  
  									// checking the registry value
--- 561,565 ----
  								if ( is_ref_to_model)
  								{
! 									const ReferenceRep * reference = dynamic_cast<const ReferenceRep*>( part.getFCOPtr());
  
  									// checking the registry value
***************
*** 573,577 ****
  								else // if ( is_model)
  								{
! 									const ModelRep * sub_model = static_cast<const ModelRep*>( part.getFCOPtr());
  
  									AspectRep * ar = sub_model->getMyFirstAspectFromSet( same_aspects_on_sheet);
--- 585,589 ----
  								else // if ( is_model)
  								{
! 									const ModelRep * sub_model = dynamic_cast<const ModelRep*>( part.getFCOPtr());
  
  									AspectRep * ar = sub_model->getMyFirstAspectFromSet( same_aspects_on_sheet);
***************
*** 753,759 ****
  	{
  		(*it_m)->createConstraints( this);
- 		if ((*it_m)->getName() == "FaultMgmt")
- 		{
- 		}
  	}
  
--- 765,768 ----
***************
*** 1275,1284 ****
  		for( ; i != ch.end(); ++i)
  		{
! 			std::string one_aspect( (*i)->getPath()); // = (*i)->getName()); //<!> bug needs to be corrected 
! 			{ // instead of getName
! 				int last_slash = one_aspect.rfind("/");
! 				if ( last_slash != std::string::npos && last_slash + 1 < one_aspect.length())
! 					one_aspect = one_aspect.substr( last_slash + 1);
! 			}
  
  			int val = (*i)->getIntegerValue();
--- 1284,1288 ----
  		for( ; i != ch.end(); ++i)
  		{
! 			std::string one_aspect( (*i)->getName()); // previously getPath used
  
  			int val = (*i)->getIntegerValue();

Index: ModelRep.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Rep/ModelRep.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** ModelRep.cpp	14 May 2004 00:51:34 -0000	1.11
--- ModelRep.cpp	16 Jun 2004 18:56:52 -0000	1.12
***************
*** 112,116 ****
  		if ( ptr->getMyKind() == Any::MODEL)
  		{
! 			ModelRep * mod_ptr = static_cast< ModelRep *> ( ptr);
  			models.push_back( mod_ptr);
  		}
--- 112,116 ----
  		if ( ptr->getMyKind() == Any::MODEL)
  		{
! 			ModelRep * mod_ptr = dynamic_cast< ModelRep *> ( ptr);
  			models.push_back( mod_ptr);
  		}
***************
*** 177,181 ****
  		if ( ptr->getMyKind() == Any::MODEL)
  		{
! 			ModelRep * mod_ptr = static_cast< ModelRep *> ( ptr);
  			models.push_back( mod_ptr);
  		}
--- 177,181 ----
  		if ( ptr->getMyKind() == Any::MODEL)
  		{
! 			ModelRep * mod_ptr = dynamic_cast< ModelRep *> ( ptr);
  			models.push_back( mod_ptr);
  		}
***************
*** 195,199 ****
  		if ( ptr->getMyKind() == Any::REF)
  		{
! 			ReferenceRep * ref_ptr = static_cast< ReferenceRep *> ( ptr);
  			if ( ref_ptr->pointsToModels())
  				refs.push_back( ref_ptr);
--- 195,199 ----
  		if ( ptr->getMyKind() == Any::REF)
  		{
! 			ReferenceRep * ref_ptr = dynamic_cast< ReferenceRep *> ( ptr);
  			if ( ref_ptr->pointsToModels())
  				refs.push_back( ref_ptr);
***************
*** 222,231 ****
  void ModelRep::inherit()
  {
- 	//temp
- 	std::string m_name;
- 	std::string f_name;
- 	//temp
- 	
- 	RoleMap temp_map;
  	std::vector<FCO*> model_descendants;
  	this->getImpDescendants( model_descendants);
--- 222,225 ----
***************
*** 238,244 ****
  		if ( (*model_it)->getMyKind() != Any::MODEL)
  			global_vars.err << "Error: nonmodel kind as model descendant\n";
! 		ModelRep * mod_desc_ptr = static_cast<ModelRep*>(*model_it);
  		if (!mod_desc_ptr) global_vars.err << "Error: model descendant badly casted to model\n";
- 		m_name = mod_desc_ptr->getName();
  					
  		RoleMap_Iterator fco_it( m_initialRoleMap.begin());
--- 232,237 ----
  		if ( (*model_it)->getMyKind() != Any::MODEL)
  			global_vars.err << "Error: nonmodel kind as model descendant\n";
! 		ModelRep * mod_desc_ptr = dynamic_cast<ModelRep*>(*model_it);
  		if (!mod_desc_ptr) global_vars.err << "Error: model descendant badly casted to model\n";
  					
  		RoleMap_Iterator fco_it( m_initialRoleMap.begin());
***************
*** 263,268 ****
  				for( ; desc_it != children.end(); ++desc_it)
  				{
- 					f_name = (*desc_it)->getName();
- 
  					// the descendants must have a separate role for each initial role
  					// this role is inherited and has long form depending on the hierarchy_flag
--- 256,259 ----
***************
*** 598,602 ****
  				if ( part_it->getFCOPtr()->getMyKind() == Any::REF)
  				{
! 					const ReferenceRep * ref_ptr = static_cast<const ReferenceRep *>( part_it->getFCOPtr());
  					is_ref_to_model = ref_ptr->pointsToModels();
  				}
--- 589,593 ----
  				if ( part_it->getFCOPtr()->getMyKind() == Any::REF)
  				{
! 					const ReferenceRep * ref_ptr = dynamic_cast<const ReferenceRep *>( part_it->getFCOPtr());
  					is_ref_to_model = ref_ptr->pointsToModels();
  				}

Index: ReferenceRep.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Rep/ReferenceRep.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** ReferenceRep.cpp	26 Apr 2004 17:13:38 -0000	1.9
--- ReferenceRep.cpp	16 Jun 2004 18:56:52 -0000	1.10
***************
*** 131,135 ****
  		if ( m_allReferees[i]->getMyKind() == Any::MODEL && !m_allReferees[i]->isAbstract())
  		{
! 			const ModelRep * c_m = static_cast<const ModelRep*>( m_allReferees[i]);
  			if ( std::find( models.begin(), models.end(), c_m) == models.end())
  				models.push_back( c_m);
--- 131,135 ----
  		if ( m_allReferees[i]->getMyKind() == Any::MODEL && !m_allReferees[i]->isAbstract())
  		{
! 			const ModelRep * c_m = dynamic_cast<const ModelRep*>( m_allReferees[i]);
  			if ( std::find( models.begin(), models.end(), c_m) == models.end())
  				models.push_back( c_m);
***************
*** 172,176 ****
  		}
  
! 		return static_cast<const ModelRep*>( m_allReferees[i]);
  	}
  }*/
--- 172,176 ----
  		}
  
! 		return dynamic_cast<const ModelRep*>( m_allReferees[i]);
  	}
  }*/
***************
*** 224,228 ****
  			else
  			{
! 				ReferenceRep* one_refnce = static_cast<ReferenceRep *>(*refnce_it);
  				one_refnce->addFinalReferees( target_ptr); // put at first place the original referee
  				one_refnce->addFinalReferees( refree_descendants); // adding all the interface desc of target_ptr
--- 224,228 ----
  			else
  			{
! 				ReferenceRep* one_refnce = dynamic_cast<ReferenceRep *>(*refnce_it);
  				one_refnce->addFinalReferees( target_ptr); // put at first place the original referee
  				one_refnce->addFinalReferees( refree_descendants); // adding all the interface desc of target_ptr
***************
*** 258,262 ****
  		else if ( all_referees[current]->getMyKind() == Any::REF)
  		{
! 			ReferenceRep * r = static_cast<ReferenceRep *>( all_referees[current]);
  			// get all referees
  			const RefereeList &list = r->getFinalReferees();
--- 258,262 ----
  		else if ( all_referees[current]->getMyKind() == Any::REF)
  		{
! 			ReferenceRep * r = dynamic_cast<ReferenceRep *>( all_referees[current]);
  			// get all referees
  			const RefereeList &list = r->getFinalReferees();

Index: SetRep.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Rep/SetRep.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** SetRep.cpp	11 Mar 2004 15:39:38 -0000	1.4
--- SetRep.cpp	16 Jun 2004 18:56:52 -0000	1.5
***************
*** 112,116 ****
  							else
  							{
! 								SetRep* one_set = static_cast<SetRep *>(*sets_iterator);
  								std::string set_nm = one_set->getName();
  								// add the roles to the member list of the set ( in that model) 
--- 112,116 ----
  							else
  							{
! 								SetRep* one_set = dynamic_cast<SetRep *>(*sets_iterator);
  								std::string set_nm = one_set->getName();
  								// add the roles to the member list of the set ( in that model) 



More information about the GME-commit mailing list