net.sf.jga.fn.logical

Class BinaryNegate<T1,T2>

public class BinaryNegate<T1,T2> extends AbstractBinaryPredicate<T1,T2> implements Serializable

Binary Predicate that logically negates the result of a child predicate. Returns true when child predicate p returns false given object arguments x and y.

Copyright © 2002 David A. Hall

Author: David A. Hall

Nested Class Summary
interfaceBinaryNegate.Visitor
Interface for classes that may interpret a BinaryNegate predicate.
Constructor Summary
BinaryNegate(BinaryFunctor<? super T1,? super T2,Boolean> p)
Builds a BinaryNegate predicate wrapping the given Binary Predicate.
Method Summary
voidaccept(Visitor v)
Calls the Visitor's visit(UnaryNegate) method, if it implements the nested Visitor interface.
BinaryFunctor<? super T1,? super T2,Boolean>getPredicate()
Returns the child predicate.
booleanp(T1 x, T2 y)
Given arguments x and y, returns true when child predicate p returns false for x and y, otherwise returns true.
StringtoString()

Constructor Detail

BinaryNegate

public BinaryNegate(BinaryFunctor<? super T1,? super T2,Boolean> p)
Builds a BinaryNegate predicate wrapping the given Binary Predicate.

Throws: IllegalArgumentException when no child predicate is given

Method Detail

accept

public void accept(Visitor v)
Calls the Visitor's visit(UnaryNegate) method, if it implements the nested Visitor interface.

getPredicate

public BinaryFunctor<? super T1,? super T2,Boolean> getPredicate()
Returns the child predicate.

Returns: the child predicate.

p

public boolean p(T1 x, T2 y)
Given arguments x and y, returns true when child predicate p returns false for x and y, otherwise returns true.

Returns: !(p.p(x,y))

toString

public String toString()