//	private void generateConstraints(FAMAAttributedFeatureModel fm) {
 //		AttributedFeature root = fm.getRoot();
 //		r.addRoot(root);
 //		generateConstraints(root);
 //		Iterator<Constraint> it = fm.getConstraints().iterator();
 //		while (it.hasNext()) {
 //			Constraint dep = it.next();
 //			if (dep instanceof RequiresDependency){
 //				Dependency d = (Dependency)dep;
 //				r.addRequires(dep,d.getOrigin(),d.getDestination());
 //			}
 //			else if (dep instanceof ExcludesDependency){
 //				Dependency d = (Dependency)dep;
 //				r.addExcludes(dep,d.getOrigin(),d.getDestination());
 //			}
 //
 //		}
 //	}
 //
 private void generateConstraints(AttributedFeature f) {
   Iterator<Relation> relations = f.getRelations();
   while (relations.hasNext()) {
     Relation rel = relations.next();
     if (rel.getNumberOfDestination() == 1) {
       if (rel.isMandatory()) {
         r.addMandatory(rel, rel.getDestinationAt(0), f);
       } else if (rel.isOptional()) {
         r.addOptional(rel, rel.getDestinationAt(0), f);
       } else {
         r.addCardinality(rel, rel.getDestinationAt(0), f, rel.getCardinalities());
       }
       generateConstraints(rel.getDestinationAt(0));
     } else {
       Collection<GenericFeature> children = new ArrayList<GenericFeature>();
       Iterator<AttributedFeature> it = rel.getDestination();
       while (it.hasNext()) {
         AttributedFeature child = it.next();
         children.add(child);
         generateConstraints(child);
       }
       Collection<Cardinality> cards = new ArrayList<Cardinality>();
       Iterator<Cardinality> itc = rel.getCardinalities();
       while (itc.hasNext()) {
         cards.add(itc.next());
       }
       r.addSet(rel, f, children, cards);
     }
   }
 }
 public void transform(VariabilityModel vmodel, Reasoner reasoner) {
   r = (AttributedFeatureModelReasoner) reasoner;
   fm = (FAMAAttributedFeatureModel) vmodel;
   // TODO meter aqui el ConstantIntConverter
   ConstantIntConverter conv = fm.getConstantIntConverter();
   if (conv != null) {
     r.setConstantIntConverter(fm.getConstantIntConverter());
   }
   r.reset();
   setFeatureModel(fm);
 }
 /* (non-Javadoc)
  * @see tdg.SPL.Reasoner.Reasoner#setFeatureModel(es.us.isa.FAMA.featureModel.FeatureModel)
  */
 private void setFeatureModel(FAMAAttributedFeatureModel fm) {
   this.fm = fm;
   generateVariables(fm);
   AttributedFeature root = fm.getRoot();
   r.addRoot(root);
   generateConstraints(root);
   Iterator<Constraint> it = fm.getConstraints().iterator();
   while (it.hasNext()) {
     Constraint c = it.next();
     r.addConstraint(c);
   }
 }
 private void generateVariables(FAMAAttributedFeatureModel fm) {
   Iterator<AttributedFeature> it = fm.getAttributedFeatures().iterator();
   while (it.hasNext()) {
     AttributedFeature f = (AttributedFeature) it.next();
     Relation parentRelation = f.getParent();
     if (parentRelation != null
         && parentRelation.getNumberOfDestination() == 1
         && parentRelation.getCardinalities().hasNext()) {
       Iterator<Cardinality> itc = parentRelation.getCardinalities();
       Collection<Cardinality> cards = new ArrayList<Cardinality>();
       while (itc.hasNext()) cards.add(itc.next());
       r.addFeature(f, cards);
     } else {
       ArrayList<Cardinality> cards = new ArrayList<Cardinality>();
       cards.add(new Cardinality(0, 1));
       r.addFeature(f, cards);
     }
   }
 }