import java.rmi.*;
import java.rmi.server.UnicastRemoteObject;

// This appears in Core Web Programming from
// Prentice Hall Publishers, and may be freely used
// or adapted. 1997 Marty Hall, hall@apl.jhu.edu.

/** The actual implementation of the RemoteIntegral
 *  interface.
 * @see Integral
 */

public class RemoteIntegralImpl
       extends UnicastRemoteObject
       implements RemoteIntegral {
         
  /** Constructor must throw RemoteException. */
         
  public RemoteIntegralImpl() throws RemoteException {}

  /** Returns the sum of f(x) from x=start to x=stop,
   *  where the function f is defined by the evaulate
   *  method of the Evaluatable object.
   */
         
  public double sum(double start, double stop,
                    double stepSize,
                    Evaluatable evalObj) {
    return(Integral.sum(start, stop, stepSize, evalObj));
  }
         
  /** Returns an approximation of the integral of f(x)
   *  from start to stop using the midpoint rule.
   *  The function f is defined by the evaulate method
   *  of the Evaluatable object.
   * @see #sum
   */
  
  public double integrate(double start,
                          double stop,
                          int numSteps,
                          Evaluatable evalObj) {
    return(Integral.integrate(start, stop,
                              numSteps, evalObj));
  }
}

