Пример #1
0
 public String printTextualRepresentation() {
   String description = QueryManager.addColouring("the negation of ");
   ArrayList children = getChildNodes();
   if (children != null) {
     Iterator<PerformanceTreeNode> i = children.iterator();
     while (i.hasNext()) {
       PerformanceTreeNode child = i.next();
       // print out child's textual representation
       QueryManager.colourUp();
       description += child.printTextualRepresentation();
       QueryManager.colourDown();
     }
   } else {
     description +=
         QueryManager.addColouring("a boolean expression that has not been specified yet");
   }
   return description + QueryManager.addColouring(" holds");
 }
Пример #2
0
  public String printTextualRepresentation() {
    String description = "";
    String op = " and / or ";

    if (getOperation().equals("and")) op = " and ";
    else if (getOperation().equals("or")) op = " or ";

    ArrayList children = getChildNodes();
    if (children != null) {
      Iterator<PerformanceTreeNode> i = children.iterator();
      while (i.hasNext()) {
        PerformanceTreeNode child = i.next();
        QueryManager.colourUp();
        description += child.printTextualRepresentation();
        QueryManager.colourDown();
        if (i.hasNext()) description += QueryManager.addColouring(op);
        else {
          if (children.size() == 1) {
            description += QueryManager.addColouring(op);
            QueryManager.colourUp();
            description +=
                QueryManager.addColouring("another boolean value that has not been specified yet ");
            QueryManager.colourDown();
          }
        }
      }
    } else {
      QueryManager.colourUp();
      description += QueryManager.addColouring("a boolean value that has not been specified yet ");
      QueryManager.colourDown();
      description += QueryManager.addColouring(op);
      QueryManager.colourUp();
      description +=
          QueryManager.addColouring("another boolean value that has also not been specified yet ");
      QueryManager.colourDown();
    }
    return description + QueryManager.addColouring("holds ");
  }