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

package lt.ktu.gmj.propertySheet;


// Referenced classes of package lt.ktu.gmj.propertySheet:
//            DoubleRangeProvider, SimplePropertyProvider, InvalidPropertyException, PropertyReader, 
//            PropertyWriter, PropertyNotifier, PropertyKeyer, PropertyProvider

public class DoubleRangePointProvider extends DoubleRangeProvider
{

    public void refresh()
    {
        super.refresh();
        xKeyer.refreshed();
    }

    public void set(Object obj, Object obj1)
        throws InvalidPropertyException
    {
        Double double1 = realXValue == null ? (Double)x.get() : (Double)realXValue;
        double d = ((Double)super.min.get()).doubleValue();
        double d1 = double1.doubleValue();
        double d2 = ((Double)super.max.get()).doubleValue();
        double d3 = ((Double)obj1).doubleValue();
        if (obj == super.min)
        {
            super.min.set(obj1);
            if (d3 > d2)
            {
                super.max.set(obj1);
                super.maxKeyer.refreshed();
            }
            if (d3 > d1)
            {
                x.set(realXValue = obj1);
                xKeyer.refreshed();
            } else
            if (realXValue != null)
            {
                x.set(realXValue);
                xKeyer.refreshed();
                realXValue = null;
            }
        }
        if (obj == super.max)
        {
            super.max.set(obj1);
            if (d3 < d)
            {
                super.min.set(obj1);
                super.minKeyer.refreshed();
            }
            if (d3 < d1)
            {
                x.set(realXValue = obj1);
                xKeyer.refreshed();
            } else
            if (realXValue != null)
            {
                x.set(realXValue);
                xKeyer.refreshed();
                realXValue = null;
            }
        }
        if (obj == x)
        {
            realXValue = obj1;
            if (d3 < d)
                throw new InvalidPropertyException("Out of bounds");
            if (d3 > d2)
                throw new InvalidPropertyException("Out of bounds");
            realXValue = null;
            x.set(obj1);
        }
    }

    public DoubleRangePointProvider(PropertyProvider propertyprovider, PropertyProvider propertyprovider1, PropertyProvider propertyprovider2)
    {
        super(propertyprovider, propertyprovider2);
        realXValue = null;
        x = propertyprovider1;
        x.addObserver(this);
        xKeyer = new PropertyKeyer(this, x);
    }

    private Object realXValue;
    protected PropertyProvider x;
    public PropertyKeyer xKeyer;
}
