/**
   * Output dataset for the given run number. This is a dataset wrapped around {@link
   * #getValues(int)} and {@link #getValueNames()}.
   *
   * @param run run number
   * @return collector function values.
   * @throws CDataGridException if problem creating dataset
   */
  private CDataCacheContainer getValuesAsDataset(int run) throws CDataGridException {
    // Set up new Casper container for the results
    String columnNames = columnHeading + ",Value";
    final Class<?>[] columnTypes = new Class[] {String.class, Double.class};

    CDataCacheContainer container =
        CDataCacheContainer.newInsertionOrdered(getName(), columnNames, columnTypes);

    // Fill container with values from the arrays
    double[] values = getValues(run);
    String[] names = getValueNames();

    if (values.length != names.length) {
      throw new IllegalArgumentException(
          "\""
              + getShortName()
              + "\" values.length ("
              + values.length
              + ") != names.length ("
              + names.length
              + ")");
    }

    for (int i = 0; i < values.length; i++) {
      container.addSingleRow(new Object[] {names[i], values[i]});
    }

    return container;
  }