use of com.github.noraui.data.DataIndex in project NoraUi by NoraUi.
the class MavenRunCounter method countWithoutModel.
private static void countWithoutModel(int nbStep, Counter result, List<DataIndex> indexData) throws TechnicalException {
int failures = 0;
int skipped = 0;
for (int i = 1; i < Context.getDataInputProvider().getNbLines(); i++) {
final List<Integer> index = new ArrayList<>();
index.add(i);
indexData.add(new DataIndex(i, index));
final String resultColumn = Context.getDataInputProvider().readValue(Context.getDataInputProvider().getResultColumnName(), i);
if (!"".equals(resultColumn)) {
failures += 1;
skipped += nbStep - (int) Double.parseDouble(resultColumn);
}
}
result.setNbcas(indexData.size());
result.setFailures(failures);
result.setSkipped(skipped);
}
use of com.github.noraui.data.DataIndex in project NoraUi by NoraUi.
the class MavenRunCounter method countWithModel.
private static void countWithModel(int nbStep, Counter result, List<DataIndex> indexData, Class<Model> model) throws TechnicalException {
int failures = 0;
int skipped = 0;
final String[] headers = Context.getDataInputProvider().readLine(0, false);
if (headers != null) {
final Constructor<Model> modelConstructor = DataUtils.getModelConstructor(model, headers);
final Map<String, ModelList> fusionedData = DataUtils.fusionProcessor(model, modelConstructor);
int dataIndex = 0;
for (final Entry<String, ModelList> e : fusionedData.entrySet()) {
dataIndex++;
indexData.add(new DataIndex(dataIndex, e.getValue().getIds()));
for (int i = 0; i < e.getValue().getIds().size(); i++) {
final Integer wid = e.getValue().getIds().get(i);
final String resultColumn = Context.getDataInputProvider().readValue(Context.getDataInputProvider().getResultColumnName(), wid);
if (!"".equals(resultColumn)) {
failures += 1;
skipped += nbStep - (int) Double.parseDouble(resultColumn);
}
}
}
} else {
logger.error(Messages.getMessage(ScenarioInitiator.SCENARIO_INITIATOR_ERROR_EMPTY_FILE));
}
result.setNbcas(indexData.size());
result.setFailures(failures);
result.setSkipped(skipped);
}
use of com.github.noraui.data.DataIndex in project NoraUi by NoraUi.
the class Context method initDataId.
private static void initDataId(String scenarioName) throws TechnicalException {
final List<DataIndex> indexData = new ArrayList<>();
try {
Context.getDataInputProvider().prepare(scenarioName);
final Class<Model> model = Context.getDataInputProvider().getModel(Context.getModelPackages());
if (model != null) {
final String[] headers = Context.getDataInputProvider().readLine(0, false);
if (headers != null) {
final Constructor<Model> modelConstructor = DataUtils.getModelConstructor(model, headers);
final Map<String, ModelList> fusionedData = DataUtils.fusionProcessor(model, modelConstructor);
int dataIndex = 0;
for (final Entry<String, ModelList> e : fusionedData.entrySet()) {
dataIndex++;
indexData.add(new DataIndex(dataIndex, e.getValue().getIds()));
}
} else {
logger.error(Messages.getMessage(ScenarioInitiator.SCENARIO_INITIATOR_ERROR_EMPTY_FILE));
}
} else {
for (int i = 1; i < Context.getDataInputProvider().getNbLines(); i++) {
final List<Integer> index = new ArrayList<>();
index.add(i);
indexData.add(new DataIndex(i, index));
}
}
Context.getDataInputProvider().setIndexData(indexData);
} catch (final Exception te) {
throw new TechnicalException(Messages.getMessage(TechnicalException.TECHNICAL_ERROR_MESSAGE) + te.getMessage(), te);
}
}
Aggregations