1414import java .util .function .Function ;
1515
1616public class FeatureModelBuilder {
17-
17+
1818 private FeatureModel fmInConstruction ;
1919
2020 private AbstractUVLElementFactory elementFactory ;
@@ -69,12 +69,13 @@ public Feature addFeature(String featureName, Group group) {
6969 public Feature addFeature (String featureName , Group group , Import featureOrigin ) {
7070 return addFeature (featureName , group , featureOrigin , FeatureType .BOOL );
7171 }
72-
73- public Feature addFeature (String featureName , Group group , Import featureOrigin , FeatureType type ) {
72+
73+ public Feature addFeature (String featureName , Group group , Import featureOrigin , FeatureType type ) {
7474 return addFeature (featureName , group , featureOrigin , type , Cardinality .getStandardFeatureCardinality ());
7575 }
7676
77- public Feature addFeature (String featureName , Group group , Import featureOrigin , FeatureType type , Cardinality cardinality ) {
77+ public Feature addFeature (String featureName , Group group , Import featureOrigin , FeatureType type ,
78+ Cardinality cardinality ) {
7879 Feature feature = elementFactory .createFeature (featureName );
7980 feature .setRelatedImport (featureOrigin );
8081 feature .setFeatureType (type );
@@ -103,9 +104,11 @@ public void addAttribute(Feature feature, Attribute<?> attribute) {
103104
104105 /**
105106 * Renames a feature and propagates the change through the mdoel
107+ *
106108 * @param oldName current name of feature to be renamed in the model
107109 * @param newName target name
108- * @return indicator whether oldName successfully changed in the feature model; fails if oldName is not present
110+ * @return indicator whether oldName successfully changed in the feature model;
111+ * fails if oldName is not present
109112 */
110113 public boolean renameFeature (String oldName , String newName ) {
111114 Map <String , Feature > featureMap = fmInConstruction .getFeatureMap ();
@@ -141,6 +144,7 @@ public void renameAttributeGlobally(String oldName, String newName) {
141144 crawlConstraintsToRenameGlobalAttribute (constraint , oldName , newName );
142145 }
143146 }
147+
144148 private void crawlConstraintsToRenameGlobalAttribute (Constraint constraint , String attributeName , String replace ) {
145149 if (constraint instanceof ExpressionConstraint ) {
146150 for (Expression exp : ((ExpressionConstraint ) constraint ).getExpressionSubParts ()) {
@@ -158,7 +162,8 @@ private void crawlExpressionsToRenameGlobalAttribute(Expression expression, Stri
158162 AggregateFunctionExpression aggregateFunctionExpression = (AggregateFunctionExpression ) expression ;
159163 if (aggregateFunctionExpression .getAttribute ().getIdentifier ().equals (attributeName )) {
160164 aggregateFunctionExpression .getAttribute ().renameGlobalAttribute (replace );
161- };
165+ }
166+ ;
162167 } else {
163168 for (Expression exp : expression .getExpressionSubParts ()) {
164169 crawlExpressionsToRenameGlobalAttribute (exp , attributeName , replace );
@@ -167,15 +172,16 @@ private void crawlExpressionsToRenameGlobalAttribute(Expression expression, Stri
167172 }
168173
169174 public void addConstraint (Constraint constraint ) {
170- fmInConstruction .getOwnConstraints ().add (0 ,constraint );
175+ fmInConstruction .getOwnConstraints ().add (0 , constraint );
171176 }
172177
173178 public void addConstraintAtPosition (Constraint constraint , int position ) {
174- fmInConstruction .getOwnConstraints ().add (position ,constraint );
179+ fmInConstruction .getOwnConstraints ().add (position , constraint );
175180 }
176181
177182 public boolean doesFeatureModelSatisfyLanguageLevels (Set <LanguageLevel > languageLevelsToSatisfy ) {
178- return fmInConstruction .isExplicitLanguageLevels () && !fmInConstruction .getUsedLanguageLevels ().equals (languageLevelsToSatisfy );
183+ return fmInConstruction .isExplicitLanguageLevels ()
184+ && !fmInConstruction .getUsedLanguageLevels ().equals (languageLevelsToSatisfy );
179185 }
180186
181187 public FeatureModel getFeatureModel () {
0 commit comments