@Override protected void fillSeries(TsInformation info, DataSet dataSet) throws IOException { sleep(info.type); switch (dataTypeParam.get(dataSet.getDataSource())) { case NORMAL: if (info.type.needsData()) { Ts ts = normalData.get(indexParam.get(dataSet)); support.fillSeries(info, OptionalTsData.present(0, 0, ts.getTsData()), false); info.type = TsInformationType.All; } break; case FAILING_META: throw new IOException("Cannot load dataset"); case FAILING_DATA: if (info.type.needsData()) { throw new IOException("Cannot load dataset"); } break; case UPDATING: if (info.type.needsData()) { Ts ts = dataBuilder.build().get(0); support.fillSeries(info, OptionalTsData.present(0, 0, ts.getTsData()), false); info.type = TsInformationType.All; } break; default: throw new IOException("???"); } }
@Override public List<DataSet> children(DataSource dataSource) throws IllegalArgumentException, IOException { switch (dataTypeParam.get(dataSource)) { case NORMAL: case FAILING_META: case FAILING_DATA: case UPDATING: List<DataSet> result = new ArrayList<>(); DataSet.Builder builder = DataSet.builder(dataSource, DataSet.Kind.SERIES); for (int i = 0; i < normalData.getCount(); i++) { indexParam.set(builder, i); result.add(builder.build()); } return result; default: throw new IOException("???"); } }
@Override protected void fillCollection(TsCollectionInformation info, DataSource dataSource) throws IOException { sleep(info.type); switch (dataTypeParam.get(dataSource)) { case NORMAL: DataSet.Builder builder = DataSet.builder(dataSource, DataSet.Kind.SERIES); for (int i = 0; i < normalData.getCount(); i++) { indexParam.set(builder, i); TsInformation tsInfo = newTsInformation(builder.build(), info.type); if (info.type.needsData()) { support.fillSeries( tsInfo, OptionalTsData.present(0, 0, normalData.get(i).getTsData()), false); info.type = TsInformationType.All; // FIXME: TsInformationType.Data fails ??? } info.items.add(tsInfo); } break; case FAILING_META: throw new IOException("Cannot load datasource"); case FAILING_DATA: if (info.type.needsData()) { throw new IOException("Cannot load datasource"); } DataSet.Builder b2 = DataSet.builder(dataSource, DataSet.Kind.SERIES); for (int i = 0; i < normalData.getCount(); i++) { indexParam.set(b2, i); TsInformation tsInfo = newTsInformation(b2.build(), info.type); info.items.add(tsInfo); } break; case UPDATING: DataSet.Builder b3 = DataSet.builder(dataSource, DataSet.Kind.SERIES); TsCollection data = dataBuilder.build(); for (int i = 0; i < data.getCount(); i++) { indexParam.set(b3, i); TsInformation tsInfo = newTsInformation(b3.build(), info.type); if (info.type.needsData()) { support.fillSeries( tsInfo, OptionalTsData.present(0, 0, data.get(i).getTsData()), false); info.type = TsInformationType.All; } info.items.add(tsInfo); } break; default: throw new IOException("???"); } }
@Override public String getDisplayNodeName(DataSet dataSet) throws IllegalArgumentException { return normalData.get(indexParam.get(dataSet)).getName(); }