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
Setting a String or Integer-type ValueObject with a Double will force ValueObject to store this value converted.
test1 = new DoubleValueObject(new LongValueObject(55)); stored as a floating point value 55.0000 test2 = new StringVaueObject(new DoubleValueObject(45.094357)); stored as a String “45.094”
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();
