@Override
  public CompoundIntegerDataset getSlice(final SliceIterator siter) {
    CompoundIntegerDataset result = new CompoundIntegerDataset(isize, siter.getSliceShape());
    int[] rdata = result.data; // PRIM_TYPE
    IndexIterator riter = result.getIterator();

    while (siter.hasNext() && riter.hasNext()) {
      for (int i = 0; i < isize; i++) rdata[riter.index + i] = data[siter.index + i];
    }

    result.setName(name + ".slice");
    return result;
  }
  /**
   * Copy a dataset or just wrap in a new reference (for Jython sub-classing)
   *
   * @param dataset
   * @param wrap
   */
  public CompoundIntegerDataset(final CompoundIntegerDataset dataset, final boolean wrap) {
    isize = dataset.isize;
    size = dataset.size;

    if (wrap) {
      shape = dataset.shape;
      dataSize = dataset.dataSize;
      dataShape = dataset.dataShape;
      name = dataset.name;
      metadata = dataset.metadata;
      if (dataset.metadataStructure != null) metadataStructure = dataset.metadataStructure;
      odata = data = dataset.data;

      return;
    }

    shape = dataset.shape.clone();
    name = new String(dataset.name);
    metadata = copyMetadataMap(dataset.metadata);
    if (dataset.metadataStructure != null) metadataStructure = dataset.metadataStructure.clone();

    int[] gdata = dataset.data; // PRIM_TYPE

    if (dataset.isContiguous()) {
      odata = data = gdata.clone();
    } else {
      odata = data = createArray(size);

      IndexIterator diter = dataset.getIterator();
      IndexIterator iter = getIterator();
      while (iter.hasNext() && diter.hasNext()) {
        for (int i = 0; i < isize; i++) {
          data[iter.index + i] = gdata[diter.index + i];
        }
      }
    }

    errorValue = dataset.errorValue;
    errorData = dataset.errorData;
    errorArray = dataset.errorArray;
    errorCompoundData = dataset.errorCompoundData;
  }