// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3) fieldsfirst 
// Source File Name:   Sinc.java

package lt.ktu.gmj.tasks;

import lt.ktu.gmj.*;
import lt.ktu.gmj.propertySheet.*;

// Referenced classes of package lt.ktu.gmj.tasks:
//			SincDomain

public class Sinc extends AbstractTask
	implements TaskWithAnalyzers
{

	private SincDomain domain;
	public double multiplier;
	public int function;

	public Sinc()
	{
		domain = new SincDomain();
		multiplier = 1.0D;
		function = 0;
	}

	public Class[] analyzers()
		throws ClassNotFoundException
	{
		Class spectrumClass = Class.forName("lt.ktu.gmj.analysis.Spectrum");
		return (new Class[] {
			spectrumClass
		});
	}

	public void customize(PropertyManager manager)
	{
		String functions[] = {
			"( sin[x] ) / n"
		};
		manager.add(new DoubleProperty("Multiplier", new FieldProvider(this, "multiplier"), 0.10000000000000001D, 1000D));
		manager.add(new ChoiceProperty("Function", new FieldProvider(this, "function"), functions));
	}

	public Domain domain()
	{
		return domain;
	}

	public IResult f(Point pt)
	{
		double y = 0.0D;
		for(int i = 0; i < pt.x.length - 1; i++)
			y += Math.sin(pt.x[i]) * multiplier;

		return new SimpleResult(y / (double)(pt.x.length - 1));
	}
}
