net.sf.jga.fn.logical

Class UnaryNegate<T>

public class UnaryNegate<T> extends AbstractUnaryPredicate<T> implements Serializable

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

Copyright © 2002 David A. Hall

Author: David A. Hall

Nested Class Summary
interfaceUnaryNegate.Visitor
Interface for classes that may interpret a UnaryNegate predicate.
Constructor Summary
UnaryNegate(UnaryFunctor<T,Boolean> p)
Builds a UnaryNegate predicate wrapping the given Unary Predicate.
Method Summary
voidaccept(Visitor v)
Calls the Visitor's visit(UnaryNegate) method, if it implements the nested Visitor interface.
UnaryFunctor<T,Boolean>getPredicate()
Returns the child predicate.
booleanp(T x)
Given argument x, returns true when child predicate p returns false for x, otherwise returns true.
StringtoString()

Constructor Detail

UnaryNegate

public UnaryNegate(UnaryFunctor<T,Boolean> p)
Builds a UnaryNegate predicate wrapping the given Unary 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 UnaryFunctor<T,Boolean> getPredicate()
Returns the child predicate.

Returns: the child predicate.

p

public boolean p(T x)
Given argument x, returns true when child predicate p returns false for x, otherwise returns true.

Returns: !(p.p(x))

toString

public String toString()