1 43 44 package org.jfree.data; 45 46 52 public class SubSeriesDataset extends AbstractSeriesDataset 53 implements HighLowDataset, SignalsDataset, IntervalXYDataset, 54 CombinationDataset { 55 56 57 private SeriesDataset parent = null; 58 59 60 private int[] map; 62 69 public SubSeriesDataset(SeriesDataset parent, int[] map) { 70 this.parent = parent; 71 this.map = map; 72 } 73 74 81 public SubSeriesDataset(SeriesDataset parent, int series) { 82 this(parent, new int[] {series}); 83 } 84 85 89 100 public Number getHighValue(int series, int item) { 101 return ((HighLowDataset) parent).getHighValue(map[series], item); 102 } 103 104 115 public Number getLowValue(int series, int item) { 116 return ((HighLowDataset) parent).getLowValue(map[series], item); 117 } 118 119 130 public Number getOpenValue(int series, int item) { 131 return ((HighLowDataset) parent).getOpenValue(map[series], item); 132 } 133 134 145 public Number getCloseValue(int series, int item) { 146 return ((HighLowDataset) parent).getCloseValue(map[series], item); 147 } 148 149 160 public Number getVolumeValue(int series, int item) { 161 return ((HighLowDataset) parent).getVolumeValue(map[series], item); 162 } 163 164 165 169 180 public Number getXValue(int series, int item) { 181 return ((XYDataset) parent).getXValue(map[series], item); 182 } 183 184 195 public Number getYValue(int series, int item) { 196 return ((XYDataset) parent).getYValue(map[series], item); 197 } 198 199 209 public int getItemCount(int series) { 210 return ((XYDataset) parent).getItemCount(map[series]); 211 } 212 213 217 222 public int getSeriesCount() { 223 return map.length; 224 } 225 226 233 public String getSeriesName(int series) { 234 return parent.getSeriesName(map[series]); 235 } 236 237 241 249 public Number getStartXValue(int series, int item) { 250 if (parent instanceof IntervalXYDataset) { 251 return ((IntervalXYDataset) parent).getStartXValue(map[series], item); 252 } 253 else { 254 return getXValue(series, item); 255 } 256 } 257 258 266 public Number getEndXValue(int series, int item) { 267 if (parent instanceof IntervalXYDataset) { 268 return ((IntervalXYDataset) parent).getEndXValue(map[series], item); 269 } 270 else { 271 return getXValue(series, item); 272 } 273 } 274 275 283 public Number getStartYValue(int series, int item) { 284 if (parent instanceof IntervalXYDataset) { 285 return ((IntervalXYDataset) parent).getStartYValue(map[series], item); 286 } 287 else { 288 return getYValue(series, item); 289 } 290 } 291 292 300 public Number getEndYValue(int series, int item) { 301 if (parent instanceof IntervalXYDataset) { 302 return ((IntervalXYDataset) parent).getEndYValue(map[series], item); 303 } 304 else { 305 return getYValue(series, item); 306 } 307 } 308 309 313 321 public int getType(int series, int item) { 322 if (parent instanceof SignalsDataset) { 323 return ((SignalsDataset) parent).getType(map[series], item); 324 } 325 else { 326 return getYValue(series, item).intValue(); 327 } 328 } 329 330 338 public double getLevel(int series, int item) { 339 if (parent instanceof SignalsDataset) { 340 return ((SignalsDataset) parent).getLevel(map[series], item); 341 } 342 else { 343 return getYValue(series, item).doubleValue(); 344 } 345 } 346 347 351 356 public SeriesDataset getParent() { 357 return parent; 358 } 359 360 365 public int[] getMap() { 366 return (int[]) map.clone(); 367 } 368 369 } 370 | Popular Tags |