User Tools

Site Tools


doublevalueobject

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
doublevalueobject [2021/10/11 21:01] – created wikiadmindoublevalueobject [2021/10/11 21:49] (current) – [JavaScript Notes] wikiadmin
Line 10: Line 10:
    
 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). 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=== 
 + 
 +Internally the DoubleValueObject will store the value as a java double type. If the java type used to create this value object is a float, the internal type will set as "F", otherwise "D".  
 + 
 +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=== ===JavaScript Notes===
 +
 +Data will be converted when possible. 
 +
 +<code javascript>
 +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...
 +</code>
    
 Example 1: Create a Double Value Object with value PI Example 1: Create a Double Value Object with value PI
Line 34: Line 52:
 DVO = new DoubleValueObject(value1+value2); DVO = new DoubleValueObject(value1+value2);
    
 +</code>
 +
 +Example 3. Get the float value of an incoming value object
 +
 +<code javascript>
 +
 +floatValue = incomingValue.getFloatValue(); 
 +
 +</code>
 +
 +Example 4. Get the Boolean value of the incoming DoubleValueObject
 +
 +<code javascript>
 +boolValue = incomingValue.getBoolValue(); //will be true if !=0 and false otherwise
 </code> </code>
  
doublevalueobject.1634000516.txt.gz · Last modified: by wikiadmin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki