![]() |
BitVector
use BitVector;
use BitVector ();
use BitVector qw(:all);
BitVector class provides the following methods:
new, ClearAllBits, ClearBit, ClearBits, ClearBitsRange, Copy, FlipAllBits , FlipBit, FlipBits, FlipBitsRange, GetBit, GetBitsAsBinaryString , GetBitsAsDecimalString, GetBitsAsHexadecimalString, GetBitsAsOctalString , GetBitsAsRawBinaryString, GetDensityOfClearBits, GetDensityOfSetBits , GetNumOfClearBits, GetNumOfSetBits, GetSize, IsBitClear, IsBitSet, IsBitVector , NewFromBinaryString, NewFromDecimalString, NewFromHexadecimalString , NewFromOctalString, NewFromRawBinaryString, Reverse, SetAllBits, SetBit , SetBitValue, SetBitValueBitOrder, SetBitValuePrintFormat, SetBits , SetBitsAsBinaryString, SetBitsAsDecimalString, SetBitsAsHexadecimalString , SetBitsAsOctalString, SetBitsAsRawBinaryString, SetBitsRange, StringifyBitVector
The following methods can also be used as functions:
IsBitVector, NewFromBinaryString, NewFromDecimalString, NewFromHexadecimalString, NewFromOctalString, NewFromRawBinaryString
The following operators are overloaded:
Things to keep in mind:
Create a new BitVector object of size Size and return newly created BitVector. Bit numbers range from 0 to 1 less than Size
Set all bit values to 0 in BitVector object and return BitVector
Set specified bit number BitNum to 0 in BitVector object and return BitVector
Set specified bit numbers BitNums to 0 in BitVector object and return BitVector
Set specified bit numbers between MinBitNum and MaxBitNum to 0 in BitVector object and return BitVector
Copy BitVector and its associated data to a new BitVector and return a new BitVector
Flip values of all bits in BitVector and its associated data to a new BitVector and return BitVector
Flip value of specified BitNum of in BitVector and return BitVector
Flip values of specified bit numbers BitNums in BitVector object and return BitVector
Flip values of specified bit numbers between MinBitNum and MaxBitNum in BitVector object and return BitVector
Returns value of bit number BitNum in BitVector object
Returns values of bits in BitVector as an ascii bit string containing 0s and 1s.
Internal bit values stored using Perl vec fucnction with least significat bit and least significant byte on the left are converted into a binary string with least significant bit and least significant byte on the right.
Returns values of bits in BitVector as a decimal bit string containing values from 0 to 9.
Internal bit values stored using Perl vec fucnction with least significat bit and least significant byte on the left are converted into a binary string with least significant bit and least significant byte on the right.
Returns values of bits in BitVector as a hexadecimal bit string containing values from 0 to 9 and a to f.
Internal bit values stored using Perl vec fucnction with least significat bit and least significant byte on the left are converted into a binary string with least significant bit and least significant byte on the right.
Returns values of bits in BitVector as an octal bit string containing values form 0 to 7.
Internal bit values stored using Perl vec fucnction with least significat bit and least significant byte on the left are converted into a binary string with least significant bit and least significant byte on the right.
Returns values of bits in BitVector as an string corresponding to packed bit values used by Perl vec function without perfoming any unpacking
Returns density of clear bits in BitVector which corresponds to number of bits set to 0 BitVector divided by its size
Returns density of set bits in BitVector which corresponds to number of bits set to 1 in BitVector divided by its size
Returns number of bits set to 0 in BitVector
Returns number of bits set to 1 in BitVector
Returns size of BitVector
Returns 1 or 0 based on whether BitNum is set to 0 in BitVector
Returns 1 or 0 based on whether BitNum is set to 1 in BitVector
Returns 1 or 0 based on whether Object is a BitVector object.
Creates a new BitVector using BinaryString and returns new BitVector object
Creates a new BitVector using DecimalString and returns new BitVector object
Creates a new BitVector using HexadecimalString and returns new BitVector object
Creates a new BitVector using OctalString and returns new BitVector object
Creates a new BitVector using RawBinaryString and returns new BitVector object
Reverses values of bits in BitVector and returns BitVector. First bit number ends up with value of last bit number
Sets values of all bits in BitVector to 1 and returns BitVector
Sets value of BitNum to 1 in BitVector and returns BitVector
Sets value of BitNum to BitValue in BitVector and returns BitVector
Set bit order for printing BitVector values during stringification of BitVector object. Possible bit order values: Ascending or Descending.
Bit order can be set for either an individual BitVector object or the class.
Default is to print LSB bit in each byte on the right (Descending bit order). Internally, bits are stored in ascending order using Perl vec function and LSB bit in each byte on the left (Ascending bit order).
Set bit values print format for printing BitVector values during stringification of BitVector object. Possible print format values: Binary, Bin, Hexadecimal, Hex, Decimal, Dec, Octal, Oct, RawBinary, RawBin. Default: Binary.
Bit values print format can be set for either an individual BitVector object or the class.
Set specified bit numbers BitNums to 1 in BitVector object and return BitVector
Set bit values in BitVector using specified BinaryString and return BitVector. The size of BitVector is not changed.
Set bit values in BitVector using specified DecimalString and return BitVector. The size of BitVector is not changed.
Set bit values in BitVector using specified HexadecimalString and return BitVector. The size of BitVector is not changed.
Set bit values in BitVector using specified OctalString and return BitVector. The size of BitVector is not changed.
Set bit values in BitVector using specified RawBinaryString and return BitVector. The size of BitVector is not changed.
Set specified bit numbers between MinBitNum and MaxBitNum to 1 in BitVector object and return BitVector
Returns a string containing information about BitVector object
Copyright (C) 2004-2008 Manish Sud. All rights reserved.
This file is part of MayaChemTools.
MayaChemTools is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.