org.jnetstream.filter
Class Filter.MAXIMUM<T extends FilterTarget>
java.lang.Object
org.jnetstream.filter.Filter.MAXIMUM<T>
- All Implemented Interfaces:
- Filter<T>
- Enclosing interface:
- Filter<T extends FilterTarget>
public static final class Filter.MAXIMUM<T extends FilterTarget>
- extends java.lang.Object
- implements Filter<T>
Returns the larger value either returned by the filter or the supplied max
value. The returned length from execute(java.nio.ByteBuffer, T) method is guarrantted not
to be smaller then maximum length.
- Author:
- Mark Bednarczyk, Sly Technologies, Inc.
| Fields inherited from interface org.jnetstream.filter.Filter |
TRUE |
|
Method Summary |
boolean |
accept(java.nio.ByteBuffer buffer,
T target)
Will always return true unless the supplied maximum is non-zero. |
long |
execute(java.nio.ByteBuffer buffer,
T target)
The execute method will return the larger of either the evaluated value
from the source filter or the supplied maximum. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Filter.MAXIMUM
public Filter.MAXIMUM(Filter<T> filter,
long maximum)
- Parameters:
filter - source filter who's values will be NOTed
accept
public boolean accept(java.nio.ByteBuffer buffer,
T target)
throws FilterException
- Will always return true unless the supplied maximum is non-zero. If the
supplied maximum is non zero, then no matter what the value from the
source filter is, the non zero maximum value will cause this method to
return true. If the maximum value is 0, then true will be returned if the
evaluated source filter length is non zero. If the evaluted source filter
length was zero and minimum zero, then false would be returned.
- Specified by:
accept in interface Filter<T extends FilterTarget>
- Parameters:
buffer - buffer to execute ontarget - the target specific filter
- Returns:
- maximum of the source and the value supplied
- Throws:
FilterException- See Also:
Filter.accept(java.nio.ByteBuffer,
org.jnetstream.filter.FilterTarget)
execute
public long execute(java.nio.ByteBuffer buffer,
T target)
throws FilterException
- The execute method will return the larger of either the evaluated value
from the source filter or the supplied maximum. So if the source filter
returned 100 and the maximum was 10, the value returned would be 100. If
the source filter returned 5 and maximum was 10, then 10 would be
returned.
- Specified by:
execute in interface Filter<T extends FilterTarget>
- Parameters:
buffer - buffer to execute ontarget - the target specific filter
- Returns:
- maximum of either the source filter length or value supplied
- Throws:
FilterException - TODO- See Also:
Filter.execute(java.nio.ByteBuffer,
org.jnetstream.filter.FilterTarget)