Exemple #1
0
                internal DecompIterator(int[][] ERT, int minIntegerMass, int maxIntegerMass, double minDoubleMass, double maxDoubleMass, int[] minValues, int[] maxValues, List <ChemicalElement> weights)
                {
                    this.ERT           = ERT;
                    this.minDoubleMass = minDoubleMass;
                    this.maxDoubleMass = maxDoubleMass;
                    this.buffer        = new int[weights.Count];
                    if (minValues != null)
                    {
                        bool allZero = true;
                        foreach (int k in minValues)
                        {
                            if (k > 0)
                            {
                                allZero = false;
                            }
                        }
                        if (!allZero)
                        {
                            this.minValues = minValues;
                        }
                        else
                        {
                            this.minValues = null;
                        }
                    }
                    else
                    {
                        this.minValues = null;
                    }
                    this.maxValues = maxValues;
                    this.weights   = weights;

                    k         = weights.Count;
                    j         = new int[k];
                    m         = new int[k];
                    lbound    = new int[k];
                    r         = new int[k];
                    flagWhile = false; // flag whether we are in the while-loop or not
                    a         = weights[0].GetIntegerMass();
                    // Init
                    for (int i = 1; i < k; ++i)
                    {
                        lbound[i] = int.MaxValue; // this is just to ensure, that lbound < m in the first iteration
                    }

                    i              = k - 1;
                    m[i]           = maxIntegerMass; // m[i] corresponds to M, m[i-1] ^= m
                    this.rewind    = false;
                    this.deviation = maxIntegerMass - minIntegerMass;
                    this.ERTdev    = Ints.HighestOneBit(deviation);
                }