public static boolean setStringDataFilter(Analysis analysis, String datafilterString) {
   EList<Domain> dataFilters = analysis.getParameters().getDataFilter();
   // update existing filters
   if (!dataFilters.isEmpty()) {
     Domain domain = dataFilters.get(0);
     EList<RangeRestriction> ranges = domain.getRanges();
     RangeRestriction rangeRestriction =
         (ranges.isEmpty()) ? DomainHelper.addRangeRestriction(domain) : ranges.get(0);
     BooleanExpressionNode expressions = rangeRestriction.getExpressions();
     if (expressions == null) {
       expressions = BooleanExpressionHelper.createBooleanExpressionNode(datafilterString);
       rangeRestriction.setExpressions(expressions);
     } else {
       Expression expression = expressions.getExpression();
       if (expression == null) {
         expression =
             BooleanExpressionHelper.createTdExpression(
                 BooleanExpressionHelper.DEFAULT_LANGUAGE, datafilterString);
         expressions.setExpression(expression);
       } else {
         expression.setBody(datafilterString);
       }
     }
     return false;
   }
   // else
   return dataFilters.add(createDomain(analysis, datafilterString));
 }
 /**
  * DOC xqliu Comment method "setStringDataFilter".
  *
  * @param analysis
  * @param datafilterString
  * @param index 0 for DataFilterA, 1 for DataFilterB
  * @return
  */
 public static boolean setStringDataFilter(Analysis analysis, String datafilterString, int index) {
   if (index == 1) {
     EList<Domain> dataFilters = analysis.getParameters().getDataFilter();
     int size = dataFilters.size();
     if (size == 0) {
       dataFilters.add(createDomain(analysis, "")); // $NON-NLS-1$
       return dataFilters.add(createDomain(analysis, datafilterString, "1")); // $NON-NLS-1$
     } else if (size == 1) {
       return dataFilters.add(createDomain(analysis, datafilterString, "1")); // $NON-NLS-1$
     } else if (size == 2) {
       Domain domain = dataFilters.get(1);
       EList<RangeRestriction> ranges = domain.getRanges();
       RangeRestriction rangeRestriction =
           (ranges.isEmpty()) ? DomainHelper.addRangeRestriction(domain) : ranges.get(0);
       BooleanExpressionNode expressions = rangeRestriction.getExpressions();
       if (expressions == null) {
         expressions = BooleanExpressionHelper.createBooleanExpressionNode(datafilterString);
         rangeRestriction.setExpressions(expressions);
       } else {
         Expression expression = expressions.getExpression();
         if (expression == null) {
           expression =
               BooleanExpressionHelper.createTdExpression(
                   BooleanExpressionHelper.DEFAULT_LANGUAGE, datafilterString);
           expressions.setExpression(expression);
         } else {
           expression.setBody(datafilterString);
         }
       }
       return false;
     } else {
       return false;
     }
   } else {
     return setStringDataFilter(analysis, datafilterString);
   }
 }