public State optimizeOrReverse (boolean optimize, boolean forward) {
State orig = this;
State unoptimized = orig;
State ret = orig.reversedClone();
long newInitialWaitTime = this.stateData.initialWaitTime;
PathParser pathParsers[];
// disable path parsing temporarily
pathParsers = stateData.opt.rctx.pathParsers;
stateData.opt.rctx.pathParsers = new PathParser[0];