use of org.diirt.vtype.ArrayDimensionDisplay 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);
}
use of org.diirt.vtype.ArrayDimensionDisplay in project yamcs-studio by yamcs.
the class NdArrayFormulaFunction method calculate.
@Override
public Object calculate(final List<Object> args) {
if (NullUtils.containsNull(args)) {
return null;
}
VNumberArray data = (VNumberArray) args.get(0);
ArrayDimensionDisplay[] displays = new ArrayDimensionDisplay[args.size() - 1];
for (int i = 0; i < displays.length; i++) {
displays[i] = (ArrayDimensionDisplay) args.get(i + 1);
}
return ValueFactory.ndArray(data, displays);
}
Aggregations