1 | package de.uka.ipd.sdq.pcm.transformations; |
2 | |
3 | import java.util.Iterator; |
4 | |
5 | import org.eclipse.emf.common.util.EList; |
6 | |
7 | import de.uka.ipd.sdq.featureconfig.ConfigNode; |
8 | import de.uka.ipd.sdq.featureconfig.ConfigState; |
9 | import de.uka.ipd.sdq.featureconfig.FeatureConfig; |
10 | import de.uka.ipd.sdq.featuremodel.Feature; |
11 | |
12 | public class FeatureUtils { |
13 | |
14 | public static boolean hasFeature(FeatureConfig featureConfig, String featureName) { |
15 | EList<ConfigNode> nodes = featureConfig.getConfignode(); |
16 | Iterator<ConfigNode> it = nodes.iterator(); |
17 | while (it.hasNext()){ |
18 | ConfigNode configNode = it.next(); |
19 | if ( ((Feature)configNode.getOrigin()).getName().equals(featureName)) { |
20 | return configNode.getConfigState() == ConfigState.SELECTED; |
21 | } |
22 | } |
23 | return false; |
24 | // throw new RuntimeException("Feature Configuration not found: "+featureName); |
25 | } |
26 | |
27 | } |