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

package lt.ktu.gmj.analysis;

import lt.monarch.chart.AxisMapper;
import lt.monarch.chart.NormalizedMatrix;

public class FrequencyMatrix extends NormalizedMatrix
{

    public FrequencyMatrix(int i, int j, AxisMapper axismapper, AxisMapper axismapper1)
    {
        super(i, j);
        freqData = new int[i * j];
        xMapper = axismapper;
        yMapper = axismapper1;
    }

    public final void addPoint(int i, int j)
    {
        freqData[j * super.resolutionX + i] += 2;
    }

    public final void addPoint(Object obj, Object obj1)
    {
        addPoint((int)((double)(super.resolutionX - 1) * xMapper.map(obj)), (int)((double)(super.resolutionY - 1) * yMapper.map(obj1)));
    }

    public void clear()
    {
        for (int i = 0; i < freqData.length; i++)
            freqData[i] = 0;

        refresh();
    }

    public void refresh()
    {
        int i = 0;
        for (int j = 0; j < super.resolutionY; j++)
        {
            for (int k = 0; k < super.resolutionX; k++)
                super.z[k][j] = Math.log((double)freqData[i++] + 1.0D);

        }

        soften3x3();
        normalize();
    }

    protected int freqData[];
    protected AxisMapper xMapper;
    protected AxisMapper yMapper;
}
