package jsci.maths.wavelet.splines;

import jsci.maths.*;
import jsci.maths.wavelet.*;

/****************************************
* This class is used to generate piecewise constant
* splines to be used as wavelets or related
* functions. It can also be used for basic
* interpolation.
* @author Daniel Lemire
*****************************************/
public class PiecewiseConstant extends Spline implements Filter, Cloneable  {
	protected final static int filtretype=0;
	private double[] vecteur;
	static final double[]  vg={1d,1d};

  /*******************************
  * Return a String representation
  * of the object
  ********************************/
  public String toString() {
    return(ArrayMath.toString(vecteur));
  }

  /*****************************************
  * Check if another object is equal to this
  * PiecewiseConstant object
  ******************************************/
  public boolean equals(Object a) {
    if(a!=null && (a instanceof PiecewiseConstant) && vecteur.length==((PiecewiseConstant)a).dimension()) {
      PiecewiseConstant iv=(PiecewiseConstant)a;
        for(int i=0;ivecteur.length-1)) {
			throw new IllegalArgumentException("Incorrect parameters : "+i+", "+vecteur.length);
    }
    return(vecteur[i]);
  }

   /*********************************************
   * Set the sampled values of the function
   * to the specified array
   **********************************************/
	public void setValues(double[] v) {
		vecteur=v;
	}

  /******************************************
  * Compute the mass (integral)
  * @param a left boundary of the interval
  * @param b right boundary of the interval
  **********************************************/
	public double mass(double a, double b) {
		double mass=0;
		for(int i=0;i 

Ads help maintain this website.