Package org.apache.sis.metadata
Class DomainRange<E extends Number & Comparable<? super E>>
java.lang.Object
org.apache.sis.measure.Range<E>
org.apache.sis.measure.NumberRange<E>
org.apache.sis.metadata.DomainRange<E>
- Type Parameters:
E
- the type of range elements as a subclass ofNumber
.
- 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 Summary
FieldsModifier and TypeFieldDescriptionprivate static final long
For cross-version compatibility.private String
The locale-independent string representation, built bytoString()
when first needed. -
Constructor Summary
ConstructorsConstructorDescriptionDomainRange
(Class<E> type, ValueRange range) Constructs a range of the given type with values from the given annotation. -
Method Summary
Modifier and TypeMethodDescriptionchar
charAt
(int index) Returns the character at the given index in the unlocalized string.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.int
compareTo
(org.opengis.util.InternationalString o) Compares the unlocalized string representations.int
length()
Returns the length of the unlocalized string.subSequence
(int start, int end) Returns a subsequence of the unlocalized string representation.toString()
Builds, caches and returns the unlocalized string representation of this range.Returns the string representation in the given locale.Methods inherited from class org.apache.sis.measure.NumberRange
castOrCopy, castTo, containsAny, containsAny, create, create, create, create, create, create, create, createBestFit, createBestFit, createLeftBounded, getMaxDouble, getMaxDouble, getMedian, getMinDouble, getMinDouble, getSpan, intersectAny, intersectsAny, subtractAny, transform, unionAny
Methods inherited from class org.apache.sis.measure.Range
contains, contains, equals, formatTo, getElementType, getMaxValue, getMinValue, hashCode, intersect, intersects, isBounded, isEmpty, isMaxIncluded, isMinIncluded, subtract, union
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.CharSequence
chars, codePoints, isEmpty
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
text
The locale-independent string representation, built bytoString()
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.
-
-
Method Details
-
toString
Returns the string representation in the given locale.- Specified by:
toString
in interfaceorg.opengis.util.InternationalString
-
toString
Builds, caches and returns the unlocalized string representation of this range.- Specified by:
toString
in interfaceCharSequence
- Specified by:
toString
in interfaceorg.opengis.util.InternationalString
- Overrides:
toString
in classRange<E extends Number & Comparable<? super E>>
- See Also:
-
length
public int length()Returns the length of the unlocalized string.- Specified by:
length
in interfaceCharSequence
-
charAt
public char charAt(int index) Returns the character at the given index in the unlocalized string.- Specified by:
charAt
in interfaceCharSequence
-
subSequence
Returns a subsequence of the unlocalized string representation.- Specified by:
subSequence
in interfaceCharSequence
-
compareTo
public int compareTo(org.opengis.util.InternationalString o) Compares the unlocalized string representations. In the special case where the other instance is aDomainRange
, actually compares the numerical values for better ordering.- Specified by:
compareTo
in interfaceComparable<E extends Number & Comparable<? super E>>
-
compareTo
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 genericNumberRange
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 generalRange
objects because the ordering criterion would be arbitrary for them (what would be the best ordering of overlapping ranges?).
- This method requires
-