use of org.diirt.vtype.table.ListNumberProvider in project yamcs-studio by yamcs.
the class ColumnFromListNumberGeneratorFunction method calculate.
@Override
public Object calculate(final List<Object> args) {
VString name = (VString) args.get(0);
ListNumberProvider data = (ListNumberProvider) args.get(1);
if (name == null || data == null) {
return null;
}
return VTableFactory.column(name.getValue(), data);
}
use of org.diirt.vtype.table.ListNumberProvider in project yamcs-studio by yamcs.
the class ArrayWithBoundariesFormulaFunction method calculate.
@Override
public Object calculate(final List<Object> args) {
if (NullUtils.containsNull(args)) {
return null;
}
VNumberArray array = (VNumberArray) args.get(0);
if (array.getSizes().size() != args.size() - 1) {
throw new IllegalArgumentException("Dimension of the array must match the number of ListNumberProvider");
}
List<ArrayDimensionDisplay> dimDisplay = new ArrayList<>();
for (int i = 1; i < args.size(); i++) {
ListNumberProvider numberGenerator = (ListNumberProvider) args.get(i);
dimDisplay.add(ValueFactory.newDisplay(numberGenerator.createListNumber(array.getSizes().getInt(i - 1) + 1), ""));
}
return ValueFactory.newVNumberArray(array.getData(), array.getSizes(), dimDisplay, array, array, array);
}
Aggregations