Interface PathTableData<T>

Type Parameters:
T -
All Known Implementing Classes:
ObservableMeasurementTableData

public interface PathTableData<T>
Interface defining a table model that enables measurement names to be mapped to string or numeric values (as appropriate).

This can be thought of a table, where items (often PathObject correspond to rows and named columns either return numeric or String data.

This provides a useful method of wrapping one or more objects, and providing access to metadata, stored measurements and dynamically computed values in a way that is amenable to display within a table.

  • Field Details

    • DEFAULT_DECIMAL_PLACES

      static final int DEFAULT_DECIMAL_PLACES
      The default number of decimal places when converting floating point values to strings. This is permitted to change the number of decimal places based upon the magnitude of the value.
      See Also:
    • DEFAULT_DELIMITER

      static final String DEFAULT_DELIMITER
      The default delimiter to use. This is a tab, to avoid confusion between decimal separators in different locales.
      See Also:
  • Method Details

    • getAllNames

      List<String> getAllNames()
      Return an ordered list of all names, including both numeric measurements and String values.
      Returns:
      See Also:
    • getStringValue

      String getStringValue(T item, String name)
      Get a string representation of the value.

      For this method, numbers should be formatted according to the Locale.

      Parameters:
      item -
      name -
      Returns:
    • getStringValue

      String getStringValue(T item, String name, int decimalPlaces)
      Get a string value, converting to a fixed number of decimal places if the column is numeric.
      Parameters:
      item -
      name -
      decimalPlaces -
      Returns:
    • getMeasurementNames

      List<String> getMeasurementNames()
      Get the names of all numeric measurements.
      Returns:
      See Also:
    • getNumericValue

      double getNumericValue(T item, String name)
      Get the numeric value from an item for the specific measurement.
      Parameters:
      item -
      name -
      Returns:
    • getDoubleValues

      double[] getDoubleValues(String name)
      Get all double values for all items.
      Parameters:
      name -
      Returns:
    • getItems

      List<T> getItems()
      Get internal list of the items used to provide measurements.
      Returns:
    • getRowStrings

      default List<String> getRowStrings()
      Get a list of Strings representing table data for all items.

      This will use DEFAULT_DELIMITER and DEFAULT_DECIMAL_PLACES, with no column filter.

      Returns:
      a list of strings, with the first item giving the column names and each additional string representing a row in the table
      Since:
      v0.6.0
    • getRowStrings

      default List<String> getRowStrings(String delim, int nDecimalPlaces, Predicate<String> columnFilter)
      Get a list of Strings representing table data for all items.

      Each entry in the list corresponds to a row.

      This is equivalent to calling getRowStrings(getItems(), delim, nDecimalPlaces, columnFilter).

      Parameters:
      delim - the delimiter to use between columns
      nDecimalPlaces - the number of decimal places to use for numeric values
      columnFilter - a predicate to choose which columns to include; if null, all columns from the table are used
      Returns:
      a list of strings, with the first item giving the column names and each additional string representing a row in the table
      Since:
      v0.6.0
    • getRowStrings

      default List<String> getRowStrings(Collection<? extends T> items, String delim, int nDecimalPlaces, Predicate<String> columnFilter)
      Get a list of Strings representing table data for specific items.

      Each entry in the list corresponds to a row.

      Parameters:
      items - the items to use; one row will be returned for each
      delim - the delimiter to use between columns
      nDecimalPlaces - the number of decimal places to use for numeric values; if negative, the default number of decimal places is used
      columnFilter - a predicate to choose which columns to include; if null, all columns from the table are used
      Returns:
      a list of strings, with the first item giving the column names and each additional string representing a row in the table
      Since:
      v0.6.0