Class NamedValues


  • public class NamedValues
    extends Object
    NamedValues is a particular implementation of a named value system, in which the value in each name/value pair is itself specifically a Vector of values.

    Functionally then, the name identifies a list of data.

    named/value pairs are added to a NameValues object through the add method. The list of names (in the system of name/value pairs) is acquired through getLabels. And the whole system (all the names, and all the values associated with each name, is acquired through getValues.

    In this way, a table can be thought of as a NamedValues system, where each column label and the values under it are a single named/value. A single NamedValues object holds a whole table.

    Author:
    Greg White and Chris Larrieu. 11-Dec-201, SLAC
    • Constructor Detail

      • NamedValues

        public NamedValues()
    • Method Detail

      • add

        public void add​(String name,
                        Vector value)
        Add a named Vector of values to a NameValues object.
        Parameters:
        name - the name of the list of values to add, eg "girlscouts"
        value - the list of values associated with name, eg {"Caroline", "Mary", "Beth"}
      • getLabels

        public String[] getLabels()
        Gets all the names in the named/values system at once, as an array of Strings.
        Returns:
        all names in the NamedValues object, ie the column headings in the table analogy
      • getValues

        public String[][] getValues()
        Gets all the values in the named/values system. Since each "value" is itself a list (supplied as a vector to the add method), this method returns a 2d array.
        Returns:
        the values arrays presently in the NamedValues object, i.e. the contents of the table in the table analogy