<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package integral;

import java.rmi.RemoteException;

public abstract class Quadrature implements IntegralService {
	protected Double eps;
	abstract protected Double rule(Function&lt;Double, Double&gt; f, Double a, Double b);
	
	public Quadrature(Double eps) {
		super();
		this.eps = eps;
	}

	@Override
	public Double compute(Function&lt;Double, Double&gt; f, Range&lt;Double&gt; interval)
	throws RemoteException {
		double start = interval.getBegin();
		double end = interval.getEnd();

		double acc = 0.0;
		double a = start;
		double b = a + eps;
		while(b &lt; end) {
			acc = acc + rule(f, a, b);
			a = b;
			b = a + eps;
		}
		b = end;
		acc = acc + rule(f, a, b);

		return acc;
	}


}
</pre></body></html>