Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Static Private Member Functions

de.fraunhofer.isst.axbench.operations.transformer.ElementCleaner Class Reference

Cleans the element. More...

List of all members.

Public Types

enum  CleanOp { ALL, OPT, XOR }
 

possible cleaning operations.

More...

Public Member Functions

void cleanElement (IAXLangElement axlToClean, CleanOp theCleanOp)
 the main operation; cleans an element according to the selected cleaning operations
 ElementCleaner ()
 Constructor setting the operation parameters.

Static Public Attributes

static final String ID_IN_CLEANOP = "cleanoperation"
 identifier of the clean operation to perform
static final String ID_IN_ELEMENT_TOCLEAN = "axltoclean"
 identifier of the element to clean
static final String ID_OUT_ELEMENT = "axlcleaned"
 identifier of the cleaned element

Protected Member Functions

Map< String, Object > executeConcreteOperation (Map< String, Object > theInputParameters)
 Cleans the model with the selected operation.

Static Private Member Functions

static void cleanOptionalElements (IAXLangElement theParent)
 Cleans parent element and all children of not selected optional elements.
static void cleanXORElements (IAXLangElement theParent)
 Cleans parent element and all children of XOR elements.
static void cleanXORService (Function theXORService)
 Cleans one XOR service.
static void cleanXORSubComponent (SubComponent theXORSubComponent)
 Cleans one XOR subcomponent.
static void collectAndCleanXORElements (IAXLangElement theParent)
 Collects and cleans XOR subelements to clean, i.e. replaces them with their only alternative.
static Collection
< ElementWithRole
collectOptionalElementsToRemove (IAXLangElement theParent)
 Collects optional elements to remove.
static Collection
< ElementWithRole
collectXORElementsToRemove (IAXLangElement theElement, Class<?extends IAXLangElement > theXORClass, Role theSubRole)
 Collects XOR subelements to remove.
static Collection
< ElementWithRole
collectXORElementsToRemove (IAXLangElement theParent)
 Collects XOR subelements to remove.
static void deleteNotSelectedElements (Collection< ElementWithRole > cllToDelete)
 Deletes the given elements.
static void removeNotReferencedComponentTypes (IAXLangElement theParent)
 Cleans one XOR hwsubcomponent.

Detailed Description

Cleans the element.

This converter does the cleaning step for elements.

Cleaning includes:

Elements are processed only if their binding time is "design time" (BindingTime#DESIGNTIME)

Todo:

remove F2* links that point to mandatory elements

process optional elements

remove not used elements (not connected)

remove models? (e.g. empty ones, including referenced models)

remove not connected ports?

Todo:
consider binding time from mapping, therefore new input parameter for mapping
Bug:
During removal of optional elements the dependency has to be considered. At the moment, elements are removed that should reside in the model.
Author:
ekleinod
nschult
Version:
0.9.0
Since:
0.6.0

Member Enumeration Documentation

possible cleaning operations.

Enumerator:
ALL 
OPT 
XOR 

Constructor & Destructor Documentation

de.fraunhofer.isst.axbench.operations.transformer.ElementCleaner.ElementCleaner (  ) 

Constructor setting the operation parameters.

Element input parameters:

  • model to resolve Element output parameters:
  • resolved model

Member Function Documentation

void de.fraunhofer.isst.axbench.operations.transformer.ElementCleaner.cleanElement ( IAXLangElement  axlToClean,
CleanOp  theCleanOp 
)

the main operation; cleans an element according to the selected cleaning operations

Parameters:
axlToClean the aXLang-element that is to be cleaned
theCleanOp the operation that is to be performed (CleanOp.ALL or CleanOp.XOR)
static void de.fraunhofer.isst.axbench.operations.transformer.ElementCleaner.cleanOptionalElements ( IAXLangElement  theParent  )  [static, private]

Cleans parent element and all children of not selected optional elements.

Parameters:
theParent parent element to clean
static void de.fraunhofer.isst.axbench.operations.transformer.ElementCleaner.cleanXORElements ( IAXLangElement  theParent  )  [static, private]

Cleans parent element and all children of XOR elements.

  1. remove not selected XOR choices if one choice was selected
  2. remove XOR container if only one choice remains

XOR elements to consider are described in collectElementsToRemove(IAXLangElement)

Parameters:
theParent parent element to clean
static void de.fraunhofer.isst.axbench.operations.transformer.ElementCleaner.cleanXORService ( Function  theXORService  )  [static, private]

Cleans one XOR service.

  1. add the children of the chosen alternative to the XOR service
  2. set body
  3. unset the isXOR attribute
  4. rewire paths ?needed?
  5. remove the alternative
Todo:
Check if rewire paths is needed
Parameters:
theXORService the XOR service that is to be to cleaned
static void de.fraunhofer.isst.axbench.operations.transformer.ElementCleaner.cleanXORSubComponent ( SubComponent  theXORSubComponent  )  [static, private]

Cleans one XOR subcomponent.

  1. convert component type of subcomponent
  2. rewire connections
    1. if source or target subcomponent is XOR subcomponent, replace corresponding port with port of new component type
  3. rewire paths
    1. f2p-link
      1. if next to last element of path is single subcomponent, delete next to last path element
    2. f2sc-link
      1. if last element of path is single subcomponent, delete last path element
    3. p2p-link
    4. sc2sc-link
Parameters:
theXORSubComponent XOR subcomponent to clean
static void de.fraunhofer.isst.axbench.operations.transformer.ElementCleaner.collectAndCleanXORElements ( IAXLangElement  theParent  )  [static, private]

Collects and cleans XOR subelements to clean, i.e. replaces them with their only alternative.

XOR elements to consider are:

  • subcomponents
  • services
Parameters:
theParent parent element
static Collection<ElementWithRole> de.fraunhofer.isst.axbench.operations.transformer.ElementCleaner.collectOptionalElementsToRemove ( IAXLangElement  theParent  )  [static, private]

Collects optional elements to remove.

Parameters:
theParent parent element
Returns:
collection of elements to remove with their role
static Collection<ElementWithRole> de.fraunhofer.isst.axbench.operations.transformer.ElementCleaner.collectXORElementsToRemove ( IAXLangElement  theElement,
Class<?extends IAXLangElement theXORClass,
Role  theSubRole 
) [static, private]

Collects XOR subelements to remove.

  1. XOR content with chosen element
    • first we look if one variant was chosen
    • if so, the other variants are removed
Parameters:
theElement possible XOR element
theXORClass possible XOR class
theSubRole subelement role
Returns:
collection of elements to remove with their role
static Collection<ElementWithRole> de.fraunhofer.isst.axbench.operations.transformer.ElementCleaner.collectXORElementsToRemove ( IAXLangElement  theParent  )  [static, private]

Collects XOR subelements to remove.

  1. remove not selected XOR choices if one choice was selected

XOR elements to consider are:

  • components
  • services
Parameters:
theParent parent element
Returns:
collection of elements to remove with their role
static void de.fraunhofer.isst.axbench.operations.transformer.ElementCleaner.deleteNotSelectedElements ( Collection< ElementWithRole cllToDelete  )  [static, private]

Deletes the given elements.

Parameters:
cllToDelete elements to delete
Map<String, Object> de.fraunhofer.isst.axbench.operations.transformer.ElementCleaner.executeConcreteOperation ( Map< String, Object >  theInputParameters  )  [protected]

Cleans the model with the selected operation.

Bug:
The source model is changed instead of a copy/clone.
Parameters:
theInputParameters map of the input parameters (empty map or null allowed)
Returns:
map of the output parameters (empty map allowed)

Reimplemented from de.fraunhofer.isst.axbench.api.operations.AbstractAXLOperation.

static void de.fraunhofer.isst.axbench.operations.transformer.ElementCleaner.removeNotReferencedComponentTypes ( IAXLangElement  theParent  )  [static, private]

Cleans one XOR hwsubcomponent.

  1. convert hwcomponent type of hwsubcomponent
  2. rewire hwconnections
    1. if source or target hwsubcomponent is XOR subcomponent, replace corresponding port with port of new hwcomponent type
  3. rewire paths
    1. f2hwp-link
      1. if next to last element of path is single subcomponent, delete next to last path element
    2. f2hwsc-link
      1. if last element of path is single subcomponent, delete last path element
    3. p2p-link
    4. sc2sc-link
Parameters:
theXORSubComponent XOR subcomponent to clean Removes component types without reference (except top component and clock). -# collect all component types

  1. remove used component types, clock, top component
  2. delete remaining component types
Remarks:
Two-step deletion because of errors if an element of the loop is deleted.
Parameters:
theParent parent element to clean

Member Data Documentation

identifier of the clean operation to perform

identifier of the element to clean

identifier of the cleaned element