com.levigo.util.base.glazedlists.matchers
Class RangeMatcherEditor<D extends Comparable,E>

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

public class RangeMatcherEditor<D extends Comparable,E>
extends AbstractMatcherEditor<E>

A MatcherEditor that produces Matchers which match Objects if they lie within a range of Comparables. This RangeMatcherEditor is not coupled with any UI component that allows the user to edit the range. That job is left to subclasses. This MatcherEditor is fully concrete, and may be used directly by headless applications.

The RangeMatcherEditor requires that either a Filterator appropriate for extracting Comparable objects be specified in its constructor, or that every Object to be matched is a Comparable.

Author:
James Lemieux

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.levigo.util.base.glazedlists.matchers.MatcherEditor
MatcherEditor.Event<E>, MatcherEditor.Listener<E>
 
Field Summary
 
Fields inherited from class com.levigo.util.base.glazedlists.matchers.AbstractMatcherEditor
currentMatcher
 
Constructor Summary
RangeMatcherEditor()
          Creates a RangeMatcherEditor whose Matchers can test only elements which are Comparable objects.
RangeMatcherEditor(Filterator<D,E> filterator)
          Creates a RangeMatcherEditor that matches Objects using the specified Filterator to get the Comparables to search.
 
Method Summary
 Filterator<D,E> getFilterator()
          Get the filterator used to extract Comparables from the matched elements.
 void setRange(D newStart, D newEnd)
          This method is used to change the range currently matched by this MatcherEditor.
 
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
 

Constructor Detail

RangeMatcherEditor

public RangeMatcherEditor()
Creates a RangeMatcherEditor whose Matchers can test only elements which are Comparable objects.

The Matchers from this MatcherEditor will throw a ClassCastException when Matcher.matches(E) is called with an Object that is not a Comparable.


RangeMatcherEditor

public RangeMatcherEditor(Filterator<D,E> filterator)
Creates a RangeMatcherEditor that matches Objects using the specified Filterator to get the Comparables to search.

Parameters:
filterator - the object that will extract filter Comparables from each object in the source; null indicates the list elements are Comparables
Method Detail

getFilterator

public Filterator<D,E> getFilterator()
Get the filterator used to extract Comparables from the matched elements.


setRange

public void setRange(D newStart,
                     D newEnd)
This method is used to change the range currently matched by this MatcherEditor. When a change to the range is detected, users of this class are expected to call this method with the new bounds of the range to be matched.

null values for either newStart or newEnd indicate there is no start of end to the range respectively. Consequently, calling setRange(null, null) causes this matcher editor match all values it filters.

Note: if newStart and newEnd are out of their natural order with respect to each other, their values are swapped. For example, setRange(Jan 1, 2006, Jan 1, 1955) would swap the values so newStart is Jan 1, 1955 and newEnd is Jan 1, 2006.

Parameters:
newStart - the new value marking the start of the range; null indicates there is no start
newEnd - the new value marking the start of the range; null indicates there is no start


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