@Override protected Object createValue() { String value = System.getProperty(propertyName); if (value == null) { value = ""; } if (!Objects.equals(value, previousValue)) { previousValue = value; return newVString(value, alarmNone(), timeNow()); } else { return null; } }
@Override protected Object createValue() { String value = System.getProperty(propertyName); if (value == null) { value = ""; } if (!Objects.equals(value, previousValue)) { previousValue = value; return newVString(value, alarmNone(), timeNow()); } else { return null; } }
@Override public Object calculate(List<Object> args) { PVAPVField value = (PVAPVField) args.get(0); String str = (value == null ? "null" : value.toString()); return ValueFactory.newVString(str, ValueFactory.alarmNone(), ValueFactory.timeNow()); }
@Override protected Object createValue() { String hostname; Alarm alarm; try { hostname = InetAddress.getLocalHost().getCanonicalHostName(); alarm = alarmNone(); } catch (UnknownHostException ex) { hostname = "Unknown host"; alarm = newAlarm(AlarmSeverity.INVALID, "Undefined"); } if (!Objects.equals(hostname, previousValue)) { previousValue = hostname; return newVString(hostname, alarm, timeNow()); } else { return null; } }
@Override protected Object createValue() { return newVDouble(bytesToMebiByte(Runtime.getRuntime().totalMemory()), alarmNone(), timeNow(), memoryDisplay); }
@Override protected Object createValue() { return newVDouble(bytesToMebiByte(Runtime.getRuntime().maxMemory()), alarmNone(), timeNow(), memoryDisplay); }
@Override protected Object createValue() { return newVDouble(bytesToMebiByte(Runtime.getRuntime().freeMemory()), alarmNone(), timeNow(), memoryDisplay); }
/** * A constant representing an int. Alarm will be none, timestamp now * and no display information. * * @param value the constant value * @return an int expression */ public static DesiredRateExpression<VInt> vConst(int value) { return constant(newVInt(value, alarmNone(), timeNow(), displayNone()), Integer.toString(value)); }
/** * A constant representing a string. Alarm will be none and timestamp now. * * @param value the constant value * @return a string expression */ public static DesiredRateExpression<VString> vConst(String value) { return constant(newVString(value, alarmNone(), timeNow()), value); }
@Override public final Object calculate(List<Object> args) { Object arg1 = args.get(0); Object arg2 = args.get(1); if (arg1 == null || arg2 == null) { return null; } Alarm alarm = ValueUtil.highestSeverityOf(args, false); Time time = ValueUtil.latestTimeOf(args); if (time == null) { time = ValueFactory.timeNow(); } return ValueFactory.newVDouble( calculate(((VNumber) args.get(0)).getValue().doubleValue(), ((VNumber) args.get(1)).getValue().doubleValue()) , alarm, time, ValueFactory.displayNone()); }
/** * A constant representing a double. Alarm will be none, timestamp now * and no display information. * * @param value the constant value * @return a double expression */ public static DesiredRateExpression<VDouble> vConst(double value) { return constant(newVDouble(value, alarmNone(), timeNow(), displayNone()), Double.toString(value)); }
/** * A constant representing a double array. Alarm will be none, timestamp now * and no display information. * * @param values the constant values * @return a double array expression */ public static DesiredRateExpression<VDoubleArray> vConst(ListDouble values) { return constant(newVDoubleArray(values, alarmNone(), timeNow(), displayNone())); }
/** * A constant representing an int array. Alarm will be none, timestamp now * and no display information. * * @param values the constant values * @return an int array expression */ public static DesiredRateExpression<VIntArray> vConst(ListInt values) { return constant(newVIntArray(values, alarmNone(), timeNow(), displayNone())); }
@Override public Object calculate(List<Object> args) { VType value = (VType) args.get(0); 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(ValueUtil.getDefaultValueFormat().format(value), alarm, time); }
/** * A list of constant expressions of type VString. * * @param values the list of constants * @return a list of string expression */ public static DesiredRateExpressionList<VString> vStringConstants(List<String> values) { DesiredRateExpressionList<VString> list = new DesiredRateExpressionListImpl<VString>(); for (String value : values) { list.and(constant(newVString(value, alarmNone(), timeNow()))); } return list; }
/** * A constant representing a double array. Alarm will be none, timestamp now * and no display information. * * @param values the constant values * @return a double array expression */ public static DesiredRateExpression<VDoubleArray> vConst(double... values) { return constant(newVDoubleArray(new ArrayDouble(values), alarmNone(), timeNow(), displayNone())); }
/** * A constant representing an int array. Alarm will be none, timestamp now * and no display information. * * @param values the constant values * @return an int array expression */ public static DesiredRateExpression<VIntArray> vConst(int... values) { return constant(newVIntArray(new ArrayInt(values), alarmNone(), timeNow(), displayNone())); }
@Override public Object calculate(final List<Object> args) { Alarm alarm = ValueUtil.highestSeverityOf(args, true); Time time = ValueUtil.timeOf(alarm); if (time == null) { time = ValueFactory.timeNow(); } return ValueFactory.newVEnum(alarm.getAlarmSeverity().ordinal(), AlarmSeverity.labels(), alarm, time); }
/** * A list of constant expressions of type VDouble. * * @param values the list of constants * @return a list of int expression */ public static DesiredRateExpressionList<VInt> vIntConstants(List<Integer> values) { DesiredRateExpressionList<VInt> list = new DesiredRateExpressionListImpl<VInt>(); for (Integer value : values) { list.and(constant(newVInt(value, alarmNone(), timeNow(), displayNone()))); } return list; }
/** * A list of constant expressions of type VDouble. * * @param values the list of constants * @return a list of double expression */ public static DesiredRateExpressionList<VDouble> vDoubleConstants(List<Double> values) { DesiredRateExpressionList<VDouble> list = new DesiredRateExpressionListImpl<VDouble>(); for (Double value : values) { list.and(constant(newVDouble(value, alarmNone(), timeNow(), displayNone()))); } return list; }