public class TLcdVisibilityDescriptor extends Object
Describes how special visibility values should be interpreted. It maps double
visibility values to TLcdVisibilityInterpretation
s and vice versa.
Modifier | Constructor and Description |
---|---|
protected |
TLcdVisibilityDescriptor()
Creates an visibility descriptor with an empty special value mapping.
|
|
TLcdVisibilityDescriptor(Map<Double,TLcdVisibilityInterpretation> aSpecialValueMap)
Creates an visibility descriptor with the specified map.
|
Modifier and Type | Method and Description |
---|---|
static TLcdVisibilityDescriptor |
getDefaultInstance()
Returns the default visibility descriptor with the default mapping.
|
double |
getSpecialValue(TLcdVisibilityInterpretation aInterpretation)
Returns a special value for the specified interpretation.
|
TLcdVisibilityInterpretation |
getSpecialValueInterpretation(double aSpecialValue)
Returns an interpretation for the specified special value.
|
Map<Double,TLcdVisibilityInterpretation> |
getSpecialValueMappingAsMap()
Returns the mapping between special visibility values and visibility interpretations.
|
boolean |
isSpecialValue(double aValue)
Determines whether the specified visibility value is special or not.
|
protected TLcdVisibilityDescriptor()
public TLcdVisibilityDescriptor(Map<Double,TLcdVisibilityInterpretation> aSpecialValueMap)
Creates an visibility descriptor with the specified map. The mapping is required to use keys
of type Double
and values of type TLcdVisibilityInterpretation
.
Note that the map is converted to an unmodifiable map to keep the instance immutable.
aSpecialValueMap
- the special value mapping to be used by this instance.public static TLcdVisibilityDescriptor getDefaultInstance()
Returns the default visibility descriptor with the default mapping. The table
below shows the default mapping:
special visibility value | interpretation |
---|---|
Integer.MIN_VALUE + 1 | INVISIBLE |
Integer.MIN_VALUE + 2 | UNCERTAIN |
Integer.MIN_VALUE + 3 | VISIBLE |
Integer.MIN_VALUE + 4 | CONE_OF_SILENCE |
Integer.MIN_VALUE + 5 | OUTSIDE_SHAPE |
Integer.MIN_VALUE + 6 | NOT_COMPUTED |
Note that the special value interval [ Integer.MIN_VALUE + 1,
Integer.MIN_VALUE + 100 ]
is reserved for future use.
When a special visibility value is required, it is recommended to use the visibility interpretation instead of copying the above values. A visibility descriptor maps the interpretation on a special visibility value.
public Map<Double,TLcdVisibilityInterpretation> getSpecialValueMappingAsMap()
Returns the mapping between special visibility values and visibility interpretations. The
keys of this map are Double
s and represent the special value. The values
of this map are TLcdVisibilityInterpretation
s.
Note that the returned map is unmodifiable. Attempts to modify the map, whether
direct or via its collection views, result in an UnsupportedOperationException
.
public boolean isSpecialValue(double aValue)
TLcdVisibilityInterpretation
is found for that value.aValue
- The visibility value to check.true
if the value is special, false
otherwise.public double getSpecialValue(TLcdVisibilityInterpretation aInterpretation)
Returns a special value for the specified interpretation.
Note that an IllegalArgumentException
is thrown if this
descriptor does not know how to map the specified interpretation.
aInterpretation
- The interpretation to map.IllegalArgumentException
- if this descriptor does not know how to map
the specified interpretation.public TLcdVisibilityInterpretation getSpecialValueInterpretation(double aSpecialValue)
Returns an interpretation for the specified special value.
Note that the specified value is required to be special according to the method
isSpecialValue(double)
, otherwise an IllegalArgumentException
will be thrown.
aSpecialValue
- The special value to map.IllegalArgumentException
- if the specified value is not special.