Esempio n. 1
0
 /// <summary>
 /// Changes the bit with index <i>bitIndex</i> to the "clear" (<i>false</i>) state.
 /// </summary>
 /// <param name="bitIndex">the index of the bit to be cleared.</param>
 /// <exception cref="IndexOutOfRangeException">if <i>bitIndex&lt;0 || bitIndex&gt;=Size</i></exception>
 public void Clear(int bitIndex)
 {
     if (bitIndex < 0 || bitIndex >= nbits)
     {
         throw new IndexOutOfRangeException(bitIndex.ToString());
     }
     QuickBitVector.Clear(bits, bitIndex);
 }
Esempio n. 2
0
 /// <summary>
 /// Sets the bit with index <i>bitIndex</i> to the state specified by <i>value</i>; <b>WARNING:</b> Does not check preconditions.
 ///
 /// <p>Provided with invalid parameters this method may set invalid values without throwing any exception.
 /// <b>You should only use this method when you are absolutely sure that the index is within bounds.</b>
 /// Precondition (unchecked): <i>bitIndex &gt;= 0 && bitIndex &lt; Size</i>.
 /// </summary>
 /// <param name="bitIndex">the index of the bit to be changed.</param>
 /// <param name="value">the value to be stored in the bit.</param>
 public void PutQuick(int bitIndex, Boolean value)
 {
     if (value)
     {
         QuickBitVector.Set(bits, bitIndex);
     }
     else
     {
         QuickBitVector.Clear(bits, bitIndex);
     }
 }
Esempio n. 3
0
 public Boolean this[int bitIndex]
 {
     get {
         if (bitIndex < 0 || bitIndex >= nbits)
         {
             throw new IndexOutOfRangeException(bitIndex.ToString());
         }
         return(QuickBitVector.Get(bits, bitIndex));
     }
     set {
         if (bitIndex < 0 || bitIndex >= nbits)
         {
             throw new IndexOutOfRangeException(bitIndex.ToString());
         }
         if (value)
         {
             QuickBitVector.Set(bits, bitIndex);
         }
         else
         {
             QuickBitVector.Clear(bits, bitIndex);
         }
     }
 }