0
|
1 .\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.22)
|
|
2 .\"
|
|
3 .\" Standard preamble:
|
|
4 .\" ========================================================================
|
|
5 .de Sp \" Vertical space (when we can't use .PP)
|
|
6 .if t .sp .5v
|
|
7 .if n .sp
|
|
8 ..
|
|
9 .de Vb \" Begin verbatim text
|
|
10 .ft CW
|
|
11 .nf
|
|
12 .ne \\$1
|
|
13 ..
|
|
14 .de Ve \" End verbatim text
|
|
15 .ft R
|
|
16 .fi
|
|
17 ..
|
|
18 .\" Set up some character translations and predefined strings. \*(-- will
|
|
19 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
|
|
20 .\" double quote, and \*(R" will give a right double quote. \*(C+ will
|
|
21 .\" give a nicer C++. Capital omega is used to do unbreakable dashes and
|
|
22 .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
|
|
23 .\" nothing in troff, for use with C<>.
|
|
24 .tr \(*W-
|
|
25 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
|
|
26 .ie n \{\
|
|
27 . ds -- \(*W-
|
|
28 . ds PI pi
|
|
29 . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
|
|
30 . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
|
|
31 . ds L" ""
|
|
32 . ds R" ""
|
|
33 . ds C` ""
|
|
34 . ds C' ""
|
|
35 'br\}
|
|
36 .el\{\
|
|
37 . ds -- \|\(em\|
|
|
38 . ds PI \(*p
|
|
39 . ds L" ``
|
|
40 . ds R" ''
|
|
41 'br\}
|
|
42 .\"
|
|
43 .\" Escape single quotes in literal strings from groff's Unicode transform.
|
|
44 .ie \n(.g .ds Aq \(aq
|
|
45 .el .ds Aq '
|
|
46 .\"
|
|
47 .\" If the F register is turned on, we'll generate index entries on stderr for
|
|
48 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
|
|
49 .\" entries marked with X<> in POD. Of course, you'll have to process the
|
|
50 .\" output yourself in some meaningful fashion.
|
|
51 .ie \nF \{\
|
|
52 . de IX
|
|
53 . tm Index:\\$1\t\\n%\t"\\$2"
|
|
54 ..
|
|
55 . nr % 0
|
|
56 . rr F
|
|
57 .\}
|
|
58 .el \{\
|
|
59 . de IX
|
|
60 ..
|
|
61 .\}
|
|
62 .\"
|
|
63 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
|
|
64 .\" Fear. Run. Save yourself. No user-serviceable parts.
|
|
65 . \" fudge factors for nroff and troff
|
|
66 .if n \{\
|
|
67 . ds #H 0
|
|
68 . ds #V .8m
|
|
69 . ds #F .3m
|
|
70 . ds #[ \f1
|
|
71 . ds #] \fP
|
|
72 .\}
|
|
73 .if t \{\
|
|
74 . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
|
|
75 . ds #V .6m
|
|
76 . ds #F 0
|
|
77 . ds #[ \&
|
|
78 . ds #] \&
|
|
79 .\}
|
|
80 . \" simple accents for nroff and troff
|
|
81 .if n \{\
|
|
82 . ds ' \&
|
|
83 . ds ` \&
|
|
84 . ds ^ \&
|
|
85 . ds , \&
|
|
86 . ds ~ ~
|
|
87 . ds /
|
|
88 .\}
|
|
89 .if t \{\
|
|
90 . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
|
|
91 . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
|
|
92 . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
|
|
93 . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
|
|
94 . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
|
|
95 . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
|
|
96 .\}
|
|
97 . \" troff and (daisy-wheel) nroff accents
|
|
98 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
|
|
99 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
|
|
100 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
|
|
101 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
|
|
102 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
|
|
103 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
|
|
104 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
|
|
105 .ds ae a\h'-(\w'a'u*4/10)'e
|
|
106 .ds Ae A\h'-(\w'A'u*4/10)'E
|
|
107 . \" corrections for vroff
|
|
108 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
|
|
109 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
|
|
110 . \" for low resolution devices (crt and lpr)
|
|
111 .if \n(.H>23 .if \n(.V>19 \
|
|
112 \{\
|
|
113 . ds : e
|
|
114 . ds 8 ss
|
|
115 . ds o a
|
|
116 . ds d- d\h'-1'\(ga
|
|
117 . ds D- D\h'-1'\(hy
|
|
118 . ds th \o'bp'
|
|
119 . ds Th \o'LP'
|
|
120 . ds ae ae
|
|
121 . ds Ae AE
|
|
122 .\}
|
|
123 .rm #[ #] #H #V #F C
|
|
124 .\" ========================================================================
|
|
125 .\"
|
|
126 .IX Title "PSEUDOHEAP 1"
|
|
127 .TH PSEUDOHEAP 1 "2015-03-29" "perl v5.14.2" "MayaChemTools"
|
|
128 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
|
|
129 .\" way too many mistakes in technical documents.
|
|
130 .if n .ad l
|
|
131 .nh
|
|
132 .SH "NAME"
|
|
133 PseudoHeap
|
|
134 .SH "SYNOPSIS"
|
|
135 .IX Header "SYNOPSIS"
|
|
136 use PseudoHeap;
|
|
137 .PP
|
|
138 use PseudoHeap qw(:all);
|
|
139 .SH "DESCRIPTION"
|
|
140 .IX Header "DESCRIPTION"
|
|
141 \&\fBPseudoHeap\fR class provides the following methods:
|
|
142 .PP
|
|
143 new, AddKeyValuePair, AddKeyValuePairs, DeleteKey, DeleteKeys, DeleteMaxKey,
|
|
144 DeleteMinKey, GetCurrentSize, GetKeyType, GetKeyValues, GetKeys, GetMaxKey,
|
|
145 GetMaxSize, GetMinKey, GetSortedKeys, GetType, SetKeyType, SetMaxSize, SetType,
|
|
146 StringifyPseudoHeap
|
|
147 .PP
|
|
148 PseudoHeap is designed to support tracking of a specific number of largest or smallest key/value
|
|
149 pairs with numeric or alphanumeric keys along with corresponding scalar or reference values.
|
|
150 .PP
|
|
151 Although PseudoHeap is conceptually similar to a heap, it lacks number of key properties of a traditional
|
|
152 heap data structure: no concept of root, parent and child nodes; no ordering of keys in any particular
|
|
153 order; no specific location greatest or smallest key.
|
|
154 .PP
|
|
155 The keys are simply stored in a hash with each key pointing to an array containing specified values.
|
|
156 The min/max keys are updated during addition and deletion of key/value pairs; these can be retrieved
|
|
157 by accessing corresponding hash.
|
|
158 .PP
|
|
159 Addition and deletion of key/value is also straightforward using hashes. However, min/max keys
|
|
160 need to be identified which is done using Perl sort function on the keys.
|
|
161 .SS "\s-1FUNCTIONS\s0"
|
|
162 .IX Subsection "FUNCTIONS"
|
|
163 .IP "\fBnew\fR" 4
|
|
164 .IX Item "new"
|
|
165 .Vb 1
|
|
166 \& $NewPseudoHeap = new PseudoHeap(%NamesAndValues);
|
|
167 .Ve
|
|
168 .Sp
|
|
169 Using specified parameters \fINamesAndValues\fR names and values hash, \fBnew\fR method creates
|
|
170 a new object and returns a reference to a newly created \fBNewPseudoHeap\fR object. By default,
|
|
171 the following property names are initialized:
|
|
172 .Sp
|
|
173 .Vb 3
|
|
174 \& Type = undef;
|
|
175 \& KeyType = undef;
|
|
176 \& MaxSize = 10;
|
|
177 .Ve
|
|
178 .Sp
|
|
179 Examples:
|
|
180 .Sp
|
|
181 .Vb 3
|
|
182 \& $NewPseudoHeap = new PseudoHeap(
|
|
183 \& \*(AqType\*(Aq => \*(AqKeepTopN\*(Aq,
|
|
184 \& \*(AqKeyType\*(Aq => \*(AqNumeric\*(Aq);
|
|
185 \&
|
|
186 \& $NewPseudoHeap = new PseudoHeap(
|
|
187 \& \*(AqType\*(Aq => \*(AqKeepTopN\*(Aq,
|
|
188 \& \*(AqKeyType\*(Aq => \*(AqAlphaNumeric\*(Aq,
|
|
189 \& \*(AqMaxSize\*(Aq => \*(Aq20\*(Aq);
|
|
190 \&
|
|
191 \& $NewPseudoHeap = new PseudoHeap(
|
|
192 \& \*(AqType\*(Aq => \*(AqKeepBottomN\*(Aq,
|
|
193 \& \*(AqKeyType\*(Aq => \*(AqAlphaNumeric\*(Aq,
|
|
194 \& \*(AqMaxSize\*(Aq => \*(Aq20\*(Aq);
|
|
195 .Ve
|
|
196 .IP "\fBAddKeyValuePair\fR" 4
|
|
197 .IX Item "AddKeyValuePair"
|
|
198 .Vb 1
|
|
199 \& $PseudoHeap\->AddKeyValuePair($Key, $Value);
|
|
200 .Ve
|
|
201 .Sp
|
|
202 Add specified \fIKey\fR and \fIValue\fR pair to pseudo heap using a new or an existing
|
|
203 key and returns \fBPseudoHeap\fR.
|
|
204 .IP "\fBAddKeyValuePairs\fR" 4
|
|
205 .IX Item "AddKeyValuePairs"
|
|
206 .Vb 1
|
|
207 \& $PseudoHeap\->AddKeyValuePairs(@KeyValuePairs);
|
|
208 .Ve
|
|
209 .Sp
|
|
210 Adds multiple key and value pairs specified in array \fIKeyValuePairs\fR to pseudo heap
|
|
211 using a new or existing keys and returns \fBPseudoHeap\fR.
|
|
212 .IP "\fBDeleteKey\fR" 4
|
|
213 .IX Item "DeleteKey"
|
|
214 .Vb 1
|
|
215 \& $PseudoHeap\->DeleteKey($Key);
|
|
216 .Ve
|
|
217 .Sp
|
|
218 Deletes a specified \fIKey\fR from pseudo heap and returns \fBPseudoHeap\fR.
|
|
219 .IP "\fBDeleteKeys\fR" 4
|
|
220 .IX Item "DeleteKeys"
|
|
221 .Vb 1
|
|
222 \& $PseudoHeap\->DeleteKeys(@Keys);
|
|
223 .Ve
|
|
224 .Sp
|
|
225 Deletes a specified \fIKeys\fR from pseudo heap and returns \fBPseudoHeap\fR.
|
|
226 .IP "\fBDeleteMaxKey\fR" 4
|
|
227 .IX Item "DeleteMaxKey"
|
|
228 .Vb 1
|
|
229 \& $PseudoHeap\->DeleteMaxKey();
|
|
230 .Ve
|
|
231 .Sp
|
|
232 Deletes a \fIMaxKey\fR along with its associated values from pseudo heap and returns
|
|
233 \&\fBPseudoHeap\fR.
|
|
234 .IP "\fBDeleteMinKey\fR" 4
|
|
235 .IX Item "DeleteMinKey"
|
|
236 .Vb 1
|
|
237 \& $PseudoHeap\->DeleteMinKey();
|
|
238 .Ve
|
|
239 .Sp
|
|
240 Deletes a \fIMinKey\fR along with its associated values from pseudo heap and returns
|
|
241 \&\fBPseudoHeap\fR.
|
|
242 .IP "\fBGetCurrentSize\fR" 4
|
|
243 .IX Item "GetCurrentSize"
|
|
244 .Vb 1
|
|
245 \& $Size = $PseudoHeap\->GetCurrentSize();
|
|
246 .Ve
|
|
247 .Sp
|
|
248 Returns current \fISize\fR of pseudo heap corresponding to number to keys in heap.
|
|
249 .IP "\fBGetKeyType\fR" 4
|
|
250 .IX Item "GetKeyType"
|
|
251 .Vb 1
|
|
252 \& $KeyType = $PseudoHeap\->GetKeyType();
|
|
253 .Ve
|
|
254 .Sp
|
|
255 Returns \fIKeyType\fR of pseudo heap. Possible \fBKeyType\fR values: \fINumeric or Alphanumeric\fR.
|
|
256 .IP "\fBGetKeyValues\fR" 4
|
|
257 .IX Item "GetKeyValues"
|
|
258 .Vb 2
|
|
259 \& @Values = $PseudoHeap\->GetKeyValues($Key);
|
|
260 \& $NumOfValues = $PseudoHeap\->GetKeyValues($Key);
|
|
261 .Ve
|
|
262 .Sp
|
|
263 Returns an array containing \fBValues\fR associated with a specified \fIKey\fR in pseudo heap. In
|
|
264 scalar context, it returns number of values associated with a key.
|
|
265 .IP "\fBGetKeys\fR" 4
|
|
266 .IX Item "GetKeys"
|
|
267 .Vb 2
|
|
268 \& @Keys = $PseudoHeap\->GetKeys();
|
|
269 \& $NumOfKeys = $PseudoHeap\->GetKeys();
|
|
270 .Ve
|
|
271 .Sp
|
|
272 Returns an array containing all \fBKeys\fR in pseudo heap. In scalar context, it returns total
|
|
273 number of keys.
|
|
274 .IP "\fBGetMaxKey\fR" 4
|
|
275 .IX Item "GetMaxKey"
|
|
276 .Vb 1
|
|
277 \& $MaxKey = $PseudoHeap\->GetMaxKey();
|
|
278 .Ve
|
|
279 .Sp
|
|
280 Returns \fIMaxKey\fR present in pseudo heap.
|
|
281 .IP "\fBGetMaxSize\fR" 4
|
|
282 .IX Item "GetMaxSize"
|
|
283 .Vb 1
|
|
284 \& $MaxSize = $PseudoHeap\->GetMaxSize();
|
|
285 .Ve
|
|
286 .Sp
|
|
287 Returns \fIMaxSize\fR of pseudo heap.
|
|
288 .IP "\fBGetMinKey\fR" 4
|
|
289 .IX Item "GetMinKey"
|
|
290 .Vb 1
|
|
291 \& $MinKey = $PseudoHeap\->GetMinKey();
|
|
292 .Ve
|
|
293 .Sp
|
|
294 Returns \fIMinKey\fR present in pseudo heap.
|
|
295 .IP "\fBGetSortedKeys\fR" 4
|
|
296 .IX Item "GetSortedKeys"
|
|
297 .Vb 2
|
|
298 \& @Keys = $PseudoHeap\->GetSortedKeys();
|
|
299 \& $NumOfKeys = $PseudoHeap\->GetSortedKeys();
|
|
300 .Ve
|
|
301 .Sp
|
|
302 Returns an array containing all sorted \fBKeys\fR in pseudo heap. In scalar context, it retruns
|
|
303 total number of keys.
|
|
304 .Sp
|
|
305 Keys are sorted based on values of \fBType\fR and \fBKeyType\fR for pseudo heap:
|
|
306 .Sp
|
|
307 .Vb 5
|
|
308 \& Type KeyType SortOrder SortOperator
|
|
309 \& KeepTopN Numeric Descending <=>
|
|
310 \& KeepTopN Alphanumeric Descending cmp
|
|
311 \& KeepBottomN Numeric Ascending <=>
|
|
312 \& KeepBottomN Alphanumeric Ascending cmp
|
|
313 .Ve
|
|
314 .IP "\fBGetType\fR" 4
|
|
315 .IX Item "GetType"
|
|
316 .Vb 1
|
|
317 \& $Type = $PseudoHeap\->GetType();
|
|
318 .Ve
|
|
319 .Sp
|
|
320 Returns \fIType\fR of pseudo heap.
|
|
321 .IP "\fBSetKeyType\fR" 4
|
|
322 .IX Item "SetKeyType"
|
|
323 .Vb 1
|
|
324 \& $PseudoHeap\->SetKeyType($KeyType);
|
|
325 .Ve
|
|
326 .Sp
|
|
327 Sets \fIKeyType\fR of pseudo heap and returns \fBPseudoHeap\fR.
|
|
328 .IP "\fBSetMaxSize\fR" 4
|
|
329 .IX Item "SetMaxSize"
|
|
330 .Vb 1
|
|
331 \& $PseudoHeap\->SetMaxSize($MaxSize);
|
|
332 .Ve
|
|
333 .Sp
|
|
334 Sets \fIMaxSize\fR of pseudo heap and returns \fBPseudoHeap\fR.
|
|
335 .IP "\fBSetType\fR" 4
|
|
336 .IX Item "SetType"
|
|
337 .Vb 1
|
|
338 \& $PseudoHeap\->SetType($Type);
|
|
339 .Ve
|
|
340 .Sp
|
|
341 Sets \fIType\fR of pseudo heap and returns \fBPseudoHeap\fR.
|
|
342 .IP "\fBStringifyPseudoHeap\fR" 4
|
|
343 .IX Item "StringifyPseudoHeap"
|
|
344 .Vb 1
|
|
345 \& $PseudoHeapString = $PseudoHeap\->StringifyPseudoHeap();
|
|
346 .Ve
|
|
347 .Sp
|
|
348 Returns a string containing information about \fIPseudoHeap\fR object
|
|
349 .SH "AUTHOR"
|
|
350 .IX Header "AUTHOR"
|
|
351 Manish Sud <msud@san.rr.com>
|
|
352 .SH "COPYRIGHT"
|
|
353 .IX Header "COPYRIGHT"
|
|
354 Copyright (C) 2015 Manish Sud. All rights reserved.
|
|
355 .PP
|
|
356 This file is part of MayaChemTools.
|
|
357 .PP
|
|
358 MayaChemTools is free software; you can redistribute it and/or modify it under
|
|
359 the terms of the \s-1GNU\s0 Lesser General Public License as published by the Free
|
|
360 Software Foundation; either version 3 of the License, or (at your option)
|
|
361 any later version.
|