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

📄 msi.java

📁 遗传算法改进神经网络源程序 该小程序可以添加条形码功能到你的网页或者applet上,这个applet把大写字母和数字转换为标准的条形码。
💻 JAVA
字号:
// Decompiled by DJ v3.7.7.81 Copyright 2004 Atanas Neshkov  Date: 2007-11-23 16:17:28
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   MSI.java

package com.bokai.barcodes;


// Referenced classes of package com.bokai.barcodes:
//            BarcodeSpec, Barcode, CharDef

class MSI extends BarcodeSpec
{

    MSI()
    {
        super.bdType = 52;
        super.bdTypeName = "MSI/Plessey";
        super.bdStyle = 26;
        super.bdLongBars = 0;
        super.bdCharBitNum = 8;
        super.bdCharNum = 10;
        super.bdTextLen = 0;
        super.bdCentralCharInd = 0;
        super.bdBarExtNum = 2;
        super.bdBarExt = (new byte[] {
            1, 3, 0, 0
        });
        super.bdSpaceExtNum = 2;
        super.bdSpaceExt = (new byte[] {
            1, 3, 0, 0
        });
        super.bdInterCharExt = 0;
        super.bdLeftMargin = 9;
        super.bdTopMargin = 1;
        super.bdRightMargin = 9;
        super.bdBottomMargin = 1;
        super.bdCentralMargin = 0;
        super.bdCharset = (new CharDef[][] {
            _chardef_msi, null, null
        });
        super.bdCharsetSel = null;
        super.bdStyle2 = 0;
        super.bdTextLen2 = 0;
        super.bdCharset2 = null;
        super.bdCharsetSel2 = null;
    }

    static char MsiCheckCharModulo10(char ac[], int i)
    {
        int j = MsiCheckCharSum(ac, i);
        int k = j % 10;
        if(k == 0)
            k = 0;
        else
            k = 10 - k;
        return (char)(k + 48);
    }

    static char MsiCheckCharModulo1010Second(char ac[], int i)
    {
        int j = 0;
        char ac1[] = new char[i + 1];
        for(j = 0; j < i; j++)
            ac1[j] = ac[j];

        ac1[j++] = MsiCheckCharModulo10(ac, i);
        int k = MsiCheckCharSum(ac1, j);
        int l = k % 10;
        if(l == 0)
            l = 0;
        else
            l = 10 - l;
        return (char)(l + 48);
    }

    static char MsiCheckCharModulo11(char ac[], int i)
    {
        int j = 0;
        int i1 = i - 1;
        int k = 2;
        for(; i1 >= 0; i1--)
        {
            j += k * (ac[i1] - 48);
            if(k == 7)
                k = 2;
            else
                k++;
        }

        int l = j % 11;
        if(l == 0)
            l = 0;
        else
            l = 11 - l;
        return (char)(l + 48);
    }

    static char MsiCheckCharModulo1110Second(char ac[], int i)
    {
        int j = i;
        int k = 0;
        char c = MsiCheckCharModulo11(ac, i);
        if(c > '9')
            j += 2;
        else
            j++;
        char ac1[] = new char[j];
        for(k = 0; k < i; k++)
            ac1[k] = ac[k];

        if(c > '9')
        {
            ac1[k++] = '1';
            ac1[k++] = '0';
        } else
        {
            ac1[k++] = c;
        }
        int l = MsiCheckCharSum(ac1, k);
        int i1 = l % 10;
        if(i1 == 0)
            i1 = 0;
        else
            i1 = 10 - i1;
        return (char)(i1 + 48);
    }

    static int MsiCheckCharSum(char ac[], int i)
    {
        int j = 0;
        int k = 0;
        for(int l = i - 1; l >= 0; l -= 2)
        {
            int j1 = k + 2 * (ac[l] - 48);
            j += j1 % 10;
            k = j1 / 10;
        }

        j += k;
        for(int i1 = i - 2; i1 >= 0; i1 -= 2)
            j += ac[i1] - 48;

        return j;
    }

    static int _PLESSEYCODE(int i, int j, int k, int l)
    {
        return _PLESSEY_BIT(l) | _PLESSEY_BIT(k) << 4 | _PLESSEY_BIT(j) << 8 | _PLESSEY_BIT(i) << 12;
    }

    static int _PLESSEYCODE_1(int i)
    {
        return _PLESSEY_BIT(i);
    }

    static int _PLESSEYCODE_2(int i, int j)
    {
        return _PLESSEY_BIT(j) | _PLESSEY_BIT(i) << 4;
    }

    static int _PLESSEY_BIT(int i)
    {
        return i == 0 ? 6 : 12;
    }

    CharDef calcCharDef(CharDef achardef[][], byte abyte0[], char ac[], int i)
    {
        if(i < -3 || i >= ac.length)
            return null;
        if(i < 0 && i >= -3)
        {
            i = -i - 1;
            return achardef[0][i];
        }
        char c = ac[i];
        if((c & 0x80) != 0)
        {
            c &= '\uFF7F';
            return achardef[0][c + 5];
        }
        if(c >= '0' && c <= '9')
            return achardef[0][(c - 48) + 5];
        else
            return null;
    }

    char[] validateData(char ac[], int i)
    {
        char ac1[] = null;
        if(ac == null || i <= 0)
            return null;
        for(int j = 0; j < i; j++)
            if(ac[j] < '0' || ac[j] > '9')
                return null;

        int k = i;
        char c = '\0';
        if((super.bdStyle & 0x200) != 0)
        {
            c = calcCheckChar(ac, i);
            if(c > '9')
                k += 2;
            else
                k++;
        }
        if((super.bdStyle & 0x4000) != 0)
            k++;
        ac1 = new char[k];
        int l;
        for(l = 0; l < i; l++)
            ac1[l] = ac[l];

        if((super.bdStyle & 0x200) != 0)
            if(c > '9')
            {
                ac1[l++] = '1';
                ac1[l++] = '0';
            } else
            {
                ac1[l++] = c;
            }
        if((super.bdStyle & 0x4000) != 0)
            ac1[l++] = calc2ndCheckChar(ac, i);
        return ac1;
    }

    static final CharDef _chardef_msi[] = {
        new CharDef(2, _PLESSEYCODE_1(1)), new CharDef(0, 0), new CharDef(3, _PLESSEY_BIT(0) << 2 | 1), new CharDef(0, 0), new CharDef(0, 0), new CharDef('0', _PLESSEYCODE(0, 0, 0, 0)), new CharDef('1', _PLESSEYCODE(0, 0, 0, 1)), new CharDef('2', _PLESSEYCODE(0, 0, 1, 0)), new CharDef('3', _PLESSEYCODE(0, 0, 1, 1)), new CharDef('4', _PLESSEYCODE(0, 1, 0, 0)), 
        new CharDef('5', _PLESSEYCODE(0, 1, 0, 1)), new CharDef('6', _PLESSEYCODE(0, 1, 1, 0)), new CharDef('7', _PLESSEYCODE(0, 1, 1, 1)), new CharDef('8', _PLESSEYCODE(1, 0, 0, 0)), new CharDef('9', _PLESSEYCODE(1, 0, 0, 1))
    };
    static final String name = "MSI/Plessey";

}

⌨️ 快捷键说明

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