Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes

de.fraunhofer.isst.axbench.axlang.utilities.AXLangElementUtilities Class Reference

this class realizes some methods for operations which are performed on an axlang element. More...

List of all members.

Public Member Functions

boolean containsApplicationModel (File file)
 looks inside the content to find out if the file contains a feature model.
boolean containsFeatureModel (File file)
 looks inside the content to find out if the file contains a feature model.
boolean containsIncludedFiles (File file)
 looks inside the content to find out if the file contains a model.
boolean containsModel (File file)
 looks inside the content to find out if the file contains a model.
boolean containsResourceModel (File file)
 looks inside the content to find out if the file contains a feature model.
ArrayList< String > findIncludedTags (File axbenchfile)
 this method realizes the search for the included tags.
IAXLangElement findTheRightStartPoint (IAXLangElement possiblestart, Role myRole)
 searches for the right start point. can be used to have the correct start point for the handleComponentTypeReferenceConstraints method in this class.
ArrayList< IAXLangElementhandleComponentTypeReferenceConstraints (Role[] childroletosearch, IAXLangElement parentelement, Role mainrole, Role secondrole, IAXLangElement startpoint)
 this method searches for the forbidden component type references for a subcomponent.
void reloadOldDependedElementStates (IAXLangElement actualModel, IAXLangElement actualParent, ArrayList< IAXLangElement > oldDependedElements, IAXLangElement clonedModel)
 reloadOldDependedElementStates///
IAXLangElement searchForComponentOrXORSubComponent (IAXLangElement subcomponent, Class<?> modelclasstosearch, Class<?> elementclasstosearch, Role mainrole, Role subrole, Role referencerole)
 searches for a component or hw component. start point is a subcomponent inside a xor component. aim is to find the subcomponent which have the reference to the current xor component (which is has the ComponentType role). 1.find all components , which are not a xor component 2.check the component, if they have xor subcomponents. 3.check the subcomponents, if they have a reference to the currentxorcomponent.
IAXLangElement searchForElementClass (IAXLangElement element, Class<?> classtosearch, IAXLangElement alternative)
 searches for the defined class via the parent relation- start point is the given element.

Static Public Member Functions

static AXLangElementUtilities getInstance ()

Private Member Functions

 AXLangElementUtilities ()
boolean checkForElementError (IAXLangElement element)
 checks if the element has all valid reference, if not the element has or could have an error. e.g. f2p link, and the feature reference couldn't be found. PATH TOO
Collection< IAXLangElementfindAllValidElements (Class<?> theClass, IAXLangElement mainParent)
 finds all valid elements according the given class.
boolean handleSpecialSubComponentConstrain (IAXLangElement componenttypereference, IAXLangElement actualcomponent, Role mainrole, Role secondrole)
 entry point method for the recursive search.
void handleValidElementTypes1 (IAXLangElement theNewElementToCreate, IAXLangElement actualParent, IAXLangElement theActualElementForSearch, IAXLangElement theStartElement, IAXLangElement clonedModel)
 handles the valid element types. Recursive if its a ReferenceKind.CHILD. That means that e.g. a f2amapping will be created with all child mappings (f2p link...) recursively.
IAXLangElement searchForElementInsideModelViaUID (IAXLangElement model, String uid)
 searches for an axbench element inside a model via the uid.
IAXLangElement searchForElementViaUID (ArrayList< IAXLangElement > list, IAXLangElement element)
 searhces for an axbench element inside an arraylist of axbench elements via the uid or if its an instance path via the equal method.
boolean searchForTheComponenttypeReference (IAXLangElement componenttypereference, IAXLangElement actualcomponent, Role mainrole, Role secondrole)
 search for an also existing component type reference.

Private Attributes

ArrayList< IAXLangElementforbiddencomponentypereferences = null
 needed to investigate all forbidden reference for a subcomponent

Static Private Attributes

static AXLangElementUtilities axLangElementUtilities = null
static boolean debug = false
 to debug possible errors

Detailed Description

this class realizes some methods for operations which are performed on an axlang element.

Author:
skaegebein
Version:
0.8.0
Since:
0.8.0

Constructor & Destructor Documentation

de.fraunhofer.isst.axbench.axlang.utilities.AXLangElementUtilities.AXLangElementUtilities (  )  [private]

Member Function Documentation

boolean de.fraunhofer.isst.axbench.axlang.utilities.AXLangElementUtilities.checkForElementError ( IAXLangElement  element  )  [private]

checks if the element has all valid reference, if not the element has or could have an error. e.g. f2p link, and the feature reference couldn't be found. PATH TOO

Parameters:
element 
Returns:
boolean de.fraunhofer.isst.axbench.axlang.utilities.AXLangElementUtilities.containsApplicationModel ( File  file  ) 

looks inside the content to find out if the file contains a feature model.

Parameters:
file 
Returns:
boolean de.fraunhofer.isst.axbench.axlang.utilities.AXLangElementUtilities.containsFeatureModel ( File  file  ) 

looks inside the content to find out if the file contains a feature model.

Parameters:
file 
Returns:
boolean de.fraunhofer.isst.axbench.axlang.utilities.AXLangElementUtilities.containsIncludedFiles ( File  file  ) 

looks inside the content to find out if the file contains a model.

Parameters:
file 
Returns:
boolean de.fraunhofer.isst.axbench.axlang.utilities.AXLangElementUtilities.containsModel ( File  file  ) 

looks inside the content to find out if the file contains a model.

Parameters:
file 
Returns:
boolean de.fraunhofer.isst.axbench.axlang.utilities.AXLangElementUtilities.containsResourceModel ( File  file  ) 

looks inside the content to find out if the file contains a feature model.

Parameters:
file 
Returns:
Collection<IAXLangElement> de.fraunhofer.isst.axbench.axlang.utilities.AXLangElementUtilities.findAllValidElements ( Class<?>  theClass,
IAXLangElement  mainParent 
) [private]

finds all valid elements according the given class.

Parameters:
theClass 
mainParent 
Returns:
collection of valid elements or an empty collection.
ArrayList<String> de.fraunhofer.isst.axbench.axlang.utilities.AXLangElementUtilities.findIncludedTags ( File  axbenchfile  ) 

this method realizes the search for the included tags.

Parameters:
axbenchfile 
Returns:
IAXLangElement de.fraunhofer.isst.axbench.axlang.utilities.AXLangElementUtilities.findTheRightStartPoint ( IAXLangElement  possiblestart,
Role  myRole 
)

searches for the right start point. can be used to have the correct start point for the handleComponentTypeReferenceConstraints method in this class.

Parameters:
possiblestart 
the role to search - it's only for a COMPONENTTYPE or HWCOMPONENTTYPE reference useful.
Returns:
the start point
static AXLangElementUtilities de.fraunhofer.isst.axbench.axlang.utilities.AXLangElementUtilities.getInstance (  )  [static]
ArrayList<IAXLangElement> de.fraunhofer.isst.axbench.axlang.utilities.AXLangElementUtilities.handleComponentTypeReferenceConstraints ( Role[]  childroletosearch,
IAXLangElement  parentelement,
Role  mainrole,
Role  secondrole,
IAXLangElement  startpoint 
)

this method searches for the forbidden component type references for a subcomponent.

Parameters:
childroletosearch - e.g. COMPONENT or HWCOMPONENT
parentelement - e.g. the application model or the resource model
mainrole - e.g. SUBCOMPONENT or HWSUBCOMPONENT
secondrole - e.g. COMPONENTTYPE or HWCOMPONENTTYPE
startpoint - the start point has to be the COMPONENTTYPE of the subcomponent (the method findTheRightStartPoint in this class is useful)
Returns:
a list of all forbidden COMPONENTTYPEs for this sub component or an empty list.
boolean de.fraunhofer.isst.axbench.axlang.utilities.AXLangElementUtilities.handleSpecialSubComponentConstrain ( IAXLangElement  componenttypereference,
IAXLangElement  actualcomponent,
Role  mainrole,
Role  secondrole 
) [private]

entry point method for the recursive search.

Parameters:
componenttypereference 
actualcomponent 
mainrole - e.g COMPONENT, or HWCOMPONENT
secondrole - e.g. COMPONENTTYPE or HWCOMPONENTTYPE
Returns:
void de.fraunhofer.isst.axbench.axlang.utilities.AXLangElementUtilities.handleValidElementTypes1 ( IAXLangElement  theNewElementToCreate,
IAXLangElement  actualParent,
IAXLangElement  theActualElementForSearch,
IAXLangElement  theStartElement,
IAXLangElement  clonedModel 
) [private]

handles the valid element types. Recursive if its a ReferenceKind.CHILD. That means that e.g. a f2amapping will be created with all child mappings (f2p link...) recursively.

Parameters:
theNewElementToCreate - the new element that has to be created. (e.g. a configuration, a mapping, or a f2p link)
actualParent - the actual parent where the new element will be added
theActualElementForSearch - the actual element where the comparison is handled (always the actual model currently)
theStartElement - the start element which is the "same" element from the old model like the new one which will be created
clonedModel - the clonedModel where the start element comes from
void de.fraunhofer.isst.axbench.axlang.utilities.AXLangElementUtilities.reloadOldDependedElementStates ( IAXLangElement  actualModel,
IAXLangElement  actualParent,
ArrayList< IAXLangElement oldDependedElements,
IAXLangElement  clonedModel 
)

reloadOldDependedElementStates///

reloads all elements and their references. e.g. all mapping, and configurations, if the feature model was removed and new added. (needed for pv synchronization)

Parameters:
actualModel - should be always the actualModel ( the actual element for search)
actualParent - the actual parent, where the new element will be added
oldDependedElements - all elements from the old model which have to be rebuild
clonedModel - the cloned Model from the old model, before changes appears on the old model
IAXLangElement de.fraunhofer.isst.axbench.axlang.utilities.AXLangElementUtilities.searchForComponentOrXORSubComponent ( IAXLangElement  subcomponent,
Class<?>  modelclasstosearch,
Class<?>  elementclasstosearch,
Role  mainrole,
Role  subrole,
Role  referencerole 
)

searches for a component or hw component. start point is a subcomponent inside a xor component. aim is to find the subcomponent which have the reference to the current xor component (which is has the ComponentType role). 1.find all components , which are not a xor component 2.check the component, if they have xor subcomponents. 3.check the subcomponents, if they have a reference to the currentxorcomponent.

Parameters:
subcomponent - the start point
modelclasstosearch - ApplicationModel.class or ResourceModel.class
elementclasstosearch - XORComponent.class or HWXORComponent.class
mainrole - COMPONENT or HWCOMPONENT
subrole - SUBCOMPONENT or HWSUBCOMPONENT
referencerole - COMPONENTTYPE or HWCOMPONENTTYPE
Returns:
IAXLangElement de.fraunhofer.isst.axbench.axlang.utilities.AXLangElementUtilities.searchForElementClass ( IAXLangElement  element,
Class<?>  classtosearch,
IAXLangElement  alternative 
)

searches for the defined class via the parent relation- start point is the given element.

Parameters:
element - the start point
classtosearch - via parent relationship
alternative - if no parent was founded
Returns:
IAXLangElement de.fraunhofer.isst.axbench.axlang.utilities.AXLangElementUtilities.searchForElementInsideModelViaUID ( IAXLangElement  model,
String  uid 
) [private]

searches for an axbench element inside a model via the uid.

Parameters:
model 
uid 
Returns:
the element or null.
IAXLangElement de.fraunhofer.isst.axbench.axlang.utilities.AXLangElementUtilities.searchForElementViaUID ( ArrayList< IAXLangElement list,
IAXLangElement  element 
) [private]

searhces for an axbench element inside an arraylist of axbench elements via the uid or if its an instance path via the equal method.

Parameters:
list 
element 
Returns:
the element or null.
boolean de.fraunhofer.isst.axbench.axlang.utilities.AXLangElementUtilities.searchForTheComponenttypeReference ( IAXLangElement  componenttypereference,
IAXLangElement  actualcomponent,
Role  mainrole,
Role  secondrole 
) [private]

search for an also existing component type reference.

Parameters:
componenttypereference 
actualcomponent 
Returns:
Return values:
true - if the COMPONENTTYPE is forbidden
false - "" if not

Member Data Documentation

to debug possible errors

needed to investigate all forbidden reference for a subcomponent