Package org.apache.sis.parameter
Class ParameterTableRow
java.lang.Object
org.apache.sis.parameter.ParameterTableRow
A row in the table to be formatted by
ParameterFormat
.- Since:
- 0.4
- Version:
- 0.6
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) int
The largest codespace width, in number of Unicode code points.The (codespace(s), name(s)) entries for the identifier and all aliases declared in the constructor.private int
Reference to a remark, or0
if none.The units of measurement.(package private) String
The string representation of the domain of values, ornull
if none.(package private) int
The position to use for alignment ofvalueDomain
.The values. -
Constructor Summary
ConstructorsConstructorDescriptionParameterTableRow
(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 byParameterFormat
. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addIdentifier
(String codespace, Object identifier) Helper method for the constructor only, adding an identifier for the given code space.(package private) final void
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
isDeprecated
(Object object) Returnstrue
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
Returns the string representation of the given parameter name.private static void
writeColor
(Appendable out, X364 color, boolean colorEnabled) Writes the given color ifcolorEnabled
istrue
.private static void
writeColor
(Appendable out, Colors colors, ElementKind type) Writes the color for the given type ifcolors
is non-null.(package private) static void
writeFootnoteNumber
(Appendable out, int n) 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.
-
Field Details
-
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 codespaceWidthThe largest codespace width, in number of Unicode code points.- See Also:
-
valueDomain
String valueDomainThe string representation of the domain of values, ornull
if none. -
valueDomainAlignment
int valueDomainAlignmentThe position to use for alignment ofvalueDomain
. This is usually after the '…' separator. -
values
The values. Some elements in this list may be null.- See Also:
-
units
The units of measurement. The size of this list shall be the same thanvalues
. 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 remarksReference to a remark, or0
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 byParameterFormat
.- 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
Returnstrue
if the given name or identifier is deprecated. -
addIdentifier
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
If this row has exactly one codespace, returns that codespace. Otherwise returnsnull
. -
setValueDomain
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 therange
.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
Adds a value and its unit of measurement.- Parameters:
value
- the value, ornull
.unit
- the unit of measurement, ornull
.
-
expandSingleton
final void expandSingleton() -
writeColor
Writes the color for the given type ifcolors
is non-null.- Throws:
IOException
-
writeColor
Writes the given color ifcolorEnabled
istrue
.- Throws:
IOException
-
writeIdentifiers
final void writeIdentifiers(Appendable out, boolean writeCodespaces, Colors colors, boolean colorsForRows, String lineSeparator) throws IOException Writes the identifiers. At most one ofcolors != null
andcolorsForRows
can betrue
.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, orfalse
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
Writes the footnote number to the given appendable. The number is written in superscript if possible.- Throws:
IOException
-
toString
Returns the string representation of the given parameter name.
-