com.levigo.util.base.glazedlists.matchers
Class ThresholdMatcherEditor<E,T>

java.lang.Object
  extended by com.levigo.util.base.glazedlists.matchers.AbstractMatcherEditor<E>
      extended by com.levigo.util.base.glazedlists.matchers.ThresholdMatcherEditor<E,T>
All Implemented Interfaces:
MatcherEditor<E>

public class ThresholdMatcherEditor<E,T>
extends AbstractMatcherEditor<E>

A 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.

Author:
Rob Eden

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.levigo.util.base.glazedlists.matchers.MatcherEditor
MatcherEditor.Event<E>, MatcherEditor.Listener<E>
 
Field Summary
static com.levigo.util.base.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation EQUAL
           
static com.levigo.util.base.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation GREATER_THAN
           
static com.levigo.util.base.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation GREATER_THAN_OR_EQUAL
           
static com.levigo.util.base.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation LESS_THAN
           
static com.levigo.util.base.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation LESS_THAN_OR_EQUAL
           
static com.levigo.util.base.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation NOT_EQUAL
           
 
Constructor Summary
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, com.levigo.util.base.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, com.levigo.util.base.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation operation, Comparator<T> comparator)
          Construct an instance.
ThresholdMatcherEditor(T threshold, com.levigo.util.base.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation operation, Comparator<T> comparator, FunctionList.Function<E,T> function)
          Construct an instance.
 
Method Summary
 Comparator<T> getComparator()
           
 com.levigo.util.base.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation getMatchOperation()
          See setMatchOperation(com.levigo.util.base.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation).
 T getThreshold()
          See getThreshold().
 void setComparator(Comparator<T> comparator)
          Update the comparator.
 void setMatchOperation(com.levigo.util.base.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.
 
Methods inherited from class com.levigo.util.base.glazedlists.matchers.AbstractMatcherEditor
addMatcherEditorListener, fireChanged, fireChangedMatcher, fireConstrained, fireMatchAll, fireMatchNone, fireRelaxed, getMatcher, isCurrentlyMatchingAll, isCurrentlyMatchingNone, removeMatcherEditorListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GREATER_THAN

public static final com.levigo.util.base.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation GREATER_THAN

GREATER_THAN_OR_EQUAL

public static final com.levigo.util.base.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation GREATER_THAN_OR_EQUAL

LESS_THAN

public static final com.levigo.util.base.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation LESS_THAN

LESS_THAN_OR_EQUAL

public static final com.levigo.util.base.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation LESS_THAN_OR_EQUAL

EQUAL

public static final com.levigo.util.base.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation EQUAL

NOT_EQUAL

public static final com.levigo.util.base.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation NOT_EQUAL
Constructor Detail

ThresholdMatcherEditor

public 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

public 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.

Parameters:
threshold - the initial threshold, or null if none.

ThresholdMatcherEditor

public ThresholdMatcherEditor(T threshold,
                              com.levigo.util.base.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.

Parameters:
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.

ThresholdMatcherEditor

public ThresholdMatcherEditor(T threshold,
                              com.levigo.util.base.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation operation,
                              Comparator<T> comparator)
Construct an instance.

Parameters:
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.

ThresholdMatcherEditor

public ThresholdMatcherEditor(T threshold,
                              com.levigo.util.base.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation operation,
                              Comparator<T> comparator,
                              FunctionList.Function<E,T> function)
Construct an instance.

Parameters:
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.
Method Detail

setThreshold

public void setThreshold(T threshold)
Update the threshold used to determine what is matched by the list. This coupled with the match operation determines what's matched.

Parameters:
threshold - The threshold, or null to match everything.

getThreshold

public T getThreshold()
See getThreshold().


setMatchOperation

public void setMatchOperation(com.levigo.util.base.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. be visible). Must be non-null.

See Also:
GREATER_THAN, GREATER_THAN_OR_EQUAL, LESS_THAN, LESS_THAN_OR_EQUAL, EQUAL, NOT_EQUAL

getMatchOperation

public com.levigo.util.base.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation getMatchOperation()
See setMatchOperation(com.levigo.util.base.glazedlists.matchers.ThresholdMatcherEditor.MatchOperation).


setComparator

public void setComparator(Comparator<T> comparator)
Update the comparator. Setting to null will require that thresholds and elements in the list implement Comparable.


getComparator

public Comparator<T> getComparator()


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.