com.ergotech.vib.valueobjects.ArrayValueObject
The Array Value Object (often referred to as “AVO”) is a type of Value Object that is composed of one or more individual Value Objects as array “elements”. Usually all the elements are the same type so that the AVO can be used in a graphic or manipulator expecting particular types of data, but this is not necessary in general.
The Array Data Source (ArrayDataSource) creates an AVO with numeric or boolean Value Objects for testing.
The String To Array (StringToArray) manipulator uses a comma separated list of strings as the input to create an AVO composed of all String Value Objects (StringValueObjects). The Array To String manipulator (ArrayToString) takes an AVO input and converts the values of each of the individual ValueObjects to Strings and generates a comma separated list of these Strings as its output. There are a few other manipulators, such as the Rolling Array Builder (RollingArrayBuilder) which generate AVOs.
The Trend Chart is an example of a graphic that will use an Array Value Object. In this case the data in the Value Objects within the AVO are expected to be numeric. See documentation on the Trend Chart on how the AVO is used as a Data Source for this graphic.
There are also database components that will create Array Value Objects by returning an array from a database lookup. For example, the Database Array Raw Lookup (DatabaseArrayRawLookup) returns a set of values from the database column and The Database Row Lookup (DatabaseRowLookup) returns a set of values from a database row.
The value of an Array Value Object will be converted to an integer (the number of Value Object elements) for any input to a graphic that expects a String or Number. For example, if you send an AVO into an Annunciator you will see the number of elements of the AVO displayed (not the array).
Even though an Array Value Object is composed of individual Value Objects, it has an overall Quality and Color property. If you access or set the Quality or Color of an AVO you will be using the property of the whole AVO, not any one associated with any particular element of the array.
Example 1: Create an AVO of five String Value Objects
var ArrayValueObject = Java.type("com.ergotech.vib.valueobjects.ArrayValueObject"); var StringValueObject = Java.type("com.ergotech.vib.valueobjects.StringValueObject"); avo = new ArrayValueObject(); avo.addElement(new StringValueObject("Hello")); avo.addElement(new StringValueObject("this")); avo.addElement(new StringValueObject("is")); avo.addElement(new StringValueObject("a")); avo.addElement(new StringValueObject("test.")); output = avo;
Example 2: Read the data stored in an AVO called ArrayDataSource
avo = ArrayDataSource->getValueObject(); value1 = avo.elementAt(0); //this gets the first element of the array //Arrays are indexed starting at 0, so some of the elements of the array would be: value2 = avo.elementAt(1); value3 = avo.elementAt(2); //You may want to know how many elements are in the array: count = avo.size();
Here is another example using an AVO: