Exemplo n.º 1
0
 /**
  * Add constraint
  *
  * @param featureModel
  * @param constraint
  */
 public static void addConstraint(FeatureModel featureModel, String constraint) {
   NodeReader nodeReader = new NodeReader();
   List<String> featureList = new ArrayList<String>(featureModel.getFeatureNames());
   Node node = null;
   try {
     node = nodeReader.stringToNode(constraint, featureList);
   } catch (Exception e) {
     System.out.println("Not valid constraint definition: " + constraint);
   }
   // TODO report error if node is null
   if (node != null) {
     Constraint c = new Constraint(featureModel, node);
     featureModel.addConstraint(c);
   } else {
     System.out.println("Maybe problems with names: " + constraint);
   }
 }