Exemple #1
0
 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());
     }
   }
 }
Exemple #2
0
  /**
   * 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;
  }
Exemple #3
0
 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;
 }
Exemple #4
0
  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;
  }
Exemple #5
0
  /**
   * 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);
  }