// 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:   Domain.java

package lt.ktu.gmj;

import lt.ktu.gmj.propertySheet.DoubleArrayProvider;
import lt.ktu.gmj.propertySheet.DoubleRangeProperty;
import lt.ktu.gmj.propertySheet.Header;
import lt.ktu.gmj.propertySheet.PropertyManager;

// Referenced classes of package lt.ktu.gmj:
//			Customizable, Point

public abstract class Domain
	implements Customizable
{

	public double min[];
	public double max[];
	public Point defaultPoint;

	public abstract String[] dimensions();

	public void customize(PropertyManager propertymanager)
	{
		String as[] = {
			"Min", "Default", "Max"
		};
		propertymanager.add(new Header("Dimension", as));
		for(int i = 0; i < dimensions().length; i++)
			propertymanager.add(new DoubleRangeProperty(dimensions()[i] + " (x" + (i + 1) + ")", new DoubleArrayProvider(min, i), new DoubleArrayProvider(defaultPoint.x, i), new DoubleArrayProvider(max, i)));

	}

	public double constraintAt(int i, Point point)
	{
		return (double)1;
	}

	public final void normalizePoint(Point point)
	{
		for(int i = 0; i < point.x.length; i++)
			point.x[i] = point.x[i] * (max[i] - min[i]) + min[i];

	}

	public Domain()
	{
		min = new double[dimensions().length];
		max = new double[dimensions().length];
		defaultPoint = new Point(this);
	}
}
