public Object clone() {
    SortRowsMeta retval = (SortRowsMeta) super.clone();

    int nrfields = fieldName.length;

    retval.allocate(nrfields);

    for (int i = 0; i < nrfields; i++) {
      retval.fieldName[i] = fieldName[i];
      retval.ascending[i] = ascending[i];
      retval.caseSensitive[i] = caseSensitive[i];
      retval.collatorEnabled[i] = collatorEnabled[i];
      retval.collatorStrength[i] = collatorStrength[i];
      retval.preSortedField[i] = preSortedField[i];
    }

    return retval;
  }
  /**
   * Create and return a SortRows step.
   *
   * @param name
   * @param sortFields [] Fields to sort by
   * @param ascending [] Boolean indicating whether the corresponding field is to be sorted in
   *     ascending or descending order.
   * @param caseSensitive [] Boolean indicating whether the corresponding field is to have case as a
   *     factor in the sort.
   * @param directory The directory in the file system where the sort is to take place if it can't
   *     fit into memory?
   * @param sortSize ???
   * @param pluginRegistry The environment's Kettle plugin registry.
   * @return
   */
  public static synchronized StepMeta createSortRowsStep(
      String name,
      String[] sortFields,
      boolean[] ascending,
      boolean[] caseSensitive,
      String directory,
      int sortSize,
      PluginRegistry pluginRegistry) {

    SortRowsMeta sortRowsMeta = new SortRowsMeta();
    sortRowsMeta.setSortSize(Integer.toString(sortSize / 10));
    sortRowsMeta.setFieldName(sortFields);
    sortRowsMeta.setAscending(ascending);
    sortRowsMeta.setCaseSensitive(caseSensitive);
    sortRowsMeta.setDirectory(directory);

    String sortRowsStepPid = pluginRegistry.getPluginId(StepPluginType.class, sortRowsMeta);
    StepMeta sortRowsStep = new StepMeta(sortRowsStepPid, name, sortRowsMeta);

    return sortRowsStep;
  }