All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.dfki.lt.signalproc.window.DynamicTwoHalvesWindow Maven / Gradle / Ivy

The newest version!
/*
 * ESP Copyright (C) 2013 - 2014 Burton Alexander
 * 
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option) any later
 * version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 51
 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 * 
 */
package de.dfki.lt.signalproc.window;

// TODO: Auto-generated Javadoc
/**
 * The Class DynamicTwoHalvesWindow.
 */
public class DynamicTwoHalvesWindow extends DynamicWindow {
	
	/** The prescale. */
	protected double prescale;

	/**
	 * Instantiates a new dynamic two halves window.
	 *
	 * @param windowType the window type
	 */
	public DynamicTwoHalvesWindow(int windowType) {
		super(windowType);
		prescale = 1.;
	}

	/**
	 * Instantiates a new dynamic two halves window.
	 *
	 * @param windowType the window type
	 * @param prescale the prescale
	 */
	public DynamicTwoHalvesWindow(int windowType, double prescale) {
		super(windowType);
		this.prescale = prescale;
	}

	/**
	 * apply the left half of a window of the specified type to the data. The left
	 * half will be as long as the given len.
	 *
	 * @param data the data
	 * @param off the off
	 * @param len the len
	 */
	public void applyInlineLeftHalf(double[] data, int off, int len) {
		Window w = Window.get(windowType, 2 * len, prescale);
		w.apply(data, off, data, off, 0, len);
	}

	/**
	 * apply the right half of a window of the specified type to the data. The
	 * right half will be as long as the given len.
	 *
	 * @param data the data
	 * @param off the off
	 * @param len the len
	 */
	public void applyInlineRightHalf(double[] data, int off, int len) {
		Window w = Window.get(windowType, 2 * len, prescale);
		w.apply(data, off, data, off, len, len);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy