linearwindow.java

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

JAVA
44
字号
// 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:   LinearWindow.java

package dtw;

import timeseries.TimeSeries;

// Referenced classes of package dtw:
//            SearchWindow

public class LinearWindow extends SearchWindow
{

    private static final int defaultRadius = 0;

    public LinearWindow(TimeSeries tsI, TimeSeries tsJ, int searchRadius)
    {
        super(tsI.size(), tsJ.size());
        double ijRatio = (double)tsI.size() / (double)tsJ.size();
        boolean isIlargest = tsI.size() >= tsJ.size();
        for(int i = 0; i < tsI.size(); i++)
            if(isIlargest)
            {
                int j = Math.min((int)Math.round((double)i / ijRatio), tsJ.size() - 1);
                super.markVisited(i, j);
            } else
            {
                int maxJ = (int)Math.round((double)(i + 1) / ijRatio) - 1;
                int minJ = (int)Math.round((double)i / ijRatio);
                super.markVisited(i, minJ);
                super.markVisited(i, maxJ);
            }

        super.expandWindow(searchRadius);
    }

    public LinearWindow(TimeSeries tsI, TimeSeries tsJ)
    {
        this(tsI, tsJ, 0);
    }
}

⌨️ 快捷键说明

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