original_string: public function recode_legacy_state_answer($state) {
          $answer = $state->answer;
          $result = '';
          // Datasetxx-yy:zz format.
          if (preg_match('~^dataset([0-9]+)-(.*)$~', $answer, $matches)) {
              $itemid = $matches[1];
              $subanswer  = $matches[2];
              // Delegate subanswer recode to multichoice qtype, faking one question_states record.
              $substate = new stdClass();
              $substate->answer = $subanswer;
              $newanswer = $this->step->restore_recode_legacy_answer($substate, 'multichoice');
              $result = 'dataset' . $itemid . '-' . $newanswer;
          }
          return $result ? $result : $answer;
      }
code: public function recode_legacy_state_answer($state) {
          $answer = $state->answer;
          $result = '';
          // Datasetxx-yy:zz format.
          if (preg_match('~^dataset([0-9]+)-(.*)$~', $answer, $matches)) {
              $itemid = $matches[1];
              $subanswer  = $matches[2];
              // Delegate subanswer recode to multichoice qtype, faking one question_states record.
              $substate = new stdClass();
              $substate->answer = $subanswer;
              $newanswer = $this->step->restore_recode_legacy_answer($substate, 'multichoice');
              $result = 'dataset' . $itemid . '-' . $newanswer;
          }
          return $result ? $result : $answer;
      }
code_tokens: public function recode_legacy_state_answer ( $ state ) { $ answer = $ state -> answer ; $ result = '' ; // Datasetxx-yy:zz format. if ( preg_match ( '~^dataset([0-9]+)-(.*)$~' , $ answer , $ matches ) ) { $ itemid = $ matches [ 1 ] ; $ subanswer = $ matches [ 2 ] ; // Delegate subanswer recode to multichoice qtype, faking one question_states record. $ substate = new stdClass ( ) ; $ substate -> answer = $ subanswer ; $ newanswer = $ this -> step -> restore_recode_legacy_answer ( $ substate , 'multichoice' ) ; $ result = 'dataset' . $ itemid . '-' . $ newanswer ; } return $ result ? $ result : $ answer ; }
docstring: Given one question_states record, return the answer
  recoded pointing to all the restored stuff for calculatedmulti questions
  
  answer format is datasetxx-yy:zz, where xx is the itemnumber in the dataset
  (doesn't need conversion), and both yy and zz are two (hypen speparated)
  lists of comma separated question_answers, the first to specify the order
  of the answers and the second to specify the responses.
  
  in fact, this qtype behaves exactly like the multichoice one, so we'll delegate
  recoding of those yy:zz to it
docstring_tokens: Given one question_states record return the answer recoded pointing to all the restored stuff for calculatedmulti questions