/** * Returns the parent Dataset of this combination. If there is more than * one parent, or a child is found that is not a CombinationDataset, then * returns <code>null</code>. * * @return The parent Dataset of this combination or <code>null</code>. */ public SeriesDataset getParent() { SeriesDataset parent = null; for (int i = 0; i < this.datasetInfo.size(); i++) { SeriesDataset child = getDatasetInfo(i).data; if (child instanceof CombinationDataset) { SeriesDataset childParent = ((CombinationDataset) child).getParent(); if (parent == null) { parent = childParent; } else if (parent != childParent) { return null; } } else { return null; } } return parent; }
/** * Returns a map or indirect indexing form our series into parent's series. * Prior to calling this method, the client should check getParent() to make * sure the CombinationDataset uses the same parent. If not, the map * returned by this method will be invalid or null. * * @return A map or indirect indexing form our series into parent's series. * * @see #getParent() */ public int[] getMap() { int[] map = null; for (int i = 0; i < this.datasetInfo.size(); i++) { SeriesDataset child = getDatasetInfo(i).data; if (child instanceof CombinationDataset) { int[] childMap = ((CombinationDataset) child).getMap(); if (childMap == null) { return null; } map = joinMap(map, childMap); } else { return null; } } return map; }