public class TLcdDimensionFilter extends Object
ILcdMultiDimensionalModel
interface.
For example, if there is a time dimension and a level dimension, a dimensional filter will contain a single possible
value for time and level.ILcdMultiDimensionalModel
Modifier and Type | Class and Description |
---|---|
static class |
TLcdDimensionFilter.Builder
A builder for filters which reuses filter instances as much as possible.
|
static class |
TLcdDimensionFilter.SnapMode
The snap mode to use when snapping arbitrary intervals to model intervals:
TLcdDimensionFilter.SnapMode.PREVIOUS
TLcdDimensionFilter.SnapMode.NEXT
TLcdDimensionFilter.SnapMode.NEAREST
null indicates no snapping, in which case the model's value needs to match the filter exactly. |
Modifier and Type | Field and Description |
---|---|
static TLcdDimensionFilter |
EMPTY_FILTER
A constant defining the empty filter.
|
Modifier and Type | Method and Description |
---|---|
TLcdDimensionFilter.Builder |
asBuilder()
Returns a builder filled in with the values of this filter.
|
TLcdDimensionFilter |
createSnappingFilter(ILcdMultiDimensionalModel aModel,
TLcdDimensionFilter.SnapMode aSnapMode)
Returns an exact matching filter value in the given model depending on the value of aSnapMode.
|
boolean |
equals(Object aObject) |
TLcdDimensionInterval<?> |
getAndConvertInterval(TLcdDimensionAxis<?> aAxis)
Gets the interval matching a given axis, converting the resulting interval to the given axis' unit if necessary.
|
Set<TLcdDimensionAxis<?>> |
getAxes()
Gets the axes defined by this filter as an unmodifiable set.
|
TLcdDimensionInterval<?> |
getInterval(TLcdDimensionAxis<?> aAxis)
Gets the interval for a given axis defined by this filter.
|
int |
hashCode() |
static TLcdDimensionFilter.Builder |
newBuilder()
Creates a new builder with empty initial values.
|
String |
toString() |
public static final TLcdDimensionFilter EMPTY_FILTER
public Set<TLcdDimensionAxis<?>> getAxes()
null
for a less
strict match based on measure type.
public TLcdDimensionInterval<?> getInterval(TLcdDimensionAxis<?> aAxis)
aAxis
- the axis to get the interval for defined by this filternull
public TLcdDimensionFilter.Builder asBuilder()
null
public static TLcdDimensionFilter.Builder newBuilder()
null
public TLcdDimensionInterval<?> getAndConvertInterval(TLcdDimensionAxis<?> aAxis)
Values can only be converted if the values of the dimension in the filter are TLcdISO19103Measure
.
If not, they remain unconverted.
aAxis
- the axis to match the interval for defined by this filternull
getInterval(TLcdDimensionAxis)
public TLcdDimensionFilter createSnappingFilter(ILcdMultiDimensionalModel aModel, TLcdDimensionFilter.SnapMode aSnapMode)
NEXT
: snaps to the next element.PREVIOUS
: snaps to the previous element.NEAREST
: snaps to the nearest element (next or previous) for Number
and Date
types, as given by TLcdDimensionAxis.getType()
.
In case the filtered dimension is not one of these types, the behavior reverts to NEXT
.null
: no snapping.Snapping does not happen for dimensions which have regular intervals.
This method also uses the non-strict matching of axis given by getAndConvertInterval(TLcdDimensionAxis)
,
rather than the strict match of getInterval(TLcdDimensionAxis)
.
Any snap mode except null enables non-strict axis matching.
This method preserves the values of undefined dimensions to their current setting, rather than resetting them to
the default as applyDimensionFilter
does.
Any snap mode except null enables it.
ILcdMultiDimensionalModel.applyDimensionFilter
with it, you have
the advantages below:
Behavior | applyDimensionFilter | createSnappingFilter -> applyDimensionFilter |
---|---|---|
Snapping | Never, possibly resulting in no matches | Snaps to intervals defined by the model if needed, such that there is always at least one match |
Supported snap modes | None | Nearest, previous, next, or none (null ) |
Filter has less axes than supported by model | Reset to default for those axes | Keep the last current filter value for those axes, so that there are minimal model changes |
Empty filter | Reset to default filter | Keep current filter, so that there are no model changes |
ILcdModel which is not ILcdMultiDimensionalModel |
Not supported | Checks instance of ILcdMultiDimensionalModel , leaves others alone |
aModel
- an ILcdMultiDimensionalModel
instance, never null
aSnapMode
- a snap mode, which may be null
to indicate no snapping