Example #1
0
  void printChoices() {
    int i = 0;
    SystemState ss = vm.getSystemState();
    ChoiceGenerator<?>[] cgStack = ss.getChoiceGenerators();

    nextChoice:
    for (ChoiceGenerator<?> cg : cgStack) {
      if (isRelevantCG(cg) && !cg.isDone()) {

        Object choice = cg.getNextChoice();
        if (choice == null) {
          continue;
        } else {
          if (excludes != null) {
            for (String e : excludes) {
              if (choice.toString().startsWith(e)) {
                continue nextChoice;
              }
            }
          }
        }

        String line = null;

        switch (format) {
          case CHOICE:
            line = choice.toString();
            if (line.startsWith("gov.nasa.jpf.jvm.")) {
              line = line.substring(17);
            }
            break;
          case CG:
            line = cg.toString();
            if (line.startsWith("gov.nasa.jpf.jvm.choice.")) {
              line = line.substring(24);
            }
            break;
        }

        if (line != null) {
          pw.print(String.format("%4d: ", i++));

          pw.print(line);

          if (showLocation) {
            String loc = cg.getSourceLocation();
            if (loc != null) {
              pw.println();
              pw.print(" \tat ");
              pw.print(loc);
            }
          }
          pw.println();
        }
      }
    }
  }