annotate mayachemtool/mayachemtools/docs/modules/txt/BitVector.txt @ 0:a4a2ad5a214e draft default tip

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