| 
0
 | 
     1 <html>
 | 
| 
 | 
     2 <head>
 | 
| 
 | 
     3 <title>MayaChemTools:Documentation:BitVector.pm</title>
 | 
| 
 | 
     4 <meta http-equiv="content-type" content="text/html;charset=utf-8">
 | 
| 
 | 
     5 <link rel="stylesheet" type="text/css" href="../../css/MayaChemTools.css">
 | 
| 
 | 
     6 </head>
 | 
| 
 | 
     7 <body leftmargin="20" rightmargin="20" topmargin="10" bottommargin="10">
 | 
| 
 | 
     8 <br/>
 | 
| 
 | 
     9 <center>
 | 
| 
 | 
    10 <a href="http://www.mayachemtools.org" title="MayaChemTools Home"><img src="../../images/MayaChemToolsLogo.gif" border="0" alt="MayaChemTools"></a>
 | 
| 
 | 
    11 </center>
 | 
| 
 | 
    12 <br/>
 | 
| 
 | 
    13 <div class="DocNav">
 | 
| 
 | 
    14 <table width="100%" border=0 cellpadding=0 cellspacing=2>
 | 
| 
 | 
    15 <tr align="left" valign="top"><td width="33%" align="left"><a href="./UFFAtomTypes.html" title="UFFAtomTypes.html">Previous</a>  <a href="./index.html" title="Table of Contents">TOC</a>  <a href="./Bond.html" title="Bond.html">Next</a></td><td width="34%" align="middle"><strong>BitVector.pm</strong></td><td width="33%" align="right"><a href="././code/BitVector.html" title="View source code">Code</a> | <a href="./../pdf/BitVector.pdf" title="PDF US Letter Size">PDF</a> | <a href="./../pdfgreen/BitVector.pdf" title="PDF US Letter Size with narrow margins: www.changethemargins.com">PDFGreen</a> | <a href="./../pdfa4/BitVector.pdf" title="PDF A4 Size">PDFA4</a> | <a href="./../pdfa4green/BitVector.pdf" title="PDF A4 Size with narrow margins: www.changethemargins.com">PDFA4Green</a></td></tr>
 | 
| 
 | 
    16 </table>
 | 
| 
 | 
    17 </div>
 | 
| 
 | 
    18 <p>
 | 
| 
 | 
    19 </p>
 | 
| 
 | 
    20 <h2>NAME</h2>
 | 
| 
 | 
    21 <p>BitVector</p>
 | 
| 
 | 
    22 <p>
 | 
| 
 | 
    23 </p>
 | 
| 
 | 
    24 <h2>SYNOPSIS</h2>
 | 
| 
 | 
    25 <p>use BitVector;</p>
 | 
| 
 | 
    26 <p>use BitVector ();</p>
 | 
| 
 | 
    27 <p>use BitVector qw(:all);</p>
 | 
| 
 | 
    28 <p>
 | 
| 
 | 
    29 </p>
 | 
| 
 | 
    30 <h2>DESCRIPTION</h2>
 | 
| 
 | 
    31 <p><strong>BitVector</strong> class provides the following methods:</p>
 | 
| 
 | 
    32 <p> <a href="#new">new</a>, <a href="#clearallbits">ClearAllBits</a>, <a href="#clearbit">ClearBit</a>, <a href="#clearbits">ClearBits</a>, <a href="#clearbitsrange">ClearBitsRange</a>, <a href="#copy">Copy</a>, <a href="#flipallbits">FlipAllBits</a>
 | 
| 
 | 
    33 , <a href="#flipbit">FlipBit</a>, <a href="#flipbits">FlipBits</a>, <a href="#flipbitsrange">FlipBitsRange</a>, <a href="#getbit">GetBit</a>, <a href="#getbitsasbinarystring">GetBitsAsBinaryString</a>
 | 
| 
 | 
    34 , <a href="#getbitsasdecimalstring">GetBitsAsDecimalString</a>, <a href="#getbitsashexadecimalstring">GetBitsAsHexadecimalString</a>, <a href="#getbitsasoctalstring">GetBitsAsOctalString</a>
 | 
| 
 | 
    35 , <a href="#getbitsasrawbinarystring">GetBitsAsRawBinaryString</a>, <a href="#getdensityofclearbits">GetDensityOfClearBits</a>, <a href="#getdensityofsetbits">GetDensityOfSetBits</a>
 | 
| 
 | 
    36 , <a href="#getnumofclearbits">GetNumOfClearBits</a>, <a href="#getnumofsetbits">GetNumOfSetBits</a>, <a href="#getsize">GetSize</a>, <a href="#isbitclear">IsBitClear</a>, <a href="#isbitset">IsBitSet</a>, <a href="#isbitvector">IsBitVector</a>
 | 
| 
 | 
    37 , <a href="#newfrombinarystring">NewFromBinaryString</a>, <a href="#newfromdecimalstring">NewFromDecimalString</a>, <a href="#newfromhexadecimalstring">NewFromHexadecimalString</a>
 | 
| 
 | 
    38 , <a href="#newfromoctalstring">NewFromOctalString</a>, <a href="#newfromrawbinarystring">NewFromRawBinaryString</a>, <a href="#reverse">Reverse</a>, <a href="#setallbits">SetAllBits</a>, <a href="#setbit">SetBit</a>
 | 
| 
 | 
    39 , <a href="#setbitvalue">SetBitValue</a>, <a href="#setbitvaluebitorder">SetBitValueBitOrder</a>, <a href="#setbitvalueprintformat">SetBitValuePrintFormat</a>, <a href="#setbits">SetBits</a>
 | 
| 
 | 
    40 , <a href="#setbitsasbinarystring">SetBitsAsBinaryString</a>, <a href="#setbitsasdecimalstring">SetBitsAsDecimalString</a>, <a href="#setbitsashexadecimalstring">SetBitsAsHexadecimalString</a>
 | 
| 
 | 
    41 , <a href="#setbitsasoctalstring">SetBitsAsOctalString</a>, <a href="#setbitsasrawbinarystring">SetBitsAsRawBinaryString</a>, <a href="#setbitsrange">SetBitsRange</a>, <a href="#stringifybitvector">StringifyBitVector</a>
 | 
| 
 | 
    42 </p><p>The following methods can also be used as functions:</p>
 | 
| 
 | 
    43 <p>IsBitVector, NewFromBinaryString, NewFromDecimalString, NewFromHexadecimalString,
 | 
| 
 | 
    44 NewFromOctalString, NewFromRawBinaryString</p>
 | 
| 
 | 
    45 <p>The following operators are overloaded:</p>
 | 
| 
 | 
    46 <div class="OptionsBox">
 | 
| 
 | 
    47     "" & | ^ ~ == !=</div>
 | 
| 
 | 
    48 <p>Internally, bits are stored in ascending order using Perl vec function. Regardless
 | 
| 
 | 
    49 of machine order, big-endian or little-endian, vec function always considers first
 | 
| 
 | 
    50 string byte as the lowest byte and first bit within each byte as the lowest bit.</p>
 | 
| 
 | 
    51 <p>Things to keep in mind:</p>
 | 
| 
 | 
    52 <div class="OptionsBox">
 | 
| 
 | 
    53     o Bit numbers range from 0 to (Size - 1).
 | 
| 
 | 
    54 <br/>    o Bit data retieval methods provide options to data in ascending or
 | 
| 
 | 
    55       descending bit order. Default is ascending bit order.
 | 
| 
 | 
    56 <br/>    o Stringyfy method provides an option to print data in ascending or
 | 
| 
 | 
    57       descending bit order. Default is ascending bit order.</div>
 | 
| 
 | 
    58 <p>
 | 
| 
 | 
    59 </p>
 | 
| 
 | 
    60 <h2>METHODS</h2>
 | 
| 
 | 
    61 <dl>
 | 
| 
 | 
    62 <dt><strong><a name="new" class="item"><strong>new</strong></a></strong></dt>
 | 
| 
 | 
    63 <dd>
 | 
| 
 | 
    64 <div class="OptionsBox">
 | 
| 
 | 
    65     $NewBitVector = new BitVector($Size);</div>
 | 
| 
 | 
    66 <p>Create a new <em>BitVector</em> object of size <em>Size</em> and return  newly created
 | 
| 
 | 
    67 <strong>BitVector</strong>. Bit numbers range from 0 to 1 less than <em>Size</em>.</p>
 | 
| 
 | 
    68 </dd>
 | 
| 
 | 
    69 <dt><strong><a name="clearallbits" class="item"><strong>ClearAllBits</strong></a></strong></dt>
 | 
| 
 | 
    70 <dd>
 | 
| 
 | 
    71 <div class="OptionsBox">
 | 
| 
 | 
    72     $BitVector->ClearAllBits();</div>
 | 
| 
 | 
    73 <p>Set all bit values to 0 in <em>BitVector</em> object and return <em>BitVector</em>.</p>
 | 
| 
 | 
    74 </dd>
 | 
| 
 | 
    75 <dt><strong><a name="clearbit" class="item"><strong>ClearBit</strong></a></strong></dt>
 | 
| 
 | 
    76 <dd>
 | 
| 
 | 
    77 <div class="OptionsBox">
 | 
| 
 | 
    78     $BitVector->ClearBit($BitNum);</div>
 | 
| 
 | 
    79 <p>Set specified bit number <em>BitNum</em> to 0 in <em>BitVector</em> object and return <em>BitVector</em>.</p>
 | 
| 
 | 
    80 </dd>
 | 
| 
 | 
    81 <dt><strong><a name="clearbits" class="item"><strong>ClearBits</strong></a></strong></dt>
 | 
| 
 | 
    82 <dd>
 | 
| 
 | 
    83 <div class="OptionsBox">
 | 
| 
 | 
    84     $BitVector->ClearBits(@BitNums);</div>
 | 
| 
 | 
    85 <p>Set specified bit numbers <em>BitNums</em> to 0 in <em>BitVector</em> object and return <em>BitVector</em>.</p>
 | 
| 
 | 
    86 </dd>
 | 
| 
 | 
    87 <dt><strong><a name="clearbitsrange" class="item"><strong>ClearBitsRange</strong></a></strong></dt>
 | 
| 
 | 
    88 <dd>
 | 
| 
 | 
    89 <div class="OptionsBox">
 | 
| 
 | 
    90     $BitVector->ClearBitsRange($MinBitNum, $MaxBitNum);</div>
 | 
| 
 | 
    91 <p>Set specified bit numbers between <em>MinBitNum</em> and <em>MaxBitNum</em> to 0 in <em>BitVector</em>
 | 
| 
 | 
    92 object and return <em>BitVector</em>.</p>
 | 
| 
 | 
    93 </dd>
 | 
| 
 | 
    94 <dt><strong><a name="copy" class="item"><strong>Copy</strong></a></strong></dt>
 | 
| 
 | 
    95 <dd>
 | 
| 
 | 
    96 <div class="OptionsBox">
 | 
| 
 | 
    97     $NewBitVector = $BitVector->Copy();</div>
 | 
| 
 | 
    98 <p>Copy <em>BitVector</em> and its associated data to a new <strong>BitVector</strong> and return a new
 | 
| 
 | 
    99 <strong>BitVector</strong>.</p>
 | 
| 
 | 
   100 </dd>
 | 
| 
 | 
   101 <dt><strong><a name="flipallbits" class="item"><strong>FlipAllBits</strong></a></strong></dt>
 | 
| 
 | 
   102 <dd>
 | 
| 
 | 
   103 <div class="OptionsBox">
 | 
| 
 | 
   104     $BitVector->FlipAllBits();</div>
 | 
| 
 | 
   105 <p>Flip values of all bits in <em>BitVector</em> and its associated data to a new <strong>BitVector</strong> and return
 | 
| 
 | 
   106 <em>BitVector</em>.</p>
 | 
| 
 | 
   107 </dd>
 | 
| 
 | 
   108 <dt><strong><a name="flipbit" class="item"><strong>FlipBit</strong></a></strong></dt>
 | 
| 
 | 
   109 <dd>
 | 
| 
 | 
   110 <div class="OptionsBox">
 | 
| 
 | 
   111     $BitVector->FlipBit($BitNum);</div>
 | 
| 
 | 
   112 <p>Flip value of specified <em>BitNum</em> of in <em>BitVector</em> and return <em>BitVector</em>.</p>
 | 
| 
 | 
   113 </dd>
 | 
| 
 | 
   114 <dt><strong><a name="flipbits" class="item"><strong>FlipBits</strong></a></strong></dt>
 | 
| 
 | 
   115 <dd>
 | 
| 
 | 
   116 <div class="OptionsBox">
 | 
| 
 | 
   117     $BitVector->FlipBits(@BitNums);</div>
 | 
| 
 | 
   118 <p>Flip values of specified bit numbers <em>BitNums</em> in <em>BitVector</em> object and return <em>BitVector</em>.</p>
 | 
| 
 | 
   119 </dd>
 | 
| 
 | 
   120 <dt><strong><a name="flipbitsrange" class="item"><strong>FlipBitsRange</strong></a></strong></dt>
 | 
| 
 | 
   121 <dd>
 | 
| 
 | 
   122 <div class="OptionsBox">
 | 
| 
 | 
   123     $BitVector->FlipBitsRange($MinBitNum, $MaxBitNum);</div>
 | 
| 
 | 
   124 <p>Flip values of specified bit numbers between <em>MinBitNum</em> and <em>MaxBitNum</em> in <em>BitVector</em>
 | 
| 
 | 
   125 object and return <em>BitVector</em>.</p>
 | 
| 
 | 
   126 </dd>
 | 
| 
 | 
   127 <dt><strong><a name="getbit" class="item"><strong>GetBit</strong></a></strong></dt>
 | 
| 
 | 
   128 <dd>
 | 
| 
 | 
   129 <div class="OptionsBox">
 | 
| 
 | 
   130     $BitValue = $BitVector->GetBit($BitNum);</div>
 | 
| 
 | 
   131 <p>Returns value of bit number <em>BitNum</em> in <em>BitVector</em> object.</p>
 | 
| 
 | 
   132 </dd>
 | 
| 
 | 
   133 <dt><strong><a name="getbitsasbinarystring" class="item"><strong>GetBitsAsBinaryString</strong></a></strong></dt>
 | 
| 
 | 
   134 <dd>
 | 
| 
 | 
   135 <div class="OptionsBox">
 | 
| 
 | 
   136     $BitString = $BitVector->GetBitsAsBinaryString([$BitOrder]);</div>
 | 
| 
 | 
   137 <p>Returns values of bits in <em>BitVector</em> as an ascii bit string containing 0s and 1s.</p>
 | 
| 
 | 
   138 <p>Default <em>BitOrder</em> is <em>Ascending</em> bit order which corresponds to first bit in each
 | 
| 
 | 
   139 byte as the loweset bit as opposed to the higest bit.</p>
 | 
| 
 | 
   140 </dd>
 | 
| 
 | 
   141 <dt><strong><a name="getbitsasdecimalstring" class="item"><strong>GetBitsAsDecimalString</strong></a></strong></dt>
 | 
| 
 | 
   142 <dd>
 | 
| 
 | 
   143 <div class="OptionsBox">
 | 
| 
 | 
   144     $BitString = $BitVector->GetBitsAsDecimalString([$BitOrder]);</div>
 | 
| 
 | 
   145 <p>Returns values of bits in <em>BitVector</em> as a decimal bit string containing values from 0 to
 | 
| 
 | 
   146 9.</p>
 | 
| 
 | 
   147 <p>Default <em>BitOrder</em> is <em>Ascending</em> bit order which corresponds to first bit in each
 | 
| 
 | 
   148 byte as the loweset bit as opposed to the higest bit.</p>
 | 
| 
 | 
   149 </dd>
 | 
| 
 | 
   150 <dt><strong><a name="getbitsashexadecimalstring" class="item"><strong>GetBitsAsHexadecimalString</strong></a></strong></dt>
 | 
| 
 | 
   151 <dd>
 | 
| 
 | 
   152 <div class="OptionsBox">
 | 
| 
 | 
   153     $BitString = $BitVector->GetBitsAsHexadecimalString([$BitOrder]);</div>
 | 
| 
 | 
   154 <p>Returns values of bits in <em>BitVector</em> as a hexadecimal bit string containing values from 0 to 9
 | 
| 
 | 
   155 and a to f.</p>
 | 
| 
 | 
   156 <p>Default <em>BitOrder</em> is <em>Ascending</em> bit order which corresponds to first bit in each
 | 
| 
 | 
   157 byte as the loweset bit as opposed to the higest bit.</p>
 | 
| 
 | 
   158 </dd>
 | 
| 
 | 
   159 <dt><strong><a name="getbitsasoctalstring" class="item"><strong>GetBitsAsOctalString</strong></a></strong></dt>
 | 
| 
 | 
   160 <dd>
 | 
| 
 | 
   161 <div class="OptionsBox">
 | 
| 
 | 
   162     $BitString = $BitVector->GetBitsAsOctalString([$BitOrder]);</div>
 | 
| 
 | 
   163 <p>Returns values of bits in <em>BitVector</em> as an octal bit string containing values form 0 to
 | 
| 
 | 
   164 7.</p>
 | 
| 
 | 
   165 <p>Default <em>BitOrder</em> is <em>Ascending</em> bit order which corresponds to first bit in each
 | 
| 
 | 
   166 byte as the loweset bit as opposed to the higest bit.</p>
 | 
| 
 | 
   167 </dd>
 | 
| 
 | 
   168 <dt><strong><a name="getbitsasrawbinarystring" class="item"><strong>GetBitsAsRawBinaryString</strong></a></strong></dt>
 | 
| 
 | 
   169 <dd>
 | 
| 
 | 
   170 <div class="OptionsBox">
 | 
| 
 | 
   171     $BitString = $BitVector->GetBitsAsRawBinaryString();</div>
 | 
| 
 | 
   172 <p>Returns values of bits in <em>BitVector</em> as an string corresponding to packed bit values
 | 
| 
 | 
   173 used by Perl vec function without perfoming any unpacking.</p>
 | 
| 
 | 
   174 </dd>
 | 
| 
 | 
   175 <dt><strong><a name="getdensityofclearbits" class="item"><strong>GetDensityOfClearBits</strong></a></strong></dt>
 | 
| 
 | 
   176 <dd>
 | 
| 
 | 
   177 <div class="OptionsBox">
 | 
| 
 | 
   178     $ClearBitsDensity = $BitVector->GetDensityOfClearBits();</div>
 | 
| 
 | 
   179 <p>Returns density of clear bits in <em>BitVector</em> which corresponds to number of bits set to 0
 | 
| 
 | 
   180 <em>BitVector</em> divided by its size.</p>
 | 
| 
 | 
   181 </dd>
 | 
| 
 | 
   182 <dt><strong><a name="getdensityofsetbits" class="item"><strong>GetDensityOfSetBits</strong></a></strong></dt>
 | 
| 
 | 
   183 <dd>
 | 
| 
 | 
   184 <div class="OptionsBox">
 | 
| 
 | 
   185     $SetBitsDensity = $BitVector->GetDensityOfSetBits();</div>
 | 
| 
 | 
   186 <p>Returns density of set bits in <em>BitVector</em> which corresponds to number of bits set to 1 in
 | 
| 
 | 
   187 <em>BitVector</em> divided by its size.</p>
 | 
| 
 | 
   188 </dd>
 | 
| 
 | 
   189 <dt><strong><a name="getnumofclearbits" class="item"><strong>GetNumOfClearBits</strong></a></strong></dt>
 | 
| 
 | 
   190 <dd>
 | 
| 
 | 
   191 <div class="OptionsBox">
 | 
| 
 | 
   192     $NumOfClearBits = $BitVector->GetNumOfClearBits();</div>
 | 
| 
 | 
   193 <p>Returns number of bits set to 0 in <em>BitVector</em>.</p>
 | 
| 
 | 
   194 </dd>
 | 
| 
 | 
   195 <dt><strong><a name="getnumofsetbits" class="item"><strong>GetNumOfSetBits</strong></a></strong></dt>
 | 
| 
 | 
   196 <dd>
 | 
| 
 | 
   197 <div class="OptionsBox">
 | 
| 
 | 
   198     $NumOfSetBits = $BitVector->GetNumOfSetBits();</div>
 | 
| 
 | 
   199 <p>Returns number of bits set to 1 in <em>BitVector</em>.</p>
 | 
| 
 | 
   200 </dd>
 | 
| 
 | 
   201 <dt><strong><a name="getsize" class="item"><strong>GetSize</strong></a></strong></dt>
 | 
| 
 | 
   202 <dd>
 | 
| 
 | 
   203 <div class="OptionsBox">
 | 
| 
 | 
   204     $Size = $BitVector->GetSize();</div>
 | 
| 
 | 
   205 <p>Returns size of <em>BitVector</em>.</p>
 | 
| 
 | 
   206 </dd>
 | 
| 
 | 
   207 <dt><strong><a name="isbitclear" class="item"><strong>IsBitClear</strong></a></strong></dt>
 | 
| 
 | 
   208 <dd>
 | 
| 
 | 
   209 <div class="OptionsBox">
 | 
| 
 | 
   210     $Status = $BitVector->IsBitClear();</div>
 | 
| 
 | 
   211 <p>Returns 1 or 0 based on whether <em>BitNum</em> is set to 0 in <em>BitVector</em>.</p>
 | 
| 
 | 
   212 </dd>
 | 
| 
 | 
   213 <dt><strong><a name="isbitset" class="item"><strong>IsBitSet</strong></a></strong></dt>
 | 
| 
 | 
   214 <dd>
 | 
| 
 | 
   215 <div class="OptionsBox">
 | 
| 
 | 
   216     $Status = $BitVector->IsBitSet($BitNum);</div>
 | 
| 
 | 
   217 <p>Returns 1 or 0 based on whether <em>BitNum</em> is set to 1 in <em>BitVector</em>.</p>
 | 
| 
 | 
   218 </dd>
 | 
| 
 | 
   219 <dt><strong><a name="isbitvector" class="item"><strong>IsBitVector</strong></a></strong></dt>
 | 
| 
 | 
   220 <dd>
 | 
| 
 | 
   221 <div class="OptionsBox">
 | 
| 
 | 
   222     $Status = BitVector::IsBitVector($Object);</div>
 | 
| 
 | 
   223 <p>Returns 1 or 0 based on whether <em>Object</em> is a <strong>BitVector</strong> object.</p>
 | 
| 
 | 
   224 </dd>
 | 
| 
 | 
   225 <dt><strong><a name="newfrombinarystring" class="item"><strong>NewFromBinaryString</strong></a></strong></dt>
 | 
| 
 | 
   226 <dd>
 | 
| 
 | 
   227 <div class="OptionsBox">
 | 
| 
 | 
   228     $NewBitVector = BitVector::NewFromBinaryString($BinaryString,
 | 
| 
 | 
   229                     [$BitOrder]);
 | 
| 
 | 
   230 <br/>    $NewBitVector = $BitVector->NewFromBinaryString($BinaryString,
 | 
| 
 | 
   231                     [$BitOrder]);</div>
 | 
| 
 | 
   232 <p>Creates a new <em>BitVector</em> using <em>BinaryString</em> and returns new <strong>BitVector</strong> object.</p>
 | 
| 
 | 
   233 <p>Default <em>BitOrder</em> is <em>Ascending</em> bit order which corresponds to first bit in each
 | 
| 
 | 
   234 byte as the loweset bit as opposed to the higest bit.</p>
 | 
| 
 | 
   235 </dd>
 | 
| 
 | 
   236 <dt><strong><a name="newfromdecimalstring" class="item"><strong>NewFromDecimalString</strong></a></strong></dt>
 | 
| 
 | 
   237 <dd>
 | 
| 
 | 
   238 <div class="OptionsBox">
 | 
| 
 | 
   239     $NewBitVector = BitVector::NewFromDecimalString($DecimalString,
 | 
| 
 | 
   240                     [$BitOrder]);
 | 
| 
 | 
   241 <br/>    $NewBitVector = $BitVector->NewFromDecimalString($DecimalString,
 | 
| 
 | 
   242                     [$BitOrder]);</div>
 | 
| 
 | 
   243 <p>Creates a new <em>BitVector</em> using <em>DecimalString</em> and returns new <strong>BitVector</strong> object.</p>
 | 
| 
 | 
   244 <p>Default <em>BitOrder</em> is <em>Ascending</em> bit order which corresponds to first bit in each
 | 
| 
 | 
   245 byte as the loweset bit as opposed to the higest bit.</p>
 | 
| 
 | 
   246 </dd>
 | 
| 
 | 
   247 <dt><strong><a name="newfromhexadecimalstring" class="item"><strong>NewFromHexadecimalString</strong></a></strong></dt>
 | 
| 
 | 
   248 <dd>
 | 
| 
 | 
   249 <div class="OptionsBox">
 | 
| 
 | 
   250     $NewBitVector = BitVector::NewFromHexadecimalString(
 | 
| 
 | 
   251                     $HexadecimalString, [$BitOrder]);
 | 
| 
 | 
   252 <br/>    $NewBitVector = $BitVector->NewFromHexadecimalString(
 | 
| 
 | 
   253                     $HexadecimalString, [$BitOrder]);</div>
 | 
| 
 | 
   254 <p>Creates a new <em>BitVector</em> using <em>HexadecimalString</em> and returns new <strong>BitVector</strong> object.</p>
 | 
| 
 | 
   255 <p>Default <em>BitOrder</em> is <em>Ascending</em> bit order which corresponds to first bit in each
 | 
| 
 | 
   256 byte as the loweset bit as opposed to the higest bit.</p>
 | 
| 
 | 
   257 </dd>
 | 
| 
 | 
   258 <dt><strong><a name="newfromoctalstring" class="item"><strong>NewFromOctalString</strong></a></strong></dt>
 | 
| 
 | 
   259 <dd>
 | 
| 
 | 
   260 <div class="OptionsBox">
 | 
| 
 | 
   261     $NewBitVector = BitVector::NewFromOctalString($OctalString, [$BitOrder]);
 | 
| 
 | 
   262 <br/>    $NewBitVector = $BitVector->NewFromOctalString($OctalString, [$BitOrder]);</div>
 | 
| 
 | 
   263 <p>Creates a new <em>BitVector</em> using <em>OctalString</em> and returns new <strong>BitVector</strong> object.</p>
 | 
| 
 | 
   264 <p>Default <em>BitOrder</em> is <em>Ascending</em> bit order which corresponds to first bit in each
 | 
| 
 | 
   265 byte as the loweset bit as opposed to the higest bit.</p>
 | 
| 
 | 
   266 </dd>
 | 
| 
 | 
   267 <dt><strong><a name="newfromrawbinarystring" class="item"><strong>NewFromRawBinaryString</strong></a></strong></dt>
 | 
| 
 | 
   268 <dd>
 | 
| 
 | 
   269 <div class="OptionsBox">
 | 
| 
 | 
   270     $NewBitVector = BitVector::NewFromRawBinaryString(
 | 
| 
 | 
   271                     $RawBinaryString);
 | 
| 
 | 
   272 <br/>    $NewBitVector = $BitVector->NewFromRawBinaryString(
 | 
| 
 | 
   273                     $RawBinaryString);</div>
 | 
| 
 | 
   274 <p>Creates a new <em>BitVector</em> using <em>RawBinaryString</em> and returns new <strong>BitVector</strong> object.</p>
 | 
| 
 | 
   275 </dd>
 | 
| 
 | 
   276 <dt><strong><a name="reverse" class="item"><strong>Reverse</strong></a></strong></dt>
 | 
| 
 | 
   277 <dd>
 | 
| 
 | 
   278 <div class="OptionsBox">
 | 
| 
 | 
   279     $BitVector->Reverse();</div>
 | 
| 
 | 
   280 <p>Reverses values of bits in <em>BitVector</em> and returns <em>BitVector</em>. First bit number ends up with
 | 
| 
 | 
   281 value of last bit number.</p>
 | 
| 
 | 
   282 </dd>
 | 
| 
 | 
   283 <dt><strong><a name="setallbits" class="item"><strong>SetAllBits</strong></a></strong></dt>
 | 
| 
 | 
   284 <dd>
 | 
| 
 | 
   285 <div class="OptionsBox">
 | 
| 
 | 
   286     $BitVector->SetAllBits();</div>
 | 
| 
 | 
   287 <p>Sets values of all bits in <em>BitVector</em> to 1 and returns <em>BitVector</em>.</p>
 | 
| 
 | 
   288 </dd>
 | 
| 
 | 
   289 <dt><strong><a name="setbit" class="item"><strong>SetBit</strong></a></strong></dt>
 | 
| 
 | 
   290 <dd>
 | 
| 
 | 
   291 <div class="OptionsBox">
 | 
| 
 | 
   292     $BitVector->SetBit($BitNum);</div>
 | 
| 
 | 
   293 <p>Sets value of <em>BitNum</em> to 1 in <em>BitVector</em> and returns <em>BitVector</em>.</p>
 | 
| 
 | 
   294 </dd>
 | 
| 
 | 
   295 <dt><strong><a name="setbitvalue" class="item"><strong>SetBitValue</strong></a></strong></dt>
 | 
| 
 | 
   296 <dd>
 | 
| 
 | 
   297 <div class="OptionsBox">
 | 
| 
 | 
   298     $BitVector->SetBitValue($BitNum, $BitValue);</div>
 | 
| 
 | 
   299 <p>Sets value of <em>BitNum</em> to <em>BitValue</em> in <em>BitVector</em> and returns <em>BitVector</em>.</p>
 | 
| 
 | 
   300 </dd>
 | 
| 
 | 
   301 <dt><strong><a name="setbitvaluebitorder" class="item"><strong>SetBitValueBitOrder</strong></a></strong></dt>
 | 
| 
 | 
   302 <dd>
 | 
| 
 | 
   303 <div class="OptionsBox">
 | 
| 
 | 
   304     BitVector::SetBitValueBitOrder($BitOrder);
 | 
| 
 | 
   305 <br/>    $BitVector->SetBitValueBitOrder($BitOrder);</div>
 | 
| 
 | 
   306 <p>Set bit order for printing <strong>BitVector</strong> values during stringification of <strong>BitVector</strong> object.
 | 
| 
 | 
   307 Possible bit order values: <em>Ascending or Descending</em>.</p>
 | 
| 
 | 
   308 <p>Bit order can be set for either an individual <strong>BitVector</strong> object or the class. Default is
 | 
| 
 | 
   309 to print bits in each byte in <em>Asscending</em> bit order.</p>
 | 
| 
 | 
   310 <p>Internally, bits are stored in <em>Ascending</em> bit order using Perl vec function. Regardless
 | 
| 
 | 
   311 of machine order, big-endian or little-endian, vec function always considers first
 | 
| 
 | 
   312 string byte as the lowest byte and first bit within each byte as the lowest bit.</p>
 | 
| 
 | 
   313 </dd>
 | 
| 
 | 
   314 <dt><strong><a name="setbitvalueprintformat" class="item"><strong>SetBitValuePrintFormat</strong></a></strong></dt>
 | 
| 
 | 
   315 <dd>
 | 
| 
 | 
   316 <div class="OptionsBox">
 | 
| 
 | 
   317     BitVector::SetBitValuePrintFormat($PrintValueFormat);
 | 
| 
 | 
   318 <br/>    $BitVector->SetBitValuePrintFormat($PrintValueFormat);</div>
 | 
| 
 | 
   319 <p>Set bit values print format for printing <strong>BitVector</strong> values during stringification of <strong>BitVector</strong>
 | 
| 
 | 
   320 object. Possible print format values: <em>Binary, Bin, Hexadecimal, Hex, Decimal, Dec, Octal,
 | 
| 
 | 
   321 Oct, RawBinary, RawBin</em>. Default: <em>Binary</em>.</p>
 | 
| 
 | 
   322 <p>Bit values print format can be set for either an individual <strong>BitVector</strong> object or the class.</p>
 | 
| 
 | 
   323 </dd>
 | 
| 
 | 
   324 <dt><strong><a name="setbits" class="item"><strong>SetBits</strong></a></strong></dt>
 | 
| 
 | 
   325 <dd>
 | 
| 
 | 
   326 <div class="OptionsBox">
 | 
| 
 | 
   327     $BitVector->SetBits(@BitNums);</div>
 | 
| 
 | 
   328 <p>Set specified bit numbers <em>BitNums</em> to 1 in <em>BitVector</em> object and return <em>BitVector</em>.</p>
 | 
| 
 | 
   329 </dd>
 | 
| 
 | 
   330 <dt><strong><a name="setbitsasbinarystring" class="item"><strong>SetBitsAsBinaryString</strong></a></strong></dt>
 | 
| 
 | 
   331 <dd>
 | 
| 
 | 
   332 <div class="OptionsBox">
 | 
| 
 | 
   333     $BitVector->SetBitsAsBinaryString($BinaryString);</div>
 | 
| 
 | 
   334 <p>Set bit values in <em>BitVector</em> using specified <em>BinaryString</em> and return <em>BitVector</em>. The
 | 
| 
 | 
   335 size of <em>BitVector</em> is not changed.</p>
 | 
| 
 | 
   336 </dd>
 | 
| 
 | 
   337 <dt><strong><a name="setbitsasdecimalstring" class="item"><strong>SetBitsAsDecimalString</strong></a></strong></dt>
 | 
| 
 | 
   338 <dd>
 | 
| 
 | 
   339 <div class="OptionsBox">
 | 
| 
 | 
   340     $BitVector->SetBitsAsDecimalString($DecimalString, [$BitOrder]);</div>
 | 
| 
 | 
   341 <p>Set bit values in <em>BitVector</em> using specified <em>DecimalString</em> and return <em>BitVector</em>. The
 | 
| 
 | 
   342 size of <em>BitVector</em> is not changed.</p>
 | 
| 
 | 
   343 </dd>
 | 
| 
 | 
   344 <dt><strong><a name="setbitsashexadecimalstring" class="item"><strong>SetBitsAsHexadecimalString</strong></a></strong></dt>
 | 
| 
 | 
   345 <dd>
 | 
| 
 | 
   346 <div class="OptionsBox">
 | 
| 
 | 
   347     $BitVector->SetBitsAsHexadecimalString($HexadecimalString, [$BitOrder]);</div>
 | 
| 
 | 
   348 <p>Set bit values in <em>BitVector</em> using specified <em>HexadecimalString</em> and return <em>BitVector</em>. The
 | 
| 
 | 
   349 size of <em>BitVector</em> is not changed.</p>
 | 
| 
 | 
   350 </dd>
 | 
| 
 | 
   351 <dt><strong><a name="setbitsasoctalstring" class="item"><strong>SetBitsAsOctalString</strong></a></strong></dt>
 | 
| 
 | 
   352 <dd>
 | 
| 
 | 
   353 <div class="OptionsBox">
 | 
| 
 | 
   354     $BitVector->SetBitsAsOctalString($OctalString, [$BitOrder]);</div>
 | 
| 
 | 
   355 <p>Set bit values in <em>BitVector</em> using specified <em>OctalString</em> and return <em>BitVector</em>. The
 | 
| 
 | 
   356 size of <em>BitVector</em> is not changed.</p>
 | 
| 
 | 
   357 </dd>
 | 
| 
 | 
   358 <dt><strong><a name="setbitsasrawbinarystring" class="item"><strong>SetBitsAsRawBinaryString</strong></a></strong></dt>
 | 
| 
 | 
   359 <dd>
 | 
| 
 | 
   360 <div class="OptionsBox">
 | 
| 
 | 
   361     $BitVector->SetBitsAsRawBinaryString($RawBinaryString);</div>
 | 
| 
 | 
   362 <p>Set bit values in <em>BitVector</em> using specified <em>RawBinaryString</em> and return <em>BitVector</em>. The
 | 
| 
 | 
   363 size of <em>BitVector</em> is not changed.</p>
 | 
| 
 | 
   364 </dd>
 | 
| 
 | 
   365 <dt><strong><a name="setbitsrange" class="item"><strong>SetBitsRange</strong></a></strong></dt>
 | 
| 
 | 
   366 <dd>
 | 
| 
 | 
   367 <div class="OptionsBox">
 | 
| 
 | 
   368     $BitVector->SetBitsRange($MinBitNum, $MaxBitNum);</div>
 | 
| 
 | 
   369 <p>Set specified bit numbers between <em>MinBitNum</em> and <em>MaxBitNum</em> to 1 in <em>BitVector</em>
 | 
| 
 | 
   370 object and return <em>BitVector</em>.</p>
 | 
| 
 | 
   371 </dd>
 | 
| 
 | 
   372 <dt><strong><a name="stringifybitvector" class="item"><strong>StringifyBitVector</strong></a></strong></dt>
 | 
| 
 | 
   373 <dd>
 | 
| 
 | 
   374 <div class="OptionsBox">
 | 
| 
 | 
   375     $String = $BitVector->StringifyBitVector();</div>
 | 
| 
 | 
   376 <p>Returns a string containing information about <em>BitVector</em> object.</p>
 | 
| 
 | 
   377 </dd>
 | 
| 
 | 
   378 </dl>
 | 
| 
 | 
   379 <p>
 | 
| 
 | 
   380 </p>
 | 
| 
 | 
   381 <h2>AUTHOR</h2>
 | 
| 
 | 
   382 <p><a href="mailto:msud@san.rr.com">Manish Sud</a></p>
 | 
| 
 | 
   383 <p>
 | 
| 
 | 
   384 </p>
 | 
| 
 | 
   385 <h2>SEE ALSO</h2>
 | 
| 
 | 
   386 <p><a href="./Vector.html">Vector.pm</a>
 | 
| 
 | 
   387 </p>
 | 
| 
 | 
   388 <p>
 | 
| 
 | 
   389 </p>
 | 
| 
 | 
   390 <h2>COPYRIGHT</h2>
 | 
| 
 | 
   391 <p>Copyright (C) 2015 Manish Sud. All rights reserved.</p>
 | 
| 
 | 
   392 <p>This file is part of MayaChemTools.</p>
 | 
| 
 | 
   393 <p>MayaChemTools is free software; you can redistribute it and/or modify it under
 | 
| 
 | 
   394 the terms of the GNU Lesser General Public License as published by the Free
 | 
| 
 | 
   395 Software Foundation; either version 3 of the License, or (at your option)
 | 
| 
 | 
   396 any later version.</p>
 | 
| 
 | 
   397 <p> </p><p> </p><div class="DocNav">
 | 
| 
 | 
   398 <table width="100%" border=0 cellpadding=0 cellspacing=2>
 | 
| 
 | 
   399 <tr align="left" valign="top"><td width="33%" align="left"><a href="./UFFAtomTypes.html" title="UFFAtomTypes.html">Previous</a>  <a href="./index.html" title="Table of Contents">TOC</a>  <a href="./Bond.html" title="Bond.html">Next</a></td><td width="34%" align="middle"><strong>March 29, 2015</strong></td><td width="33%" align="right"><strong>BitVector.pm</strong></td></tr>
 | 
| 
 | 
   400 </table>
 | 
| 
 | 
   401 </div>
 | 
| 
 | 
   402 <br />
 | 
| 
 | 
   403 <center>
 | 
| 
 | 
   404 <img src="../../images/h2o2.png">
 | 
| 
 | 
   405 </center>
 | 
| 
 | 
   406 </body>
 | 
| 
 | 
   407 </html>
 |