Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the DeltaAlignmentSorter class.
 /// </summary>
 public DeltaAlignmentSorter()
 {
     this.holderHooks.Add(new Holder());
     this.endHolder = this.Root;
     this.holderCapacity = 1;
     this.IncreaseCapacityTo(HoldersCapacityIncrementsBy);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the DeltaAlignmentSorter class with specified capacity.
 /// </summary>
 /// <param name="referenceSequenceLength">Reference sequence length.</param>
 public DeltaAlignmentSorter(long referenceSequenceLength)
 {
     this.holderHooks.Add(new Holder());
     this.endHolder = this.Root;
     this.holderCapacity = 1;
     this.IncreaseCapacityTo(referenceSequenceLength);
 }
Exemplo n.º 3
0
        /// <summary>
        /// Increases the capacity to specified value.
        /// </summary>
        /// <param name="capacity">New capacity.</param>
        /// <returns>Returns the last holder.</returns>
        private void IncreaseCapacityTo(long capacity)
        {
            if (capacity <= this.holderCapacity)
            {
                return;
            }

            if (capacity < HoldersCapacityIncrementsBy)
            {
                capacity = HoldersCapacityIncrementsBy;
            }

            long index = this.holderCapacity - 1;
            Holder holder = this.endHolder;
            int remainder = (int)(index % HooksIntervals);
            while (index < capacity - 1)
            {
                int loopCount = HooksIntervals - remainder;
                for (int i = 0; i < loopCount && index < capacity - 1; i++)
                {
                    holder.Right = new Holder();
                    holder = holder.Right;
                    index++;
                }

                remainder = (int)(index % HooksIntervals);
                if (remainder == 0)
                {
                    this.holderHooks.Add(holder);
                }
            }

            this.endHolder = holder;
            this.holderCapacity = capacity;
        }