/// <summary> /// Inverts all the bits values in the current System.Collections.JIBitArray, so /// that elements set to true are changed to false, and elements set to false /// are changed to true /// </summary> /// <returns></returns> public JIBitArray Not() { JIBitArray RArray = new JIBitArray(_bits.Count); for (int i = 0; i < _bits.Count; i++) { if ((bool)_bits[i] == true) { RArray.Set(i, false); } else { RArray.Set(i, true); } } return(RArray); }
/// <summary> /// Retrives a SubJIBitArray from this instance. The SubJIBitArray start at the /// specified bit position and has specified length /// </summary> /// <param name="index">The index of the start of SubJIBitArray</param> /// <param name="length">The number of bits in SubJIBitArray</param> /// <returns></returns> public JIBitArray SubJIBitArray(int index, int length) { JIBitArray RArray = new JIBitArray(length); int c = 0; for (int i = index; i < index + length; i++) { RArray.Set(c++, (bool)_bits[i]); } return(RArray); }
/// <summary> /// Perform the bitwise eXclusive OR operation on the elements in the current System.Collections.JIBitArray /// against the corresponding elements in the specified System.Collections.JIBitArray /// </summary> /// <param name="Value">The System.Collections.JIBitArray with which to perform the bitwise eXclusive OR operation</param> /// <returns></returns> public JIBitArray Xor(JIBitArray Value) { JIBitArray RArray; int Max = _bits.Count > Value._bits.Count ? _bits.Count : Value._bits.Count; RArray = new JIBitArray(Max); RArray._bits = this._bits; if (Max == RArray._bits.Count) { FixLength(Value, Max); } else { FixLength(RArray, Max); } for (int i = 0; i < Max; i++) { RArray.Set(i, (bool)Value._bits[i] ^ (bool)RArray._bits[i]); } return(RArray); }