Class ParameterTableRow

java.lang.Object
org.apache.sis.parameter.ParameterTableRow

final class ParameterTableRow extends Object
A row in the table to be formatted by ParameterFormat.
Since:
0.4
Version:
0.6
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) int
    The largest codespace width, in number of Unicode code points.
    private final Map<String,Set<Object>>
    The (codespace(s), name(s)) entries for the identifier and all aliases declared in the constructor.
    private int
    Reference to a remark, or 0 if none.
    (package private) final List<Object>
    The units of measurement.
    (package private) String
    The string representation of the domain of values, or null if none.
    (package private) int
    The position to use for alignment of valueDomain.
    (package private) final List<Object>
    The values.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ParameterTableRow(org.opengis.referencing.IdentifiedObject object, Locale locale, Set<String> preferredCodespaces, Map<String,Integer> remarks, boolean isBrief)
    Creates a new row in a table to be formatted by ParameterFormat.
  • Method Summary

    Modifier and Type
    Method
    Description
    private void
    addIdentifier(String codespace, Object identifier)
    Helper method for the constructor only, adding an identifier for the given code space.
    (package private) final void
    addValue(Object value, javax.measure.Unit<?> unit)
    Adds a value and its unit of measurement.
    (package private) final void
    If the list has only one element and this element is an array or a collection, expands it.
    (package private) final String
    If this row has exactly one codespace, returns that codespace.
    private static boolean
    Returns true if the given name or identifier is deprecated.
    (package private) final int
    setValueDomain(Range<?> range, Format format, StringBuffer buffer)
    Sets the value domain to the string representation of the given range.
    private static String
    toString(Object parameter)
    Returns the string representation of the given parameter name.
    private static void
    writeColor(Appendable out, X364 color, boolean colorEnabled)
    Writes the given color if colorEnabled is true.
    private static void
    writeColor(Appendable out, Colors colors, ElementKind type)
    Writes the color for the given type if colors is non-null.
    (package private) static void
    Writes the footnote number to the given appendable.
    (package private) final void
    writeIdentifiers(Appendable out, boolean writeCodespaces, Colors colors, boolean colorsForRows, String lineSeparator)
    Writes the identifiers.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • identifiers

      private final Map<String,Set<Object>> identifiers
      The (codespace(s), name(s)) entries for the identifier and all aliases declared in the constructor. The codespace key may be null, but the name values shall never be null.

      Values can be of two kinds:

      • String for names or aliases.
      • Identifier for identifiers.
      See Also:
    • codespaceWidth

      int codespaceWidth
      The largest codespace width, in number of Unicode code points.
      See Also:
    • valueDomain

      String valueDomain
      The string representation of the domain of values, or null if none.
      See Also:
    • valueDomainAlignment

      int valueDomainAlignment
      The position to use for alignment of valueDomain. This is usually after the '…' separator.
      See Also:
    • values

      final List<Object> values
      The values. Some elements in this list may be null.
      See Also:
    • units

      final List<Object> units
      The units of measurement. The size of this list shall be the same than values. The list may contain null elements.

      This list is initially filled with Unit instance. Later in the formatting process, Unit instances will be replaced by their symbol.

      See Also:
    • remarks

      private int remarks
      Reference to a remark, or 0 if none.
  • Constructor Details

    • ParameterTableRow

      ParameterTableRow(org.opengis.referencing.IdentifiedObject object, Locale locale, Set<String> preferredCodespaces, Map<String,Integer> remarks, boolean isBrief)
      Creates a new row in a table to be formatted by ParameterFormat.
      Parameters:
      object - the object for which to get the (codespace(s), name(s)).
      locale - the locale for formatting the names and the remarks.
      remarks - an initially empty map, to be filled with any remarks we may found.
  • Method Details

    • isDeprecated

      private static boolean isDeprecated(Object object)
      Returns true if the given name or identifier is deprecated.
    • addIdentifier

      private void addIdentifier(String codespace, Object identifier)
      Helper method for the constructor only, adding an identifier for the given code space. As a side effect, this method remembers the length of the widest code space.
    • getCodeSpace

      final String getCodeSpace()
      If this row has exactly one codespace, returns that codespace. Otherwise returns null.
    • setValueDomain

      final int setValueDomain(Range<?> range, Format format, StringBuffer buffer)
      Sets the value domain to the string representation of the given range.
      Parameters:
      range - the range to format.
      format - the format to use for formatting the range.
      buffer - a temporary buffer to use for formatting the range.
      Returns:
      the position of a character on which to align the text in the cell.
    • addValue

      final void addValue(Object value, javax.measure.Unit<?> unit)
      Adds a value and its unit of measurement.
      Parameters:
      value - the value, or null.
      unit - the unit of measurement, or null.
    • expandSingleton

      final void expandSingleton()
      If the list has only one element and this element is an array or a collection, expands it. This method shall be invoked only after the caller finished to add all elements in the values and units lists.
    • writeColor

      private static void writeColor(Appendable out, Colors colors, ElementKind type) throws IOException
      Writes the color for the given type if colors is non-null.
      Throws:
      IOException
    • writeColor

      private static void writeColor(Appendable out, X364 color, boolean colorEnabled) throws IOException
      Writes the given color if colorEnabled is true.
      Throws:
      IOException
    • writeIdentifiers

      final void writeIdentifiers(Appendable out, boolean writeCodespaces, Colors colors, boolean colorsForRows, String lineSeparator) throws IOException
      Writes the identifiers. At most one of colors != null and colorsForRows can be true.

      This method can be invoked only once per ParameterTableRow instance, as its implementation destroys the internal list of identifiers.

      Parameters:
      out - where to write.
      writeCodespaces - true for writing codespaces, or false for omitting them.
      colors - non-null if syntax coloring should be applied for table title.
      colorsForRows - true if syntax coloring should be applied for table rows.
      lineSeparator - the system-dependent line separator.
      Throws:
      IOException - if an exception occurred while writing.
    • writeFootnoteNumber

      static void writeFootnoteNumber(Appendable out, int n) throws IOException
      Writes the footnote number to the given appendable. The number is written in superscript if possible.
      Throws:
      IOException
    • toString

      private static String toString(Object parameter)
      Returns the string representation of the given parameter name.