public class ThresholdMatcherEditor<E,T> extends AbstractMatcherEditor<E>
MatcherEditor
that filters elements based on whether they are greater than or less than
a threshold. The implementation is based on elements implementing Comparable
unless the
constructor specifies a Comparator
.
By default the elements themselves are compared with the threshold value, however, an optional
Function can be provided which can be used to extract a value that is appropriate for comparison
with the threshold. In this way, ThreshholdMatcherEditor provides a level of indirection when
locating the exact value to compare for a given element.MatcherEditor.Event<E>, MatcherEditor.Listener<E>
Modifier and Type | Field and Description |
---|---|
static org.jadice.util.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation |
EQUAL |
static org.jadice.util.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation |
GREATER_THAN |
static org.jadice.util.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation |
GREATER_THAN_OR_EQUAL |
static org.jadice.util.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation |
LESS_THAN |
static org.jadice.util.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation |
LESS_THAN_OR_EQUAL |
static org.jadice.util.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation |
NOT_EQUAL |
Constructor and Description |
---|
ThresholdMatcherEditor()
Construct an instance that will require elements to be greater than the threshold (which is not
initially set) and relies on the threshold object and elements in the list implementing
Comparable . |
ThresholdMatcherEditor(T threshold)
Construct an instance that will require elements to be greater than the given threshold and
relies on the threshold object and elements in the list implementing
Comparable . |
ThresholdMatcherEditor(T threshold,
org.jadice.util.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation operation)
Construct an instance that will require elements to be greater than the given threshold and
relies on the threshold object and elements in the list implementing
Comparable . |
ThresholdMatcherEditor(T threshold,
org.jadice.util.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation operation,
Comparator<T> comparator)
Construct an instance.
|
ThresholdMatcherEditor(T threshold,
org.jadice.util.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation operation,
Comparator<T> comparator,
FunctionList.Function<E,T> function)
Construct an instance.
|
Modifier and Type | Method and Description |
---|---|
Comparator<T> |
getComparator() |
org.jadice.util.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation |
getMatchOperation()
|
T |
getThreshold()
See
getThreshold() . |
void |
setComparator(Comparator<T> comparator)
Update the comparator.
|
void |
setMatchOperation(org.jadice.util.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation operation)
Update the operation used to determine what relation list elements should have to the threshold
in order to match (i.e.
|
void |
setThreshold(T threshold)
Update the threshold used to determine what is matched by the list.
|
fireChanged, fireConstrained, fireMatchAll, fireMatchNone, fireRelaxed, getMatcher, isCurrentlyMatchingAll, isCurrentlyMatchingNone
addMatcherEditorListener, createChangedEvent, createConstrainedEvent, createMatchAllEvent, createMatchNoneEvent, createRelaxedEvent, fireChangedMatcher, removeMatcherEditorListener
public static final org.jadice.util.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation GREATER_THAN
public static final org.jadice.util.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation GREATER_THAN_OR_EQUAL
public static final org.jadice.util.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation LESS_THAN
public static final org.jadice.util.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation LESS_THAN_OR_EQUAL
public static final org.jadice.util.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation EQUAL
public static final org.jadice.util.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation NOT_EQUAL
public ThresholdMatcherEditor()
Comparable
.public ThresholdMatcherEditor(T threshold)
Comparable
.threshold
- the initial threshold, or null if none.public ThresholdMatcherEditor(T threshold, org.jadice.util.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation operation)
Comparable
.threshold
- the initial threshold, or null if none.operation
- the operation to determine what relation list elements should have to the
threshold in order to match (i.e., be visible). Specifying null will use
GREATER_THAN
.public ThresholdMatcherEditor(T threshold, org.jadice.util.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation operation, Comparator<T> comparator)
threshold
- rhe initial threshold, or null if none.operation
- rhe operation to determine what relation list elements should have to the
threshold in order to match (i.e., be visible). Specifying null will use
GREATER_THAN
.comparator
- determines how objects compare. If null, the threshold object and list
elements must implement Comparable
.public ThresholdMatcherEditor(T threshold, org.jadice.util.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation operation, Comparator<T> comparator, FunctionList.Function<E,T> function)
threshold
- the initial threshold, or null if none.operation
- the operation to determine what relation list elements should have to the
threshold in order to match (i.e., be visible). Specifying null will use
GREATER_THAN
.comparator
- determines how objects compare with the threshold value. If null, the
threshold object and list elements must implement Comparable
.function
- an optional Function which produces a value fit to be compared against the
threshold. This argument is optional, and if it is null
, the raw values will
compared against the threshold.public T getThreshold()
getThreshold()
.public void setThreshold(T threshold)
match operation
determines what's matched.threshold
- The threshold, or null to match everything.public org.jadice.util.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation getMatchOperation()
public void setMatchOperation(org.jadice.util.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation operation)
GREATER_THAN
,
GREATER_THAN_OR_EQUAL
,
LESS_THAN
,
LESS_THAN_OR_EQUAL
,
EQUAL
,
NOT_EQUAL
public Comparator<T> getComparator()
public void setComparator(Comparator<T> comparator)
Comparable
.Copyright © 2024 levigo holding gmbh. All rights reserved.