net.sf.jga.fn.arithmetic

Class Modulus<T>

public class Modulus<T extends Number> extends AbstractBinaryFunctor<T,T,T> implements Serializable

Returns the remainder of the division of two integral arguments.

Copyright © 2003 David A. Hall

Author: David A. Hall

Nested Class Summary
interfaceModulus.Visitor
Interface for classes that may interpret a Modulus functor.
Constructor Summary
Modulus(Class c)
Builds Modulus functor for the given class.
Method Summary
voidaccept(Visitor v)
Calls the Visitor's visit(Modulus) method, if it implements the nested Visitor interface.
Tfn(T x, T y)
Given integral arguments x and y, returns x % y
StringtoString()

Constructor Detail

Modulus

public Modulus(Class c)
Builds Modulus functor for the given class. The class argument must be the same as the generic class argument (when generics are in use) or else a ClassCastException will be thrown when the functor is used.

Throws: IllegalArgumentException if the given class has no Arithmetic implementation registered with the ArithmeticFactory

Method Detail

accept

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

fn

public T fn(T x, T y)
Given integral arguments x and y, returns x % y

Returns: the quotient of two numeric arguments

toString

public String toString()