public Pair<Pair<String,String[]>,List<String>> rewrite(List<String> results){
  String commandId=null;
  String[] args=null;
  List<String> rewrittenResults=new ArrayList<>();
  for (  String result : results) {
    Triple triple=rewrite(result);
    rewrittenResults.add(triple.mStr);
    commandId=triple.mId;
    args=triple.mArgs;
  }
  return new Pair<>(new Pair<>(commandId,args),rewrittenResults);
}

public Pair < Pair < String , String [ ] > , List < String > > rewrite ( List < String > results ) { String commandId = null ; String [ ] args = null ; List < String > rewrittenResults = new ArrayList < > ( ) ; for ( String result : results ) { Triple triple = rewrite ( result ) ; rewrittenResults . add ( triple . mStr ) ; commandId = triple . mId ; args = triple . mArgs ; } return new Pair < > ( new Pair < > ( commandId , args ) , rewrittenResults ) ; }
rewrites and returns the given results . todo : improve this
