Example #1
0
 /**
  * Export to Map from DimsDataList
  *
  * @return
  */
 public Map<Integer, String> toMap() {
   final Map<Integer, String> ret = new HashMap<Integer, String>(size());
   for (DimsData dd : iterable()) {
     if (dd.isSlice()) {
       ret.put(dd.getDimension(), String.valueOf(dd.getSlice()));
     } else if (dd.isTextRange()) {
       ret.put(dd.getDimension(), dd.getSliceRange() != null ? dd.getSliceRange() : "all");
     } else if (dd.getPlotAxis() != null) {
       ret.put(dd.getDimension(), dd.getPlotAxis().getName());
     }
   }
   return ret;
 }
Example #2
0
  public Slice[] toSliceArray(int[] dataShape) {

    final Slice[] ret = new Slice[size()];
    for (int i = 0; i < size(); i++) {
      DimsData dd = getDimsData(i);
      if (dd.isSlice()) {
        ret[i] = new Slice(dd.getSlice(), dd.getSlice() + 1);
      } else {
        ret[i] = new Slice(dataShape[dd.getDimension()]);
      }
    }
    return ret;
  }