public static void transform(Op opNew) {
        List<Op> redo = new ArrayList<Op>();
        StateVector vecNew = opNew.getStateVec();
        for (int i = hBuffer.size() - 1; i >= 0; i--) {
            Op op = hBuffer.get(i);
            StateVector vecTmp = op.getStateVec();
            if (!isTotalOrdering(vecTmp, vecNew)) {
                redo.add(op);
                // undo the operations
                Op inverse = op.inverse();
                apply(inverse);
            } else {
                break;
            }
        }
        int m = hBuffer.size() - 1 - redo.size();
        // remove the last $count operations

        Op eopNew = GOT(opNew);

        List<Op> eolPrime = new ArrayList<Op>();
        eolPrime.add(eopNew);
        if (!redo.isEmpty()) {
            eolPrime.add(IT(redo.get(0), eopNew));
            for (int i = 1; i < redo.size(); i++) {
                List<Op> his = new ArrayList<Op>(hBuffer.subList(m + 1, m + i));
                Collections.reverse(his);
                Op opTmp = LET(redo.get(i), his);
                eolPrime.add(LIT(opTmp, eolPrime));
            }
            for (int i = 0; i < redo.size(); i++)
                hBuffer.remove(hBuffer.size() - 1);
        }
        // apply to the doc
        for (Op tmp : eolPrime)
            apply(tmp);
        // redo eol Prime
        hBuffer.addAll(eolPrime);
    }