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

java.lang.Object
  extended by org.jnetstream.filter.Filter.MINIMUM<T>
All Implemented Interfaces:
Filter<T>
Enclosing interface:
Filter<T extends FilterTarget>

public static final class Filter.MINIMUM<T extends FilterTarget>
extends java.lang.Object
implements Filter<T>

Returns the smaller value either returned by the filter or the supplied min value. The returned length from execute(java.nio.ByteBuffer, T) method is guarrantted not to be biffer then min 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.MINIMUM(Filter<T> filter, long minimum)
           
 
Method Summary
 boolean accept(java.nio.ByteBuffer buffer, T target)
          Returns true if evaluted expression was true and false if it was false, unless minimum value specified was 0 at which time this method will always return false.
 long execute(java.nio.ByteBuffer buffer, T target)
          The execute method will return the smaller of either the evaluated value from the source filter or the supplied minimum.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Filter.MINIMUM

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

accept

public boolean accept(java.nio.ByteBuffer buffer,
                      T target)
               throws FilterException
Returns true if evaluted expression was true and false if it was false, unless minimum value specified was 0 at which time this method will always return false.

Specified by:
accept in interface Filter<T extends FilterTarget>
Parameters:
buffer - buffer to execute on
target - the target specific filter
Returns:
minimum of the source and minimum 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 smaller of either the evaluated value from the source filter or the supplied minimum. So if the source filter returned 100 and the minimum was 10, the value returned would be 10. If the source filter returned 5 and minimum was 10, then 5 would be returned.

Specified by:
execute in interface Filter<T extends FilterTarget>
Parameters:
buffer - buffer to execute on
target - the target specific filter
Returns:
minimum of either the source filter length or value supplied
Throws:
FilterException - TODO
See Also:
Filter.execute(java.nio.ByteBuffer, org.jnetstream.filter.FilterTarget)