Search in sources :

Example 6 with VString

use of org.diirt.vtype.VString in project yamcs-studio by yamcs.

the class ColumnFromVStringArrayFunction method calculate.

@Override
public Object calculate(final List<Object> args) {
    VString name = (VString) args.get(0);
    VStringArray data = (VStringArray) args.get(1);
    if (name == null || data == null) {
        return null;
    }
    return VTableFactory.column(name.getValue(), data);
}
Also used : VString(org.diirt.vtype.VString) VStringArray(org.diirt.vtype.VStringArray)

Example 7 with VString

use of org.diirt.vtype.VString in project yamcs-studio by yamcs.

the class TableRangeArrayFilterFunction method calculate.

@Override
public Object calculate(final List<Object> args) {
    if (NullUtils.containsNull(args)) {
        return null;
    }
    VTable table = (VTable) args.get(0);
    VString columnName = (VString) args.get(1);
    VNumberArray range = (VNumberArray) args.get(2);
    if (range.getData().size() != 2) {
        throw new IllegalArgumentException("Range array must be of 2 elements");
    }
    VTable result = VTableFactory.tableRangeFilter(table, columnName.getValue(), ValueFactory.newVDouble(range.getData().getDouble(0)), ValueFactory.newVDouble(range.getData().getDouble(1)));
    return result;
}
Also used : VNumberArray(org.diirt.vtype.VNumberArray) VString(org.diirt.vtype.VString) VTable(org.diirt.vtype.VTable)

Example 8 with VString

use of org.diirt.vtype.VString in project yamcs-studio by yamcs.

the class TableValueFilterFunction method calculate.

@Override
public Object calculate(final List<Object> args) {
    VTable table = (VTable) args.get(0);
    VString columnName = (VString) args.get(1);
    VType value = (VType) args.get(2);
    if (columnName == null || columnName.getValue() == null || table == null || value == null) {
        return null;
    }
    VTable result = VTableFactory.tableValueFilter(table, columnName.getValue(), value);
    return result;
}
Also used : VType(org.diirt.vtype.VType) VString(org.diirt.vtype.VString) VTable(org.diirt.vtype.VTable)

Example 9 with VString

use of org.diirt.vtype.VString in project org.csstudio.display.builder by kasemir.

the class ArrayPVDispatcher method updateArrayFromElements.

/**
 * Update the array PV with the current value of all element PVs
 */
private void updateArrayFromElements() throws Exception {
    final List<RuntimePV> pvs = element_pvs.get();
    final int N = pvs.size();
    if (N == 1) {
        // Is 'array' really a scalar?
        final VType array = array_pv.read();
        if (array instanceof VNumber || array instanceof VString) {
            array_pv.write(pvs.get(0).read());
            return;
        }
    }
    if (is_string) {
        final String[] value = new String[N];
        for (int i = 0; i < N; ++i) value[i] = VTypeUtil.getValueString(pvs.get(i).read(), false);
        array_pv.write(value);
    } else {
        final double[] value = new double[N];
        for (int i = 0; i < N; ++i) value[i] = VTypeUtil.getValueNumber(pvs.get(i).read()).doubleValue();
        array_pv.write(value);
    }
}
Also used : VType(org.diirt.vtype.VType) VString(org.diirt.vtype.VString) VNumber(org.diirt.vtype.VNumber) VString(org.diirt.vtype.VString)

Example 10 with VString

use of org.diirt.vtype.VString in project yamcs-studio by yamcs.

the class VStringOfFunction method readValue.

@Override
public VString readValue() {
    VType value = argument.readValue();
    if (forward != null) {
        forward.writeValue(value);
    }
    if (value == null) {
        return null;
    }
    String string = format.format(value);
    Alarm alarm = ValueUtil.alarmOf(value);
    if (alarm == null) {
        alarm = ValueFactory.alarmNone();
    }
    Time time = ValueUtil.timeOf(value);
    if (time == null) {
        time = ValueFactory.timeNow();
    }
    return ValueFactory.newVString(string, alarm, time);
}
Also used : VType(org.diirt.vtype.VType) Alarm(org.diirt.vtype.Alarm) Time(org.diirt.vtype.Time) VString(org.diirt.vtype.VString)

Aggregations

VString (org.diirt.vtype.VString)20 VTable (org.diirt.vtype.VTable)9 VNumberArray (org.diirt.vtype.VNumberArray)5 ListInt (org.diirt.util.array.ListInt)4 ListNumber (org.diirt.util.array.ListNumber)4 VNumber (org.diirt.vtype.VNumber)4 VStringArray (org.diirt.vtype.VStringArray)4 VType (org.diirt.vtype.VType)4 VEnum (org.diirt.vtype.VEnum)3 VEnumArray (org.diirt.vtype.VEnumArray)3 ArrayList (java.util.ArrayList)2 Background (javafx.scene.layout.Background)2 BackgroundFill (javafx.scene.layout.BackgroundFill)2 ArrayInt (org.diirt.util.array.ArrayInt)2 VBoolean (org.diirt.vtype.VBoolean)2 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Rotate (javafx.scene.transform.Rotate)1 Translate (javafx.scene.transform.Translate)1