예제 #1
0
        private void addAtom(string st, bool parity, int rate, int level)
        {
            if (st.Length == 0)
            {
                return;
            }
            BitSolutionAtom a = new BitSolutionAtom()
            {
                data = st, level = level, rate = rate, parityOk = parity, bpc = bpc, add = add
            };

            atoms.Add(a);
        }
예제 #2
0
        private void calculateAtoms()
        {
            if (subData == null)
            {
                return;
            }

            atoms = new List <BitSolutionAtom>();

            for (int i = 0; i < subData.GetLength(0); i++)
            {
                string st = subData[i];
                /* create an atom from the invalid part of the current string of bits */
                BitSolutionAtom a = new BitSolutionAtom();
                if (subStart[i] > 0)
                {
                    addInvalid(st.Substring(0, subStart[i]));
                }
                else if (subLength[i] == 0)
                {
                    addInvalid(st.Substring(0, st.Length));
                }

                /* when there's a valid part, add it.*/
                if (subLength[i] > 0)
                {
                    int validLen = subLength[i] * bpc;
                    addAtom(st.Substring(subStart[i], validLen), true, subLength[i], 0);
                    /* if there's anything left after the valid part, add it to an invalid atom */
                    if (subStart[i] + validLen < st.Length)
                    {
                        addInvalid(st.Substring(subStart[i] + validLen, st.Length - subStart[i] - validLen));
                    }
                }
            }
        }