windowmatrix.java

来自「用java写的DTW程序组合」· Java 代码 · 共 58 行

JAVA
58
字号
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   WindowMatrix.java

package dtw;

import java.io.PrintStream;

// Referenced classes of package dtw:
//            MemoryResidentMatrix, SwapFileMatrix, CostMatrix, SearchWindow

class WindowMatrix
    implements CostMatrix
{

    private CostMatrix windowCells;

    WindowMatrix(SearchWindow searchWindow)
    {
        try
        {
            windowCells = new MemoryResidentMatrix(searchWindow);
        }
        catch(OutOfMemoryError e)
        {
            System.err.println("Ran out of memory initializing window matrix, all cells in the window cannot fit into main memory.  Will use a swap file instead (will run ~50% slower)");
            System.gc();
            windowCells = new SwapFileMatrix(searchWindow);
        }
    }

    public void put(int col, int row, double value)
    {
        windowCells.put(col, row, value);
    }

    public double get(int col, int row)
    {
        return windowCells.get(col, row);
    }

    public int size()
    {
        return windowCells.size();
    }

    public void freeMem()
    {
        if(windowCells instanceof SwapFileMatrix)
            try
            {
                ((SwapFileMatrix)windowCells).freeMem();
            }
            catch(Throwable t) { }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?