public static MRInstruction parseSingleInstruction(String str)
      throws DMLUnsupportedOperationException, DMLRuntimeException {
    if (str == null || str.isEmpty()) return null;

    MRINSTRUCTION_TYPE mrtype = InstructionUtils.getMRType(str);
    return parseSingleInstruction(mrtype, str);
  }
  public static MRInstruction[] parseCombineInstructions(String str)
      throws DMLUnsupportedOperationException, DMLRuntimeException {
    MRInstruction[] inst = null;
    if (str != null && !str.isEmpty()) {
      String[] strlist = str.split(Instruction.INSTRUCTION_DELIM);
      inst = new MRInstruction[strlist.length];

      for (int i = 0; i < strlist.length; i++) {
        MRINSTRUCTION_TYPE type = InstructionUtils.getMRType(strlist[i]);
        if (type == MRINSTRUCTION_TYPE.CombineBinary)
          inst[i] =
              (CombineBinaryInstruction) CombineBinaryInstruction.parseInstruction(strlist[i]);
        else if (type == MRINSTRUCTION_TYPE.CombineTernary)
          inst[i] =
              (CombineTernaryInstruction) CombineTernaryInstruction.parseInstruction(strlist[i]);
        else throw new DMLRuntimeException("unknown combine instruction: " + strlist[i]);
      }
    }
    return inst;
  }