AutomatingFeature-OrientedDomainAnalysis笔记

  • 格式:docx
  • 大小:78.19 KB
  • 文档页数:4

Automating Feature-Oriented Domain Analysis 在领域分析中,特征建模是常用来捕捉一个领域中系统的共性和变化性。


征模型的输出将有一些可复用资产(构件、模式、领域语言,等等。

)能够提供给应用工程。

但当前实践缺乏一个自动生成的方法从特征模型到可复用资产。

本文提出了一种算法对面向特征的领域分析进行自动化分析,用实例说明在创建特征模型中如何应用该算法。

figure 1: Leature Diagram Represcutalion
假设每个特征节点用以下数据结构表示:
struct Feature Node{
String feature n ame;
en um{XOR,OR,AND}feature-relatio n;
/*deno tes the father-child relati on*/
ChildC onnection List *edges;
/*list of conn ecti ons associated with its child-feature no des*/ }
struct ChildC onn ecti on List{
bool isMa ndatory;
/*isama ndatory/opti on alfeature*/
Feature Node *a Feature;
/*point to a feature no de*/
}
以下是伪码的算法。

输入参数是特征图的根节点指针,输出是特征图中的所有特Ct Q304
F
QfhBj Feafjte E<ir Cl1Ajtersjti^a Feanrf Cr FiahiTfr
Figure 2 Misturc of Feature
Rq)resenhuon
征。

Result *processFeatureDiagram(
FeatureNode *no de-root)
{
create a temp1:Feature In sta nce with only no de-root in it;
create a temp2:Result with only one
Feature In sta nce temp1 in it;
if(no de-root has no child no des)
the n return temp2;
else
if(no de-root->feature-relatio n==AND)
{
recursively call processFeatureDiagram
over each of node-root ' child-nodes,
each retur ning a child result;
if corresponding child node is “ Optional ”,
add an empty Feature In sta nce into the corresp onding child result;
calculate the producti on of all the retur ned child results as temp3:Result;
retur ntheproducti ono ftemp2a nd
temp3;
}
else
if(no de-root->feature-relati on==XOR)
{
recursively call processFeatureDiagram
over each of node-root ' child-nodes,
each retur ning a child result;
calculate the union of those retur ned
childresultsastemp3:Result;
if there is a child node that is
“ Optional ”,
add an empty Feature In sta nee into temp3;
return temp3;
}
else
if(no de-root->feature-relatio n==OR)
{
recursively call processFeatureDiagram
over each of node-root ' child-nodes,
each retur ning a child result;
for each of the child result retur ned in the above call,
add an empty Feature In sta nce into it;
get the producti on of all the child results a stemp3:Result;
If all child features are man datory,
remove the empty Feature In sta nce from temp3;
retur n the producti on of temp2 and temp3;
}
}
Beware that a Result is actually a two-dimension data structure. If Result A has m Feature In sta nces while Result B has n FeatureI nsta nces, the n the union of A and B has m+n Feature In sta nces while the producti on of A and B has m*n Feature In sta nces. To exemplify the above algorithm, we use £to represent an empty Result,
x for product ion, U for union operatio n in Figures 5-7, which corresp ond to three types of cases for computing the set of feature instances. Also from Figure 7 we can easily see the size of feature set may grow exp onen tially (as to the extreme case where all feature-relati ons are OR , the size will be 2n, where n is the amount of leaf no des).
Here we put the non-leaf node (like F here) into the feature in sta nces in order to facilitate con stra int check in g. If one non-leaf feature F is supposed to be excluded
in the final feature in sta nee, the n its child-features should not be in eluded correspondingly, and we can eliminate those feature instanees from the final result by identifying which feature instanee contains feature F, rather than by tracking dow n all its child-features laboriously.
Figure Cnryiinr.^ AND rpiuk
x ( C2 u E)=(珈」冋

、--:■um
Fjgjre ti. C otiLp itLcLg XOk t esult Figure 7 Ud网mug OR r esult。