public void resetValues() { for (SelectableFeature feature : features) { feature.setManual(Selection.UNDEFINED); feature.setAutomatic(Selection.UNDEFINED); } update(false, null); }
public Set<String> getSelectedFeatureNames() { final Set<String> result = new HashSet<String>(); for (SelectableFeature feature : features) { if (feature.getSelection() == Selection.SELECTED) { result.add(feature.getName()); } } return result; }
public List<IFeature> getSelectedFeatures() { final List<IFeature> result = new ArrayList<IFeature>(); for (SelectableFeature feature : features) { if (feature.getSelection() == Selection.SELECTED) { result.add(feature.getFeature()); } } return result; }
public List<SelectableFeature> getManualFeatures() { final List<SelectableFeature> featureList = new LinkedList<SelectableFeature>(); for (SelectableFeature selectableFeature : features) { if (selectableFeature.getAutomatic() == Selection.UNDEFINED && !selectableFeature.getFeature().getStructure().hasHiddenParent()) { featureList.add(selectableFeature); } } return featureList; }
/** * Turns all automatic into manual values * * @param discardDeselected if {@code true} all automatic deselected features get undefined * instead of manual deselected */ public void makeManual(boolean discardDeselected) { for (SelectableFeature feature : features) { final Selection autoSelection = feature.getAutomatic(); if (autoSelection != Selection.UNDEFINED) { feature.setAutomatic(Selection.UNDEFINED); if (!discardDeselected || autoSelection == Selection.SELECTED) { feature.setManual(autoSelection); } } } }
private void initFeatures(SelectableFeature sFeature, IFeature feature) { if (sFeature != null && sFeature.getName() != null) { features.add(sFeature); table.put(sFeature.getName(), sFeature); for (IFeatureStructure child : feature.getStructure().getChildren()) { SelectableFeature sChild = new SelectableFeature(this, child.getFeature()); sFeature.addChild(sChild); initFeatures(sChild, child.getFeature()); } } }
@Override public String toString() { StringBuilder builder = new StringBuilder(); for (SelectableFeature feature : features) { if (feature.getSelection() == Selection.SELECTED && feature.getFeature().getStructure().isConcrete()) { builder.append(feature.getFeature().getName()); builder.append("\n"); } } return builder.toString(); }
/** * This method creates a clone of the given {@link Configuration} * * @param configuration The configuration to clone */ protected Configuration(Configuration configuration) { this.featureModel = configuration.featureModel; this.ignoreAbstractFeatures = configuration.ignoreAbstractFeatures; this.propagator = configuration.propagator.clone(this); propagate = false; this.root = initRoot(); for (SelectableFeature f : configuration.features) { setManual(f.getName(), f.getManual()); setAutomatic(f.getName(), f.getAutomatic()); } this.propagate = configuration.propagate; }
private SelectableFeature initRoot() { final IFeature featureRoot = FeatureUtils.getRoot(featureModel); final SelectableFeature root = new SelectableFeature(this, featureRoot); if (featureRoot != null) { initFeatures(root, featureRoot); } else { features.add(root); table.put(root.getName(), root); } return root; }
/** * Copy constructor. Copies the status of a given configuration. * * @param configuration * @param featureModel the underlying feature model. The model can be different from the old * configuration. * @param propagate */ public Configuration(Configuration configuration, IFeatureModel featureModel) { this.featureModel = featureModel; this.ignoreAbstractFeatures = configuration.ignoreAbstractFeatures; this.propagator = new ConfigurationPropagator(this); this.propagate = false; this.root = initRoot(); for (SelectableFeature f : configuration.features) { try { setManual(f.getName(), (f.getManual())); } catch (FeatureNotFoundException e) { } } loadPropagator(configuration.propagate); }
public void setManual(SelectableFeature feature, Selection selection) { feature.setManual(selection); update(false, null); }
void setAutomatic(SelectableFeature feature, Selection selection) { feature.setAutomatic(selection); }
void resetAutomaticValues() { for (SelectableFeature feature : features) { feature.setAutomatic(Selection.UNDEFINED); } }