⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parallelogramwindow.java

📁 用java写的DTW程序组合
💻 JAVA
字号:
// 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:   ParallelogramWindow.java

package dtw;

import timeseries.TimeSeries;

// Referenced classes of package dtw:
//            SearchWindow

public class ParallelogramWindow extends SearchWindow
{

    public ParallelogramWindow(TimeSeries tsI, TimeSeries tsJ, int searchRadius)
    {
        super(tsI.size(), tsJ.size());
        double upperCornerI = Math.max((double)maxI() / 2D - (double)searchRadius * ((double)maxI() / (double)maxJ()), minI());
        double upperCornerJ = Math.min((double)maxJ() / 2D + (double)searchRadius * ((double)maxJ() / (double)maxI()), maxJ());
        double lowerCornerI = Math.min((double)maxI() / 2D + (double)searchRadius * ((double)maxI() / (double)maxJ()), maxI());
        double lowerCornerJ = Math.max((double)maxJ() / 2D - (double)searchRadius * ((double)maxJ() / (double)maxI()), minJ());
        for(int i = 0; i < tsI.size(); i++)
        {
            boolean isIlargest = tsI.size() >= tsJ.size();
            int maxJ;
            if((double)i < upperCornerI)
            {
                if(isIlargest)
                {
                    double interpRatio = (double)i / upperCornerI;
                    maxJ = (int)Math.round(interpRatio * upperCornerJ);
                } else
                {
                    double interpRatio = (double)(i + 1) / upperCornerI;
                    maxJ = (int)Math.round(interpRatio * upperCornerJ) - 1;
                }
            } else
            if(isIlargest)
            {
                double interpRatio = ((double)i - upperCornerI) / ((double)maxI() - upperCornerI);
                maxJ = (int)Math.round(upperCornerJ + interpRatio * ((double)maxJ() - upperCornerJ));
            } else
            {
                double interpRatio = ((double)(i + 1) - upperCornerI) / ((double)maxI() - upperCornerI);
                maxJ = (int)Math.round(upperCornerJ + interpRatio * ((double)maxJ() - upperCornerJ)) - 1;
            }
            int minJ;
            if((double)i <= lowerCornerI)
            {
                double interpRatio = (double)i / lowerCornerI;
                minJ = (int)Math.round(interpRatio * lowerCornerJ);
            } else
            {
                double interpRatio = ((double)i - lowerCornerI) / ((double)maxI() - lowerCornerI);
                minJ = (int)Math.round(lowerCornerJ + interpRatio * ((double)maxJ() - lowerCornerJ));
            }
            super.markVisited(i, minJ);
            super.markVisited(i, maxJ);
        }

    }
}

⌨️ 快捷键说明

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