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

📄 b.java

📁 二维QR条码项目的J2ME源代码。软件包括1.核心QR码编/解库
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
// Decompiled by DJ v3.9.9.91 Copyright 2005 Atanas Neshkov  Date: 12/6/2006 9:53:46 AM
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 

package jp.sourceforge.qrcode.reader.pattern;

import java.util.Vector;
import jp.sourceforge.qrcode.exception.c;
import jp.sourceforge.qrcode.exception.d;
import jp.sourceforge.qrcode.exception.e;
import jp.sourceforge.qrcode.geom.a;

public final class b
{

    public static b a(boolean aflag[][])
        throws jp.sourceforge.qrcode.exception.b, c
    {
        jp.sourceforge.qrcode.geom.c ac[];
        jp.sourceforge.qrcode.geom.c ac1[];
        a aa[];
        int ai[] = a(aa = b(ac1 = a(ac = b(aflag))));
        aa = a(aa, ai);
        int ai1[] = a(aflag, aa);
        int ai2[] = {
            (ai1[1] << jp.sourceforge.qrcode.reader.b.a) / 7, (ai1[2] << jp.sourceforge.qrcode.reader.b.a) / 7
        };
        int i;
        if((i = b(aa, ai1)) > 6)
            i = a(aa, ai, ai2, aflag);
        return new b(aa, i, ai, ai1, ai2[0]);
    }

    private b(a aa[], int i, int ai[], int ai1[], int j)
    {
        b = aa;
        c = i;
        d = ai;
        e = j;
    }

    public final a[] a()
    {
        return b;
    }

    public final a a(int i)
    {
        if(i >= 0 && i <= 2)
            return b[i];
        else
            return null;
    }

    public final int[] b()
    {
        return d;
    }

    public final int c()
    {
        return c;
    }

    public final int d()
    {
        return e;
    }

    public final int e()
    {
        return 17 + 4 * c;
    }

    private static jp.sourceforge.qrcode.geom.c[] b(boolean aflag[][])
    {
        boolean aflag1[] = {
            false, false, true, false, true, false
        };
        int i2 = aflag.length;
        int j2 = aflag[0].length;
        Vector vector = new Vector();
        int ai[] = new int[5];
        for(int i3 = 0; i3 < j2; i3++)
        {
            int k3;
            ai[k3 = 0] = 0;
            int i4 = 1;
            boolean flag2 = false;
            for(int k2 = 0; k2 < i2; k2++)
            {
                boolean flag;
                if((flag = aflag[k2][i3]) == flag2)
                {
                    ai[k3]++;
                    continue;
                }
                if(flag == aflag1[i4])
                    do
                    {
                        if(i4 <= 2)
                            break;
                        if(a(ai, k3, i4))
                        {
                            if(i4 != 5)
                                break;
                            int i = k2;
                            for(int k4 = 0; k4 < 5; k4++)
                                i -= ai[k4];

                            int i1 = k2 - 1;
                            int k1;
                            int k = k1 = i3;
                            vector.addElement(new jp.sourceforge.qrcode.geom.c(i, k, i1, k1));
                            i4 -= 2;
                        } else
                        {
                            i4 -= 2;
                        }
                    } while(true);
                else
                    i4--;
                i4++;
                k3 = (k3 + 1) % 5;
                ai[k3] = 1;
                flag2 = !flag2;
            }

        }

        for(int l2 = 0; l2 < i2; l2++)
        {
            int l3;
            ai[l3 = 0] = 0;
            int j4 = 1;
            boolean flag3 = false;
            for(int j3 = 0; j3 < j2; j3++)
            {
                boolean flag1;
                if((flag1 = aflag[l2][j3]) == flag3)
                {
                    ai[l3]++;
                    continue;
                }
                if(flag1 == aflag1[j4])
                    do
                    {
                        if(j4 <= 2)
                            break;
                        if(a(ai, l3, j4))
                        {
                            if(j4 != 5)
                                break;
                            int j1;
                            int j = j1 = l2;
                            int l = j3;
                            for(int l4 = 0; l4 < 5; l4++)
                                l -= ai[l4];

                            int l1 = j3 - 1;
                            vector.addElement(new jp.sourceforge.qrcode.geom.c(j, l, j1, l1));
                            j4 -= 2;
                        } else
                        {
                            j4 -= 2;
                        }
                    } while(true);
                else
                    j4--;
                j4++;
                l3 = (l3 + 1) % 5;
                ai[l3] = 1;
                flag3 = !flag3;
            }

        }

        jp.sourceforge.qrcode.geom.c ac[] = new jp.sourceforge.qrcode.geom.c[vector.size()];
        for(int i5 = 0; i5 < ac.length; i5++)
            ac[i5] = (jp.sourceforge.qrcode.geom.c)vector.elementAt(i5);

        return ac;
    }

    private static boolean a(int ai[], int i, int j)
    {
        int ai1[] = {
            1, 1, 3, 1, 1
        };
        int ai2[] = {
            1, 2, 5, 6, 7
        };
        int k = j - 1;
        int l = 0;
        for(int l1 = 0; l1 < j; l1++)
            l += ai[(((i + 5) - k) + l1) % 5];

        l = (l <<= jp.sourceforge.qrcode.reader.b.a) / ai2[k];
        for(int i2 = 0; i2 < j; i2++)
        {
            int i1 = l * ai1[i2] - l / 2;
            int j1 = l * ai1[i2] + l / 2;
            i1 -= l / 8;
            j1 += l / 8;
            int k1;
            if((k1 = ai[(((i + 5) - k) + i2) % 5] << jp.sourceforge.qrcode.reader.b.a) < i1 || k1 > j1)
                return false;
        }

        return true;
    }

    private static jp.sourceforge.qrcode.geom.c[] a(jp.sourceforge.qrcode.geom.c ac[])
    {
        int i;
        int j = (i = ac.length) - 1;
        int ai[] = new int[i];
        int ai1[] = new int[i];
        int l = 0;
        boolean aflag[] = new boolean[i];
        for(int i1 = 0; i1 < j; i1++)
        {
            if(aflag[i1])
                continue;
            int k = 0;
            k++;
            ai[0] = i1;
            int j1 = i1;
            for(int l1 = i1 + 1; l1 < i; l1++)
            {
                if(aflag[l1])
                    continue;
                if(jp.sourceforge.qrcode.geom.c.a(ac[j1], ac[l1]))
                {
                    j1 = ai[k++] = l1;
                    if(l1 != j || k * 5 <= ac[j1].e())
                        continue;
                    ai1[l++] = ai[k / 2];
                    for(int i2 = 0; i2 < k; i2++)
                        aflag[ai[i2]] = true;

                    continue;
                }
                if(l1 != j && !a(ac[j1], ac[l1]))
                    continue;
                if(k * 6 <= ac[j1].e())
                    break;
                ai1[l++] = ai[k / 2];
                for(int j2 = 0; j2 < k; j2++)
                    aflag[ai[j2]] = true;

                break;
            }

        }

        jp.sourceforge.qrcode.geom.c ac1[] = new jp.sourceforge.qrcode.geom.c[l];
        for(int k1 = 0; k1 < l; k1++)
        {
            jp.sourceforge.qrcode.geom.c c1 = ac[ai1[k1]];
            ac1[k1] = new jp.sourceforge.qrcode.geom.c(c1.a, c1.b, c1.c, c1.d);
        }

        return ac1;
    }

    private static boolean a(jp.sourceforge.qrcode.geom.c c1, jp.sourceforge.qrcode.geom.c c2)
    {
        if(jp.sourceforge.qrcode.geom.c.b(c1, c2))
            return true;
        if(c1.c())
            return Math.abs(c1.b - c2.b) > 1;
        return Math.abs(c1.a - c2.a) > 1;
    }

    private static int[] a(a aa[])
    {
        a a1;
        a a2;
label0:
        {
            jp.sourceforge.qrcode.geom.c ac[] = new jp.sourceforge.qrcode.geom.c[3];
            for(int i = 0; i < ac.length; i++)
                ac[i] = new jp.sourceforge.qrcode.geom.c(aa[i], aa[(i + 1) % ac.length]);

            jp.sourceforge.qrcode.geom.c c1 = jp.sourceforge.qrcode.geom.c.a(ac);
            a1 = new a();
            int j = 0;
            do
            {
                if(j >= aa.length)
                    break;
                if((aa[j].a != c1.a || aa[j].b != c1.b) & (aa[j].a != c1.c || aa[j].b != c1.d))
                {
                    a1 = aa[j];
                    break;
                }
                j++;
            } while(true);
            new a();
            a2 = null;
            if((a1.b <= c1.b) & (a1.b <= c1.d))
            {
                if(c1.a >= c1.c)
                {
                    a2 = c1.a();
                    break label0;
                }
            } else
            if((a1.a >= c1.a) & (a1.a >= c1.c))
            {
                if(c1.b >= c1.d)
                {
                    a2 = c1.a();
                    break label0;
                }
            } else
            {
                if((a1.b >= c1.b) & (a1.b >= c1.d))
                {
                    if(c1.a < c1.c)
                        a2 = c1.a();
                    else
                        a2 = c1.b();
                    break label0;
                }
                if(c1.b < c1.d)

⌨️ 快捷键说明

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