org.jnetstream.filter
Class Filter.MAXIMUM<T extends FilterTarget>

java.lang.Object
  extended by 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.

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jnetstream.filter.Filter
Filter.AND<T extends FilterTarget>, Filter.MAXIMUM<T extends FilterTarget>, Filter.MINIMUM<T extends FilterTarget>, Filter.NOT<T extends FilterTarget>, Filter.OR<T extends FilterTarget>
 
Field Summary
 
Fields inherited from interface org.jnetstream.filter.Filter
TRUE
 
Constructor Summary
Filter.MAXIMUM(Filter<T> filter, long maximum)
           
 
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
 

Constructor Detail

Filter.MAXIMUM

public Filter.MAXIMUM(Filter<T> filter,
                      long maximum)
Parameters:
filter - source filter who's values will be NOTed
Method Detail

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 on
target - 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 on
target - 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)