This is an old revision of the document!
Double Value Object
com.ergotech.vib.valueobjects.DoubleValueObject
Description
The Double Value Object (“DVO”) is a type of Value Object which is used for decimal numbers (float or double types).
Many of the mathematical manipulators generate Double Value Objects. For example the Scaler will use any numeric input and generate a decimal output. See the documentation on each manipulator for specifics on its output type.
There are several sample data sources that can be used to generate Double Value Objects for testing. These are the Random Data (RandomData), Float Flux Server (FloatFluxServer), and the Sine Server (SineServer).
Notes
In MIStudio or TransSECS if you create a DoubleValueObject entity, and send any numeric type into its input, the value stored will be converted to store this value.
If you send a DoubleValueObject to a Manipulator which generates Strings, the value will be stored as a String with three decimal places.
JavaScript Notes
Data will be converted when possible.
var DoubleValueObject = Java.type("com.ergotech.vib.valueobjects.DoubleValueObject"); var StringValueObject = Java.type("com.ergotech.vib.valueobjects.StringValueObject"); var LongValueObject = Java.type("com.ergotech.vib.valueobjects.LongValueObject"); test1 = new StringValueObject(new DoubleValueObject(55.654124)); //stored as a String with value "55.654" vo = new LongValueObject(23); // cannot store the LongValueObject in a DoubleValueObject,so need to get the integer value first test1 = new DoubleValueObject(vo.getIntValue()); //stored as a floating point value 23.0000...
Example 1: Create a Double Value Object with value PI
var PI = Java.type("java.util.Math.PI"); var DoubleValueObject = Java.type("com.ergotech.vib.valueobjects.DoubleValueObject"); output = new DoubleValueObject(PI);
Example 2: Add two values from two data sources named “Value1” and “Value2”. One value is a decimal number and the other is non-decimal.
var DoubleValueObject = Java.type("com.ergotech.vib.valueobjects.DoubleValueObject"); value1 = Value1 -> getDoubleValue(); value2 = Value2 -> getLongValue(); DVO = new DoubleValueObject(value1+value2);
Example 3. Get the float value of an incoming value object
floatValue = incomingValue->getFloatValue();
