Mercurial > repos > deepakjadmin > mayatool3_test2
comparison docs/modules/txt/BitVector.txt @ 0:4816e4a8ae95 draft default tip
Uploaded
| author | deepakjadmin |
|---|---|
| date | Wed, 20 Jan 2016 09:23:18 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:4816e4a8ae95 |
|---|---|
| 1 NAME | |
| 2 BitVector | |
| 3 | |
| 4 SYNOPSIS | |
| 5 use BitVector; | |
| 6 | |
| 7 use BitVector (); | |
| 8 | |
| 9 use BitVector qw(:all); | |
| 10 | |
| 11 DESCRIPTION | |
| 12 BitVector class provides the following methods: | |
| 13 | |
| 14 new, ClearAllBits, ClearBit, ClearBits, ClearBitsRange, Copy, | |
| 15 FlipAllBits, FlipBit, FlipBits, FlipBitsRange, GetBit, | |
| 16 GetBitsAsBinaryString, GetBitsAsDecimalString, | |
| 17 GetBitsAsHexadecimalString, GetBitsAsOctalString, | |
| 18 GetBitsAsRawBinaryString, GetDensityOfClearBits, GetDensityOfSetBits, | |
| 19 GetNumOfClearBits, GetNumOfSetBits, GetSize, IsBitClear, IsBitSet, | |
| 20 IsBitVector, NewFromBinaryString, NewFromDecimalString, | |
| 21 NewFromHexadecimalString, NewFromOctalString, NewFromRawBinaryString, | |
| 22 Reverse, SetAllBits, SetBit, SetBitValue, SetBitValueBitOrder, | |
| 23 SetBitValuePrintFormat, SetBits, SetBitsAsBinaryString, | |
| 24 SetBitsAsDecimalString, SetBitsAsHexadecimalString, | |
| 25 SetBitsAsOctalString, SetBitsAsRawBinaryString, SetBitsRange, | |
| 26 StringifyBitVector | |
| 27 | |
| 28 The following methods can also be used as functions: | |
| 29 | |
| 30 IsBitVector, NewFromBinaryString, NewFromDecimalString, | |
| 31 NewFromHexadecimalString, NewFromOctalString, NewFromRawBinaryString | |
| 32 | |
| 33 The following operators are overloaded: | |
| 34 | |
| 35 "" & | ^ ~ == != | |
| 36 | |
| 37 Internally, bits are stored in ascending order using Perl vec function. | |
| 38 Regardless of machine order, big-endian or little-endian, vec function | |
| 39 always considers first string byte as the lowest byte and first bit | |
| 40 within each byte as the lowest bit. | |
| 41 | |
| 42 Things to keep in mind: | |
| 43 | |
| 44 o Bit numbers range from 0 to (Size - 1). | |
| 45 o Bit data retieval methods provide options to data in ascending or | |
| 46 descending bit order. Default is ascending bit order. | |
| 47 o Stringyfy method provides an option to print data in ascending or | |
| 48 descending bit order. Default is ascending bit order. | |
| 49 | |
| 50 METHODS | |
| 51 new | |
| 52 $NewBitVector = new BitVector($Size); | |
| 53 | |
| 54 Create a new *BitVector* object of size *Size* and return newly | |
| 55 created BitVector. Bit numbers range from 0 to 1 less than *Size*. | |
| 56 | |
| 57 ClearAllBits | |
| 58 $BitVector->ClearAllBits(); | |
| 59 | |
| 60 Set all bit values to 0 in *BitVector* object and return | |
| 61 *BitVector*. | |
| 62 | |
| 63 ClearBit | |
| 64 $BitVector->ClearBit($BitNum); | |
| 65 | |
| 66 Set specified bit number *BitNum* to 0 in *BitVector* object and | |
| 67 return *BitVector*. | |
| 68 | |
| 69 ClearBits | |
| 70 $BitVector->ClearBits(@BitNums); | |
| 71 | |
| 72 Set specified bit numbers *BitNums* to 0 in *BitVector* object and | |
| 73 return *BitVector*. | |
| 74 | |
| 75 ClearBitsRange | |
| 76 $BitVector->ClearBitsRange($MinBitNum, $MaxBitNum); | |
| 77 | |
| 78 Set specified bit numbers between *MinBitNum* and *MaxBitNum* to 0 | |
| 79 in *BitVector* object and return *BitVector*. | |
| 80 | |
| 81 Copy | |
| 82 $NewBitVector = $BitVector->Copy(); | |
| 83 | |
| 84 Copy *BitVector* and its associated data to a new BitVector and | |
| 85 return a new BitVector. | |
| 86 | |
| 87 FlipAllBits | |
| 88 $BitVector->FlipAllBits(); | |
| 89 | |
| 90 Flip values of all bits in *BitVector* and its associated data to a | |
| 91 new BitVector and return *BitVector*. | |
| 92 | |
| 93 FlipBit | |
| 94 $BitVector->FlipBit($BitNum); | |
| 95 | |
| 96 Flip value of specified *BitNum* of in *BitVector* and return | |
| 97 *BitVector*. | |
| 98 | |
| 99 FlipBits | |
| 100 $BitVector->FlipBits(@BitNums); | |
| 101 | |
| 102 Flip values of specified bit numbers *BitNums* in *BitVector* object | |
| 103 and return *BitVector*. | |
| 104 | |
| 105 FlipBitsRange | |
| 106 $BitVector->FlipBitsRange($MinBitNum, $MaxBitNum); | |
| 107 | |
| 108 Flip values of specified bit numbers between *MinBitNum* and | |
| 109 *MaxBitNum* in *BitVector* object and return *BitVector*. | |
| 110 | |
| 111 GetBit | |
| 112 $BitValue = $BitVector->GetBit($BitNum); | |
| 113 | |
| 114 Returns value of bit number *BitNum* in *BitVector* object. | |
| 115 | |
| 116 GetBitsAsBinaryString | |
| 117 $BitString = $BitVector->GetBitsAsBinaryString([$BitOrder]); | |
| 118 | |
| 119 Returns values of bits in *BitVector* as an ascii bit string | |
| 120 containing 0s and 1s. | |
| 121 | |
| 122 Default *BitOrder* is *Ascending* bit order which corresponds to | |
| 123 first bit in each byte as the loweset bit as opposed to the higest | |
| 124 bit. | |
| 125 | |
| 126 GetBitsAsDecimalString | |
| 127 $BitString = $BitVector->GetBitsAsDecimalString([$BitOrder]); | |
| 128 | |
| 129 Returns values of bits in *BitVector* as a decimal bit string | |
| 130 containing values from 0 to 9. | |
| 131 | |
| 132 Default *BitOrder* is *Ascending* bit order which corresponds to | |
| 133 first bit in each byte as the loweset bit as opposed to the higest | |
| 134 bit. | |
| 135 | |
| 136 GetBitsAsHexadecimalString | |
| 137 $BitString = $BitVector->GetBitsAsHexadecimalString([$BitOrder]); | |
| 138 | |
| 139 Returns values of bits in *BitVector* as a hexadecimal bit string | |
| 140 containing values from 0 to 9 and a to f. | |
| 141 | |
| 142 Default *BitOrder* is *Ascending* bit order which corresponds to | |
| 143 first bit in each byte as the loweset bit as opposed to the higest | |
| 144 bit. | |
| 145 | |
| 146 GetBitsAsOctalString | |
| 147 $BitString = $BitVector->GetBitsAsOctalString([$BitOrder]); | |
| 148 | |
| 149 Returns values of bits in *BitVector* as an octal bit string | |
| 150 containing values form 0 to 7. | |
| 151 | |
| 152 Default *BitOrder* is *Ascending* bit order which corresponds to | |
| 153 first bit in each byte as the loweset bit as opposed to the higest | |
| 154 bit. | |
| 155 | |
| 156 GetBitsAsRawBinaryString | |
| 157 $BitString = $BitVector->GetBitsAsRawBinaryString(); | |
| 158 | |
| 159 Returns values of bits in *BitVector* as an string corresponding to | |
| 160 packed bit values used by Perl vec function without perfoming any | |
| 161 unpacking. | |
| 162 | |
| 163 GetDensityOfClearBits | |
| 164 $ClearBitsDensity = $BitVector->GetDensityOfClearBits(); | |
| 165 | |
| 166 Returns density of clear bits in *BitVector* which corresponds to | |
| 167 number of bits set to 0 *BitVector* divided by its size. | |
| 168 | |
| 169 GetDensityOfSetBits | |
| 170 $SetBitsDensity = $BitVector->GetDensityOfSetBits(); | |
| 171 | |
| 172 Returns density of set bits in *BitVector* which corresponds to | |
| 173 number of bits set to 1 in *BitVector* divided by its size. | |
| 174 | |
| 175 GetNumOfClearBits | |
| 176 $NumOfClearBits = $BitVector->GetNumOfClearBits(); | |
| 177 | |
| 178 Returns number of bits set to 0 in *BitVector*. | |
| 179 | |
| 180 GetNumOfSetBits | |
| 181 $NumOfSetBits = $BitVector->GetNumOfSetBits(); | |
| 182 | |
| 183 Returns number of bits set to 1 in *BitVector*. | |
| 184 | |
| 185 GetSize | |
| 186 $Size = $BitVector->GetSize(); | |
| 187 | |
| 188 Returns size of *BitVector*. | |
| 189 | |
| 190 IsBitClear | |
| 191 $Status = $BitVector->IsBitClear(); | |
| 192 | |
| 193 Returns 1 or 0 based on whether *BitNum* is set to 0 in *BitVector*. | |
| 194 | |
| 195 IsBitSet | |
| 196 $Status = $BitVector->IsBitSet($BitNum); | |
| 197 | |
| 198 Returns 1 or 0 based on whether *BitNum* is set to 1 in *BitVector*. | |
| 199 | |
| 200 IsBitVector | |
| 201 $Status = BitVector::IsBitVector($Object); | |
| 202 | |
| 203 Returns 1 or 0 based on whether *Object* is a BitVector object. | |
| 204 | |
| 205 NewFromBinaryString | |
| 206 $NewBitVector = BitVector::NewFromBinaryString($BinaryString, | |
| 207 [$BitOrder]); | |
| 208 $NewBitVector = $BitVector->NewFromBinaryString($BinaryString, | |
| 209 [$BitOrder]); | |
| 210 | |
| 211 Creates a new *BitVector* using *BinaryString* and returns new | |
| 212 BitVector object. | |
| 213 | |
| 214 Default *BitOrder* is *Ascending* bit order which corresponds to | |
| 215 first bit in each byte as the loweset bit as opposed to the higest | |
| 216 bit. | |
| 217 | |
| 218 NewFromDecimalString | |
| 219 $NewBitVector = BitVector::NewFromDecimalString($DecimalString, | |
| 220 [$BitOrder]); | |
| 221 $NewBitVector = $BitVector->NewFromDecimalString($DecimalString, | |
| 222 [$BitOrder]); | |
| 223 | |
| 224 Creates a new *BitVector* using *DecimalString* and returns new | |
| 225 BitVector object. | |
| 226 | |
| 227 Default *BitOrder* is *Ascending* bit order which corresponds to | |
| 228 first bit in each byte as the loweset bit as opposed to the higest | |
| 229 bit. | |
| 230 | |
| 231 NewFromHexadecimalString | |
| 232 $NewBitVector = BitVector::NewFromHexadecimalString( | |
| 233 $HexadecimalString, [$BitOrder]); | |
| 234 $NewBitVector = $BitVector->NewFromHexadecimalString( | |
| 235 $HexadecimalString, [$BitOrder]); | |
| 236 | |
| 237 Creates a new *BitVector* using *HexadecimalString* and returns new | |
| 238 BitVector object. | |
| 239 | |
| 240 Default *BitOrder* is *Ascending* bit order which corresponds to | |
| 241 first bit in each byte as the loweset bit as opposed to the higest | |
| 242 bit. | |
| 243 | |
| 244 NewFromOctalString | |
| 245 $NewBitVector = BitVector::NewFromOctalString($OctalString, [$BitOrder]); | |
| 246 $NewBitVector = $BitVector->NewFromOctalString($OctalString, [$BitOrder]); | |
| 247 | |
| 248 Creates a new *BitVector* using *OctalString* and returns new | |
| 249 BitVector object. | |
| 250 | |
| 251 Default *BitOrder* is *Ascending* bit order which corresponds to | |
| 252 first bit in each byte as the loweset bit as opposed to the higest | |
| 253 bit. | |
| 254 | |
| 255 NewFromRawBinaryString | |
| 256 $NewBitVector = BitVector::NewFromRawBinaryString( | |
| 257 $RawBinaryString); | |
| 258 $NewBitVector = $BitVector->NewFromRawBinaryString( | |
| 259 $RawBinaryString); | |
| 260 | |
| 261 Creates a new *BitVector* using *RawBinaryString* and returns new | |
| 262 BitVector object. | |
| 263 | |
| 264 Reverse | |
| 265 $BitVector->Reverse(); | |
| 266 | |
| 267 Reverses values of bits in *BitVector* and returns *BitVector*. | |
| 268 First bit number ends up with value of last bit number. | |
| 269 | |
| 270 SetAllBits | |
| 271 $BitVector->SetAllBits(); | |
| 272 | |
| 273 Sets values of all bits in *BitVector* to 1 and returns *BitVector*. | |
| 274 | |
| 275 SetBit | |
| 276 $BitVector->SetBit($BitNum); | |
| 277 | |
| 278 Sets value of *BitNum* to 1 in *BitVector* and returns *BitVector*. | |
| 279 | |
| 280 SetBitValue | |
| 281 $BitVector->SetBitValue($BitNum, $BitValue); | |
| 282 | |
| 283 Sets value of *BitNum* to *BitValue* in *BitVector* and returns | |
| 284 *BitVector*. | |
| 285 | |
| 286 SetBitValueBitOrder | |
| 287 BitVector::SetBitValueBitOrder($BitOrder); | |
| 288 $BitVector->SetBitValueBitOrder($BitOrder); | |
| 289 | |
| 290 Set bit order for printing BitVector values during stringification | |
| 291 of BitVector object. Possible bit order values: *Ascending or | |
| 292 Descending*. | |
| 293 | |
| 294 Bit order can be set for either an individual BitVector object or | |
| 295 the class. Default is to print bits in each byte in *Asscending* bit | |
| 296 order. | |
| 297 | |
| 298 Internally, bits are stored in *Ascending* bit order using Perl vec | |
| 299 function. Regardless of machine order, big-endian or little-endian, | |
| 300 vec function always considers first string byte as the lowest byte | |
| 301 and first bit within each byte as the lowest bit. | |
| 302 | |
| 303 SetBitValuePrintFormat | |
| 304 BitVector::SetBitValuePrintFormat($PrintValueFormat); | |
| 305 $BitVector->SetBitValuePrintFormat($PrintValueFormat); | |
| 306 | |
| 307 Set bit values print format for printing BitVector values during | |
| 308 stringification of BitVector object. Possible print format values: | |
| 309 *Binary, Bin, Hexadecimal, Hex, Decimal, Dec, Octal, Oct, RawBinary, | |
| 310 RawBin*. Default: *Binary*. | |
| 311 | |
| 312 Bit values print format can be set for either an individual | |
| 313 BitVector object or the class. | |
| 314 | |
| 315 SetBits | |
| 316 $BitVector->SetBits(@BitNums); | |
| 317 | |
| 318 Set specified bit numbers *BitNums* to 1 in *BitVector* object and | |
| 319 return *BitVector*. | |
| 320 | |
| 321 SetBitsAsBinaryString | |
| 322 $BitVector->SetBitsAsBinaryString($BinaryString); | |
| 323 | |
| 324 Set bit values in *BitVector* using specified *BinaryString* and | |
| 325 return *BitVector*. The size of *BitVector* is not changed. | |
| 326 | |
| 327 SetBitsAsDecimalString | |
| 328 $BitVector->SetBitsAsDecimalString($DecimalString, [$BitOrder]); | |
| 329 | |
| 330 Set bit values in *BitVector* using specified *DecimalString* and | |
| 331 return *BitVector*. The size of *BitVector* is not changed. | |
| 332 | |
| 333 SetBitsAsHexadecimalString | |
| 334 $BitVector->SetBitsAsHexadecimalString($HexadecimalString, [$BitOrder]); | |
| 335 | |
| 336 Set bit values in *BitVector* using specified *HexadecimalString* | |
| 337 and return *BitVector*. The size of *BitVector* is not changed. | |
| 338 | |
| 339 SetBitsAsOctalString | |
| 340 $BitVector->SetBitsAsOctalString($OctalString, [$BitOrder]); | |
| 341 | |
| 342 Set bit values in *BitVector* using specified *OctalString* and | |
| 343 return *BitVector*. The size of *BitVector* is not changed. | |
| 344 | |
| 345 SetBitsAsRawBinaryString | |
| 346 $BitVector->SetBitsAsRawBinaryString($RawBinaryString); | |
| 347 | |
| 348 Set bit values in *BitVector* using specified *RawBinaryString* and | |
| 349 return *BitVector*. The size of *BitVector* is not changed. | |
| 350 | |
| 351 SetBitsRange | |
| 352 $BitVector->SetBitsRange($MinBitNum, $MaxBitNum); | |
| 353 | |
| 354 Set specified bit numbers between *MinBitNum* and *MaxBitNum* to 1 | |
| 355 in *BitVector* object and return *BitVector*. | |
| 356 | |
| 357 StringifyBitVector | |
| 358 $String = $BitVector->StringifyBitVector(); | |
| 359 | |
| 360 Returns a string containing information about *BitVector* object. | |
| 361 | |
| 362 AUTHOR | |
| 363 Manish Sud <msud@san.rr.com> | |
| 364 | |
| 365 SEE ALSO | |
| 366 Vector.pm | |
| 367 | |
| 368 COPYRIGHT | |
| 369 Copyright (C) 2015 Manish Sud. All rights reserved. | |
| 370 | |
| 371 This file is part of MayaChemTools. | |
| 372 | |
| 373 MayaChemTools is free software; you can redistribute it and/or modify it | |
| 374 under the terms of the GNU Lesser General Public License as published by | |
| 375 the Free Software Foundation; either version 3 of the License, or (at | |
| 376 your option) any later version. | |
| 377 |
