Class DomainRange<E extends Number & Comparable<? super E>>

Type Parameters:
E - the type of range elements as a subclass of Number.
All Implemented Interfaces:
Serializable, CharSequence, Comparable<org.opengis.util.InternationalString>, Formattable, CheckedContainer<E>, Emptiable, org.opengis.util.InternationalString

final class DomainRange<E extends Number & Comparable<? super E>> extends NumberRange<E> implements org.opengis.util.InternationalString
The range of values that a metadata property can take, representable as an InternationalString in order to make possible to return this range from the PropertyInformation.getDomainValue() method.
Since:
0.3
Version:
0.3
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      For cross-version compatibility.
      See Also:
    • text

      private transient volatile String text
      The locale-independent string representation, built by toString() when first needed.
  • Constructor Details

    • DomainRange

      DomainRange(Class<E> type, ValueRange range) throws IllegalArgumentException
      Constructs a range of the given type with values from the given annotation. This constructor does not verify if the given type is wide enough for the values of the given annotation, because those information are usually static. If nevertheless the given type is not wide enough, then the values are truncated in the same way than the Java language casts primitive types.
      Parameters:
      type - the element type, restricted to one of Byte, Short, Integer, Long, Float or Double.
      range - the range of values.
      Throws:
      IllegalArgumentException - if the given type is not one of the primitive wrappers for numeric types.
  • Method Details

    • toString

      public String toString(Locale locale)
      Returns the string representation in the given locale.
      Specified by:
      toString in interface org.opengis.util.InternationalString
    • toString

      public String toString()
      Builds, caches and returns the unlocalized string representation of this range.
      Specified by:
      toString in interface CharSequence
      Specified by:
      toString in interface org.opengis.util.InternationalString
      Overrides:
      toString in class Range<E extends Number & Comparable<? super E>>
      See Also:
    • length

      public int length()
      Returns the length of the unlocalized string.
      Specified by:
      length in interface CharSequence
    • charAt

      public char charAt(int index)
      Returns the character at the given index in the unlocalized string.
      Specified by:
      charAt in interface CharSequence
    • subSequence

      public CharSequence subSequence(int start, int end)
      Returns a subsequence of the unlocalized string representation.
      Specified by:
      subSequence in interface CharSequence
    • compareTo

      public int compareTo(org.opengis.util.InternationalString o)
      Compares the unlocalized string representations. In the special case where the other instance is a DomainRange, actually compares the numerical values for better ordering.
      Specified by:
      compareTo in interface Comparable<E extends Number & Comparable<? super E>>
    • compareTo

      private int compareTo(DomainRange<?> range)
      Compares this range with the given range object for ordering of minimal values, or maximal values if two ranges have the same minimum value.

      Notes:

      • This method requires DomainRange instance rather than more generic NumberRange in order to ensure reciprocity: A.compareTo(B) == -B.compareTo(A).
      • This ordering is appropriate for DomainRange because it is close to the ordering of their string representations, but is otherwise not provided for general Range objects because the ordering criterion would be arbitrary for them (what would be the best ordering of overlapping ranges?).