public void reset() {
    { QueryIterator self = this;

      if ((Stella.$TRACED_KEYWORDS$ != null) &&
          Stella.$TRACED_KEYWORDS$.membP(Logic.KWD_GOAL_CACHES)) {
        System.out.println("------------- RESET -------------");
      }
      { ControlFrame initialframe = self.baseControlFrame;

        if (initialframe.down != null) {
          ControlFrame.popFramesUpTo(initialframe.down);
        }
        { PatternRecord patternrecord = initialframe.patternRecord;

          self.currentPatternRecord = patternrecord;
          { Object old$Context$000 = Stella.$CONTEXT$.get();
            Object old$Queryiterator$000 = Logic.$QUERYITERATOR$.get();

            try {
              Native.setSpecial(Stella.$CONTEXT$, Logic.getQueryContext());
              Native.setSpecial(Logic.$QUERYITERATOR$, self);
              PatternRecord.unbindVariablesBeginningAt(patternrecord, 0);
              if (((Vector)(KeyValueList.dynamicSlotValue(self.dynamicSlots, Logic.SYM_LOGIC_INITIAL_BINDINGS, null))) != null) {
                { PatternVariable arg = null;
                  Vector vector000 = self.externalVariables;
                  int index000 = 0;
                  int length000 = vector000.length();
                  Stella_Object value = null;
                  Vector vector001 = ((Vector)(KeyValueList.dynamicSlotValue(self.dynamicSlots, Logic.SYM_LOGIC_INITIAL_BINDINGS, null)));
                  int index001 = 0;
                  int length001 = vector001.length();

                  for (;(index000 < length000) &&
                            (index001 < length001); index000 = index000 + 1, index001 = index001 + 1) {
                    arg = ((PatternVariable)((vector000.theArray)[index000]));
                    value = (vector001.theArray)[index001];
                    if (value != null) {
                      if (!(Logic.bindArgumentToValueP(arg, value, false))) {
                        { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

                          stream000.nativeStream.print("reset: binding of `" + arg + "' to `" + value + "' failed.");
                          throw ((FailException)(FailException.newFailException(stream000.theStringReader()).fillInStackTrace()));
                        }
                      }
                    }
                  }
                }
              }
              ControlFrame.overlayWithPatternFrameP(initialframe, patternrecord.description, patternrecord.externalArguments);

            } finally {
              Logic.$QUERYITERATOR$.set(old$Queryiterator$000);
              Stella.$CONTEXT$.set(old$Context$000);
            }
          }
        }
        self.exhaustedP = false;
        self.timeoutP = false;
        self.depthCutoffsP = false;
        self.solutions.clear();
        initialframe.truthValue = null;
        self.augmentedGoalCacheP = false;
        self.triggeredDepthCutoffP = false;
      }
    }
  }