An
EventList
that shows a range of the elements of the source
EventList
. Each element in the source
EventList
is assigned
an integer value via an
ThresholdList.Evaluator
. This integer is used
to determine whether the element fits in the
ThresholdList
s range.
By modifying the upper and lower thresholds in the range, the list can
be filtered in a simple and powerful way.
The
ThresholdList
lends itself to use with a slider widget for
manipulating one of the range's endpoints.
One use case for
ThresholdList
is in a media player application.
By creating a
ThresholdList.Evaluator
for a song's bitrate, the user could
limit results to MP3 files between 192 and 320kbps.
Note that the elements in the
ThresholdList
will be presented in
order sorted by their
ThresholdList.Evaluator
value.
This
EventList
supports all write operations.
Warning: This class
breaks the contract required by
java.util.List
. See
EventList
for an example.
Warning: This class is
thread ready but not thread safe. See
EventList
for an example
of thread safe code.
EventList Overview |
Writable: | yes |
Concurrency: | thread ready, not thread safe |
Performance: | reads: O(log N), writes O(log N), change threshold O(log N) |
Memory: | 72 bytes per element |
Unit Tests: | N/A |
Issues: |
47
137
217
218
246
277
|
getEvaluator
public Evaluator getEvaluator()
getLowerThreshold
public int getLowerThreshold()
Gets the lower threshold for this list
getUpperThreshold
public int getUpperThreshold()
Gets the upper threshold for this list
setLowerThreshold
public void setLowerThreshold(E object)
Sets the lower threshold for this list to be the result of calling
evaluate()
on the given object.
This list can be used programmatically rather than hooking it up to
a UI component.
Calling this method directly while this list
is connected to a particular widget could result in errors.
Warning: This method is
thread ready but not thread safe. See
EventList
for an example
of thread safe code.
setLowerThreshold
public void setLowerThreshold(int lowerThreshold)
Sets the lower threshold for this list.
This list can be used programmatically rather than hooking it up to
a UI component.
Calling this method directly while this list
is connected to a particular widget could result in errors.
Warning: This method is
thread ready but not thread safe. See
EventList
for an example
of thread safe code.
setUpperThreshold
public void setUpperThreshold(E object)
Sets the upper threshold for this list to be the result of calling
evaluate()
on the given object.
This list can be used programmatically rather than hooking it up to
a UI component.
Calling this method directly while this list
is connected to a particular widget could result in errors.
Warning: This method is
thread ready but not thread safe. See
EventList
for an example
of thread safe code.
setUpperThreshold
public void setUpperThreshold(int upperThreshold)
Sets the upper threshold for this list.
Warning: This method is
thread ready but not thread safe. See
EventList
for an example
of thread safe code.