-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
139 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,24 @@ | ||
from .fm_core_features import FMCoreFeatures, get_core_features | ||
from .fm_count_leafs import FMCountLeafs, count_leaf_features | ||
from .fm_leaf_features import FMLeafFeatures, get_leaf_features | ||
from .fm_average_branching_factor import FMAverageBranchingFactor, average_branching_factor | ||
from .fm_feature_ancestors import FMFeatureAncestors, get_feature_ancestors | ||
from .fm_max_depth_tree import FMMaxDepthTree, max_depth_tree | ||
from .fm_estimated_configurations_number import FMEstimatedConfigurationsNumber, \ | ||
count_configurations | ||
from .fm_atomic_sets import FMAtomicSets, get_atomic_sets | ||
from .fm_core_features import FMCoreFeatures | ||
from .fm_count_leafs import FMCountLeafs | ||
from .fm_leaf_features import FMLeafFeatures | ||
from .fm_average_branching_factor import FMAverageBranchingFactor | ||
from .fm_feature_ancestors import FMFeatureAncestors | ||
from .fm_max_depth_tree import FMMaxDepthTree | ||
from .fm_estimated_configurations_number import FMEstimatedConfigurationsNumber | ||
from .fm_atomic_sets import FMAtomicSets | ||
from .fm_metrics import FMMetrics | ||
from .fm_generate_random_attribute import GenerateRandomAttribute | ||
from .fm_variation_points import FMVariationPoints | ||
|
||
__all__ = ['FMCoreFeatures', 'get_core_features', | ||
'FMCountLeafs', 'count_leaf_features', | ||
'FMLeafFeatures', 'get_leaf_features', | ||
'FMAverageBranchingFactor', 'average_branching_factor', | ||
'FMFeatureAncestors', 'get_feature_ancestors', | ||
'FMMaxDepthTree', 'max_depth_tree', | ||
'count_configurations', | ||
'FMAtomicSets', 'get_atomic_sets', 'FMMetrics', | ||
'GenerateRandomAttribute', 'FMEstimatedConfigurationsNumber'] | ||
|
||
__all__ = ['FMCoreFeatures', | ||
'FMCountLeafs', | ||
'FMLeafFeatures', | ||
'FMAverageBranchingFactor', | ||
'FMFeatureAncestors', | ||
'FMMaxDepthTree', | ||
'FMAtomicSets', | ||
'FMMetrics', | ||
'GenerateRandomAttribute', | ||
'FMEstimatedConfigurationsNumber', | ||
'FMVariationPoints'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
flamapy/metamodels/fm_metamodel/operations/fm_variation_points.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from typing import cast | ||
|
||
from flamapy.core.models import VariabilityModel | ||
from flamapy.metamodels.fm_metamodel.operations.interfaces import VariationPoints | ||
from flamapy.metamodels.fm_metamodel.models import FeatureModel, Feature | ||
|
||
|
||
class FMVariationPoints(VariationPoints): | ||
|
||
def __init__(self) -> None: | ||
self.result: dict[Feature, list[Feature]] = {} | ||
|
||
def get_result(self) -> dict[Feature, list[Feature]]: | ||
return self.result | ||
|
||
def execute(self, model: VariabilityModel) -> 'FMVariationPoints': | ||
fm_model = cast(FeatureModel, model) | ||
self.result = variation_points(fm_model) | ||
return self | ||
|
||
def variation_points(self) -> dict[Feature, list[Feature]]: | ||
return self.get_result() | ||
|
||
|
||
def variation_points(feature_model: FeatureModel) -> dict[Feature, list[Feature]]: | ||
vps: dict[Feature, list[Feature]] = {} | ||
features = [feature_model.root] | ||
while features: | ||
feature = features.pop() | ||
variants = [] | ||
for relation in feature.get_relations(): | ||
if not relation.is_mandatory(): | ||
variants.extend(relation.children) | ||
if variants: | ||
vps[feature] = variants | ||
features.extend(feature.get_children()) | ||
return vps |
4 changes: 4 additions & 0 deletions
4
flamapy/metamodels/fm_metamodel/operations/interfaces/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from .variation_points import VariationPoints | ||
|
||
|
||
__all__ = ['VariationPoints'] |
21 changes: 21 additions & 0 deletions
21
flamapy/metamodels/fm_metamodel/operations/interfaces/variation_points.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from abc import abstractmethod | ||
|
||
from flamapy.core.operations import Operation | ||
|
||
from flamapy.metamodels.fm_metamodel.models import Feature | ||
|
||
|
||
class VariationPoints(Operation): | ||
"""The variation points of a feature model are those features that require to make a choice | ||
(i.e., select a variant). | ||
This operation returns the variation points and the variants of each variation point. | ||
""" | ||
|
||
@abstractmethod | ||
def __init__(self) -> None: | ||
pass | ||
|
||
@abstractmethod | ||
def variation_points(self) -> dict[Feature, list[Feature]]: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,4 +25,4 @@ | |
'XMLReader', | ||
'GlencoeReader', | ||
'GlencoeWriter', | ||
'ClaferWriter'] | ||
'ClaferWriter'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
flamapy-fw~=2.0.0 | ||
flamapy-fw~=2.0.1 | ||
uvlparser~=2.0.1 | ||
afmparser~=1.0.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ def read_requirements(file): | |
|
||
setuptools.setup( | ||
name="flamapy-fm", | ||
version="2.0.0", | ||
version="2.0.1", | ||
author="Flamapy", | ||
author_email="[email protected]", | ||
description="flamapy-fm is a plugin to Flamapy module", | ||
|