public static void resetCurrentPatternRecord(ControlFrame frame, Keyword localorparent) {
    if (localorparent == Logic.KWD_LOCAL) {
      ((QueryIterator)(Logic.$QUERYITERATOR$.get())).currentPatternRecord = frame.patternRecord;
    }
    else if (localorparent == Logic.KWD_PARENT) {
      if (frame.inheritedPatternRecord != null) {
        ((QueryIterator)(Logic.$QUERYITERATOR$.get())).currentPatternRecord = frame.inheritedPatternRecord;
      }
      else {
        ((QueryIterator)(Logic.$QUERYITERATOR$.get())).currentPatternRecord = ((QueryIterator)(Logic.$QUERYITERATOR$.get())).baseControlFrame.patternRecord;
      }
    }
    else {
      { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

        stream000.nativeStream.print("`" + localorparent + "' is not a valid case option");
        throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
      }
    }
  }