Esempio n. 1
0
        /// <summary>
        /// Add a specified number of zero intensities to the given chromatogram, possibly
        /// writing finished blocks to disk.
        /// </summary>
        public void FillZeroes(int chromatogramIndex, int count, BlockWriter writer)
        {
            if (count < 1)
            {
                return;
            }

            // Fill remainder of current block.
            if (_blockIndex > 0)
            {
                while (count > 0 && _blockIndex < _blockSize)
                {
                    _block._data[_blockIndex++] = default(TData);
                    count--;
                }
                if (_blockIndex == _blockSize)
                {
                    _blockIndex = 0;
                }
                if (count == 0)
                {
                    return;
                }
            }

            if (writer != null)
            {
                if (_block == null)
                {
                    NewBlock();
                }
                else
                {
                    // Clear out re-used block.
                    for (int i = 0; i < _blockSize; i++)
                    {
                        _block._data[i] = default(TData);
                    }
                }

                // Write zeroed blocks to disk.
                while (count >= _blockSize)
                {
                    writer.WriteBlock(chromatogramIndex, this);
                    count -= _blockSize;
                }
            }
            else
            {
                // Create new pre-zeroed blocks.
                while (count >= _blockSize)
                {
                    NewBlock();
                    count -= _blockSize;
                }
            }

            _blockIndex = count;
        }
Esempio n. 2
0
 /// <summary>
 /// Fill a number of intensity and mass error values for the given chromatogram with zeroes.
 /// </summary>
 public void FillZeroes(int chromatogramIndex, int count, BlockWriter writer)
 {
     if (MassErrors != null)
     {
         MassErrors.FillZeroes(chromatogramIndex, count, writer);
     }
     Intensities.FillZeroes(chromatogramIndex, count, writer);
 }
Esempio n. 3
0
 public new void Add(int chromatogramIndex, TData data, BlockWriter writer)
 {
     // Check sort ordering within blocks.  Checking across blocks is too time consuming.
     if (_blockIndex > 0 && Comparer <TData> .Default.Compare(_block._data[_blockIndex - 1], data) > 0)
     {
         throw new InvalidDataException(Resources.Block_VerifySort_Expected_sorted_data);
     }
     base.Add(chromatogramIndex, data, writer);
 }
Esempio n. 4
0
        /// <summary>
        /// Add a data element to the list for a given chromatogram, and write the block
        /// to disk if it is complete.
        /// </summary>
        public void Add(int chromatogramIndex, TData data, BlockWriter writer)
        {
            // Spill data to disk at block boundaries, if necessary.
            if (_blockIndex == 0)
            {
                if (_blocksInMemory == 0 || writer == null)
                {
                    NewBlock();
                }
                else
                {
                    writer.WriteBlock(chromatogramIndex, this);
                }
            }

            // Store data.
            _block._data[_blockIndex] = data;

            // Wrap index to next block.
            if (++_blockIndex == _blockSize)
            {
                _blockIndex = 0;
            }
        }
Esempio n. 5
0
 /// <summary>
 /// Add intensity and mass error (if needed) to the given chromatogram.
 /// </summary>
 public void AddPoint(int chromatogramIndex, float intensity, float?massError, BlockWriter writer)
 {
     if (MassErrors != null)
     {
         // ReSharper disable once PossibleInvalidOperationException
         MassErrors.Add(chromatogramIndex, massError.Value, writer); // If massError is required, this won't be null (and if it is, we want to hear about it)
     }
     Intensities.Add(chromatogramIndex, intensity, writer);
 }
Esempio n. 6
0
 /// <summary>
 /// Add a time value to the given chromatogram.
 /// </summary>
 public void AddTime(int chromatogramIndex, float time, BlockWriter writer)
 {
     Times.Add(chromatogramIndex, time, writer);
 }
Esempio n. 7
0
 /// <summary>
 /// Fill a number of intensity values for the given chromatogram with zeroes.
 /// </summary>
 public void FillIntensities(int chromatogramIndex, int count, BlockWriter writer)
 {
     Intensities.FillZeroes(chromatogramIndex, count, writer);
 }
Esempio n. 8
0
 /// <summary>
 /// Add an intensity value to the given chromatogram.
 /// </summary>
 public void AddIntensity(int chromatogramIndex, float intensity, BlockWriter writer)
 {
     Intensities.Add(chromatogramIndex, intensity, writer);
 }
Esempio n. 9
0
 /// <summary>
 /// Add a mass error to the given chromatogram.
 /// </summary>
 public void AddMassError(int chromatogramIndex, float massError, BlockWriter writer)
 {
     MassErrors.Add(chromatogramIndex, massError, writer);
 }