Exemplo n.º 1
0
 private String generateEqualityString(
     List<Expression> equalities, List<List<FormulaVariable>> variables, boolean with) {
   StringBuilder localResult = new StringBuilder();
   StringBuilder prefix = new StringBuilder();
   if (useSaveFormat) {
     if (with) {
       prefix.append("\n").append(generateIndent()).append("with ");
     } else {
       prefix.append(",\n").append(generateIndent());
     }
   } else {
     prefix.append(",\n").append(generateIndent());
   }
   for (int i = 0; i < equalities.size(); i++) {
     Expression expression = equalities.get(i).clone();
     if (utility.setVariableDescriptions(expression, variables)) {
       if (useSaveFormat) {
         String expressionString = expression.toSaveString();
         if (with) {
           expressionString = expressionString.replaceAll("==", "=");
         }
         localResult.append(expressionString);
       } else {
         localResult.append(expression.toString());
       }
       if (i != equalities.size() - 1) {
         localResult.append(", ");
       }
     }
   }
   if (!localResult.toString().isEmpty()) {
     localResult.insert(0, prefix.toString());
   }
   return localResult.toString();
 }
Exemplo n.º 2
0
 private String generateBuiltinsForSelections(ComplexConjunctiveQuery query) {
   StringBuilder localResult = new StringBuilder();
   if (query.getAllSelections().size() > 0) {
     localResult.append(", ");
   }
   for (int i = 0; i < query.getAllSelections().size(); i++) {
     VariableSelectionCondition selection = query.getAllSelections().get(i);
     Expression expression = selection.getCondition().clone();
     utility.setVariableDescriptions(expression, variables);
     if (useSaveFormat) {
       String expressionString = expression.toSaveString();
       localResult.append(expressionString);
     } else {
       localResult.append(expression.toString());
     }
     if (i != query.getAllSelections().size() - 1) {
       localResult.append(", ");
     }
   }
   return localResult.toString();
 }