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

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

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

Inverts the values returned by a source filter.

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.NOT(Filter<T> filter)
           
 
Method Summary
 boolean accept(java.nio.ByteBuffer buffer, T target)
          Value of the source filter is inverted.
 long execute(java.nio.ByteBuffer buffer, T target)
          The execute method will invert the returned length to either Long.MAX_VALUE or 0.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Filter.NOT

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

accept

public boolean accept(java.nio.ByteBuffer buffer,
                      T target)
               throws FilterException
Value of the source filter is inverted. If the source filter returns true this accept() will return false. If the source filter returns false, this accept() will return true;

Specified by:
accept in interface Filter<T extends FilterTarget>
Parameters:
buffer - buffer to execute on
target - the target specific filter
Returns:
opposite of boolean value returned from source filter
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 invert the returned length to either Long.MAX_VALUE or 0. If the source filter returns a length of 0 the value is inverted and returned by accept() as Long.MAX_VALUE. If the source filter returned a non zero value, a zero will be returned.

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