File: dynhasharray.xml

package info (click to toggle)
lazarus 2.2.6%2Bdfsg2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 219,980 kB
  • sloc: pascal: 1,944,919; xml: 357,634; makefile: 270,608; cpp: 57,115; sh: 3,249; java: 609; perl: 297; sql: 222; ansic: 137
file content (1091 lines) | stat: -rw-r--r-- 37,385 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
<?xml version="1.0" encoding="UTF-8"?>
<fpdoc-descriptions>
  <package name="lazutils">
    <!--
    ====================================================================
      DynHashArray
    ====================================================================
    -->
    <module name="DynHashArray">
      <short>Contains classes used to manage dynamic sets or associative arrays.</short>
      <descr>
        <p>
          <file>DynHashArray.pp</file> extends the functionality of Pascal by
          offering alternative data structure: set like array (the order is not kept)
          with fast find/delete. Its size can change automatically during the
          execution of the program.  The price is that it is somewhat slower than
          a number indexes access of an array.
        </p>
        <p>
          This unit defines TDynHashArray, which is very similar to a TList, since
          it also stores pointer/objects.
        </p>
        <p>
          It supports Add, Remove, Contains, First, Count and Clear.
        </p>
        <p>
          Because of the hashing nature the operations adding, removing and
          finding is done in constant time on average.
        </p>
        <p>
          <b>Inner structure:</b>
        </p>
        <p>
          There are three parts:
        </p>
        <ul>
          <li>
            The array itself (FItems). Every entry is a pointer to the first
               TDynHashArrayItem of a list with the same hash index.
               The first item of every same index list is the list beginning
               and its IsOverflow flag is set to false. All other items are
               overflow items. To get all items with the same hash index,
               do a FindHashItem. Then search through all "Next" items
               until Next is nil or its IsOverflow flag is set to false.
          </li>
          <li>
            The items beginning with FFirstItem is a 2-way-connected list
            of TDynHashArrayItem. This list contains all used items.
          </li>
          <li>
          To reduce GetMem/FreeMem calls, free items are cached.
        </li>
        </ul>
        <p>
          <b>Issues:</b>
        </p>
        <p>
          The maximum capacity is the PrimeNumber. You can store more items,
          but the performance decreases. The best idea is to provide your own
          hash function.
        </p>
        <p>
          Important: Items in the TDynHashArray must not change their key. When
          changing the key of an item, remove it and add it after the change.
        </p>
        <p>
          This file is part of the <file>LazUtils</file> package.
        </p>
      </descr>

      <!-- unresolved type reference Visibility: default -->
      <element name="Classes"/>
      <element name="SysUtils"/>
      <element name="LazLoggerBase"/>

      <!-- function type Visibility: default -->
      <element name="THashFunction">
        <short>Type for hash function.</short>
        <descr>Each hash function specified by the user has to have these parameters</descr>
        <seealso/>
      </element>
      <!-- function result Visibility: default -->
      <element name="THashFunction.Result">
        <short/>
      </element>
      <!-- argument Visibility: default -->
      <element name="THashFunction.Sender">
        <short/>
      </element>
      <!-- argument Visibility: default -->
      <element name="THashFunction.Item">
        <short/>
      </element>
      <!-- function type Visibility: default -->
      <element name="TOwnerHashFunction">
        <short>Defines a hash function implemented as an object procedure.</short>
        <descr/>
        <seealso/>
      </element>
      <!-- function result Visibility: default -->
      <element name="TOwnerHashFunction.Result">
        <short/>
      </element>
      <!-- argument Visibility: default -->
      <element name="TOwnerHashFunction.Item">
        <short/>
      </element>
      <!-- function type Visibility: default -->
      <element name="TOnGetKeyForHashItem">
        <short>
          Defines a Pointer function type used to get the key value for a hash item in TDynHashArray.
        </short>
        <descr>
          <p>
            TOnGetKeyForHashItem is the type used for the OnGetKeyForHashItem property in TDynHashArray.
          </p>
        </descr>
        <seealso/>
      </element>
      <!-- function result Visibility: default -->
      <element name="TOnGetKeyForHashItem.Result">
        <short/>
      </element>
      <!-- argument Visibility: default -->
      <element name="TOnGetKeyForHashItem.Item">
        <short/>
      </element>

      <element name="TOnEachHashItem">
        <short>
          Defines a Boolean function type used to enumerate hash items in TDynHashArray.
        </short>
        <descr/>
        <seealso/>
      </element>
      <element name="TOnEachHashItem.Result">
        <short/>
      </element>
      <element name="TOnEachHashItem.Sender">
        <short/>
      </element>
      <element name="TOnEachHashItem.Item">
        <short/>
      </element>

      <!-- pointer type Visibility: default -->
      <element name="PDynHashArrayItem">
        <short>Pointer to a TDynHashArrayItem instance.</short>
        <descr/>
        <seealso/>
      </element>
      <!-- record type Visibility: default -->
      <element name="TDynHashArrayItem">
        <short>
          Record type with pointers to the current, previous, and next has items in a linked list.
        </short>
        <descr/>
        <seealso/>
      </element>
      <!-- variable Visibility: default -->
      <element name="TDynHashArrayItem.Item">
        <short>Pointer to an element to be stored in the array.</short>
        <descr/>
        <seealso/>
      </element>
      <!-- variable Visibility: default -->
      <element name="TDynHashArrayItem.Next">
        <short>It points to the next element in the doubly linked list.</short>
        <descr/>
        <seealso/>
      </element>
      <!-- variable Visibility: default -->
      <element name="TDynHashArrayItem.Prior">
        <short>It points to the previous element in the doubly linked list.</short>
        <descr/>
        <seealso/>
      </element>
      <!-- variable Visibility: default -->
      <element name="TDynHashArrayItem.IsOverflow">
        <short>False if it is the first element of the linked list.</short>
        <descr/>
        <seealso/>
      </element>
      <!-- enumeration type Visibility: default -->
      <element name="TDynHashArrayOption">
        <short>Options for how this class should work.</short>
        <descr/>
        <seealso/>
      </element>
      <!-- enumeration value Visibility: default -->
      <element name="TDynHashArrayOption.dhaoCachingEnabled">
        <short>It will use cached result if available in IndexOfKey.</short>
      </element>
      <!-- enumeration value Visibility: default -->
      <element name="TDynHashArrayOption.dhaoCacheContains">
        <short>Turns on a cache for contains operations.</short>
      </element>
      <!-- set type Visibility: default -->
      <element name="TDynHashArrayOptions">
        <short>Set type used to store values from TDynHashArrayOption.</short>
        <descr/>
        <seealso/>
      </element>
      <!-- object Visibility: default -->
      <element name="TDynHashArray">
        <short>Name of the class that store all functions and data for an hashed array.</short>
        <descr>
          <p>
            TDynHashArray is a class which is similar to TList which allows both pointers and objects to be maintained in its internal storage. It includes common methods like Add, Remove, Contains, First, Count and Clear. Because of its hashing nature,  the add, remove, and find operations are done in constant time on average.
          </p>
          <p>
            <b>Inner structure:</b>
          </p>
          <p>
            There are three parts:
          </p>
          <ol>
            <li>
              The array itself (FItems). Every entry is a pointer to the first TDynHashArrayItem of a list with the same hash index. The first item of every same index list is the list beginning and its IsOverflow flag is set to false. All other items are overflow items. To get all items with the same hash index, do a FindHashItem. Then search through all "Next" items until Next is nil or its IsOverflow flag is set to false.
            </li>
            <li>
              The items beginning with FFirstItem is a 2-way-connected list of
              TDynHashArrayItem. This list contains all used items.
            </li>
            <li>To reduce GetMem/FreeMem calls, free items are cached.</li>
          </ol>
          <p>
            <b>Issues:</b>
          </p>
          <p>
            The maximum capacity is the PrimeNumber. You can store more items, but the
            performance decreases. The best idea is to provide your own hash function.
          </p>
          <p>
            <b>Important</b>: Items in the TDynHashArray must not change their key. When changing the key of an item, remove it and add it after the change.
          </p>
        </descr>
        <seealso/>
      </element>
      <!-- variable Visibility: private -->
      <element name="TDynHashArray.FItems">
        <short>Array pointing to link lists.</short>
        <descr/>
        <seealso/>
      </element>
      <!-- variable Visibility: private -->
      <element name="TDynHashArray.FCount">
        <short>Number of elements stored.</short>
        <descr/>
        <seealso/>
      </element>
      <!-- variable Visibility: private -->
      <element name="TDynHashArray.FCapacity">
        <short/>
        <descr/>
        <seealso/>
      </element>
      <!-- variable Visibility: private -->
      <element name="TDynHashArray.FMinCapacity">
        <short>The minimum number of items that will be allocated for an array.</short>
        <descr>
          <p>
            The size of the array can be changed anytime. However, even if a size is given by FCapacity is smaller than this minimum number, then this minimum number of items will be allocated. This is done for efficiency and speed.
          </p>
        </descr>
        <seealso/>
      </element>
      <!-- variable Visibility: private -->
      <element name="TDynHashArray.FMaxCapacity">
        <short>The size of the array cannot be larger than this number.</short>
        <descr>
          <p>
            FCapacity is overridden by this number, if that is larger than this.
          </p>
        </descr>
        <seealso/>
      </element>
      <!-- variable Visibility: private -->
      <element name="TDynHashArray.FFirstItem">
        <short/>
        <descr/>
        <seealso/>
      </element>
      <!-- variable Visibility: private -->
      <element name="TDynHashArray.FHashCacheItem">
        <short>It contains the cached key.</short>
        <descr/>
        <seealso/>
      </element>
      <!-- variable Visibility: private -->
      <element name="TDynHashArray.FHashCacheIndex">
        <short>It contains the cached index derived from the key.</short>
        <descr/>
        <seealso/>
      </element>
      <!-- variable Visibility: private -->
      <element name="TDynHashArray.FLowWaterMark">
        <short>The lower element limit for reallocation.</short>
        <descr>
          <p>
            The number of elements allocated are halved if the number of elements in the array goes below this number.
          </p>
        </descr>
        <seealso/>
      </element>
      <!-- variable Visibility: private -->
      <element name="TDynHashArray.FHighWaterMark">
        <short>The upper element count limit for reallocation.</short>
        <descr>
          <p>
            The number of elements allocated are doubled if the number of elements in the array reaches this number.
          </p>
        </descr>
        <seealso/>
      </element>
      <!-- variable Visibility: private -->
      <element name="TDynHashArray.FCustomHashFunction">
        <short>The pointer to the user-defined hash function.</short>
        <descr/>
        <seealso/>
      </element>
      <!-- variable Visibility: private -->
      <element name="TDynHashArray.FOnGetKeyForHashItem">
        <short>Optional user-defined function for converting keys.</short>
        <descr/>
        <seealso/>
      </element>
      <!-- variable Visibility: private -->
      <element name="TDynHashArray.FOptions">
        <short/>
        <descr/>
        <seealso/>
      </element>
      <!-- variable Visibility: private -->
      <element name="TDynHashArray.FOwnerHashFunction">
        <short>Optional user-defined hash function which can be SlowAlternativeHashMethod.</short>
        <descr/>
        <seealso/>
      </element>
      <!-- variable Visibility: private -->
      <element name="TDynHashArray.FContainsCache">
        <short/>
        <descr/>
        <seealso/>
      </element>
      <!-- function Visibility: private -->
      <element name="TDynHashArray.NewHashItem">
        <short/>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- function result Visibility: default -->
      <element name="TDynHashArray.NewHashItem.Result">
        <short/>
      </element>
      <!-- procedure Visibility: private -->
      <element name="TDynHashArray.DisposeHashItem">
        <short/>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- argument Visibility: default -->
      <element name="TDynHashArray.DisposeHashItem.ADynHashArrayItem">
        <short/>
      </element>
      <!-- procedure Visibility: private -->
      <element name="TDynHashArray.ComputeWaterMarks">
        <short/>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- procedure Visibility: private -->
      <element name="TDynHashArray.SetCapacity">
        <short>Changes the number of items (pre-)allocated.</short>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- argument Visibility: default -->
      <element name="TDynHashArray.SetCapacity.NewCapacity">
        <short/>
      </element>
      <!-- procedure Visibility: private -->
      <element name="TDynHashArray.SetCustomHashFunction">
        <short>Specify your own hash function to be used by the class.</short>
        <descr>
          <p>
            The hash function has to convert a string into a number in a random fashion.
          </p>
        </descr>
        <errors/>
        <seealso/>
      </element>
      <!-- argument Visibility: default -->
      <element name="TDynHashArray.SetCustomHashFunction.AValue">
        <short/>
      </element>
      <!-- procedure Visibility: private -->
      <element name="TDynHashArray.SetOnGetKeyForHashItem">
        <short/>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- argument Visibility: default -->
      <element name="TDynHashArray.SetOnGetKeyForHashItem.AValue">
        <short/>
      </element>
      <!-- procedure Visibility: private -->
      <element name="TDynHashArray.SetOptions">
        <short/>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- argument Visibility: default -->
      <element name="TDynHashArray.SetOptions.AValue">
        <short/>
      </element>
      <!-- procedure Visibility: private -->
      <element name="TDynHashArray.SetOwnerHashFunction">
        <short/>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- argument Visibility: default -->
      <element name="TDynHashArray.SetOwnerHashFunction.AValue">
        <short/>
      </element>
      <!-- procedure Visibility: protected -->
      <element name="TDynHashArray.RebuildItems">
        <short>Rebuilds the internal data structures.</short>
        <descr>
          <p>
            It is called anytime when there is a change that makes it necessary. E.g. hash function changes or because of dynamic reallocation.
          </p>
        </descr>
        <errors/>
        <seealso/>
      </element>
      <!-- procedure Visibility: protected -->
      <element name="TDynHashArray.SaveCacheItem">
        <short>Sets the cache.</short>
        <descr>The cache is set as given by the parameters.</descr>
        <errors/>
        <seealso/>
      </element>
      <!-- argument Visibility: default -->
      <element name="TDynHashArray.SaveCacheItem.Item">
        <short/>
      </element>
      <!-- argument Visibility: default -->
      <element name="TDynHashArray.SaveCacheItem.Index">
        <short/>
      </element>
      <!-- constructor Visibility: public -->
      <element name="TDynHashArray.Create">
        <short>Constructor for the class instance.</short>
        <descr>
          <p>
            Create is the overloaded constructor for the class instance. Overloaded variants are provided which set the initial value in MinCapacity to either a default or a user-specified value. The parameterless version sets the initial value in MinCapacity to 10, but it is automagically increased to 137.
          </p>
          <p>
            MaxCapacity is set to an arbitrarily large prime number defined in the implementation for class.
          </p>
          <p>
            Create allocates memory needed to store the number of TDynHashArrayItem entries specified in its Capacity property. The allocated memory is zero-filled prior to use.
          </p>
        </descr>
        <errors/>
        <seealso/>
      </element>
      <!-- argument Visibility: default -->
      <element name="TDynHashArray.Create.InitialMinCapacity">
        <short>Initial value used as the minimum capacity for the class instance.</short>
      </element>
      <!-- destructor Visibility: public -->
      <element name="TDynHashArray.Destroy">
        <short>Destructor for the class instance.</short>
        <descr>
          <p>
            Destroy is the overridden destructor for the class instance. It calls the Clear method to remove cache entries for the list, and to free the pointers to the TDynHashArrayItem entries starting at FirstHashItem.
          </p>
        </descr>
        <seealso>
          <link id="TDynHashArray.FirstHashItem"/>
          <link id="TDynHashArray.Clear"/>
          <link id="TDynHashArray.ClearCache"/>
        </seealso>
      </element>
      <!-- procedure Visibility: public -->
      <element name="TDynHashArray.Add">
        <short>Adds an item to the set/array.</short>
        <descr><p>An example:</p>
<code>uses
   {$IFDEF UNIX}{$IFDEF UseCThreads}
   cthreads,
   {$ENDIF}{$ENDIF}
   Classes, dynhasharray,strings;

var
   A:TDynHashArray;
   s:pchar;
begin
  A := TDynHashArray.Create;
  s := StrNew ('u');
  A.Add(s);
  if A.Contains(s) then
    writeln('1:it contains s.');
    writeln('1:count:',A.Count);
  A.Clear;

  if A.Contains(s) then
    writeln('2:it contains s.');
    writeln('2:count:',A.Count);
  ReadLn;
  StrDispose(s);</code>
        </descr>
        <errors/>
        <seealso/>
      </element>
      <!-- argument Visibility: default -->
      <element name="TDynHashArray.Add.Item">
        <short/>
      </element>
      <!-- function Visibility: public -->
      <element name="TDynHashArray.Contains">
        <short>Returns true if the item is in the set.</short>
        <descr>
          <p>An example:</p>
<code>uses
   {$IFDEF UNIX}{$IFDEF UseCThreads}
   cthreads,
   {$ENDIF}{$ENDIF}
   Classes, dynhasharray,strings;

var
   A: TDynHashArray;
   s: pchar;
begin
  A := TDynHashArray.Create;
  s := StrNew ('u');
  A.Add(s);
  if A.Contains(s) then
    writeln('1:it contains s.');
    writeln('1:count:',A.Count);
  A.Clear;

  if A.Contains(s) then
    writeln('2:it contains s.');
    writeln('2:count:',A.Count);
  ReadLn;
  StrDispose(s);</code>
</descr>
        <errors/>
        <seealso/>
      </element>
      <!-- function result Visibility: default -->
      <element name="TDynHashArray.Contains.Result">
        <short/>
      </element>
      <!-- argument Visibility: default -->
      <element name="TDynHashArray.Contains.Item">
        <short/>
      </element>
      <!-- function Visibility: public -->
      <element name="TDynHashArray.ContainsKey">
        <short>Returns true if the item is in the set.(through OnGetKeyForHashItem).</short>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- function result Visibility: default -->
      <element name="TDynHashArray.ContainsKey.Result">
        <short/>
      </element>
      <!-- argument Visibility: default -->
      <element name="TDynHashArray.ContainsKey.Key">
        <short/>
      </element>
      <!-- procedure Visibility: public -->
      <element name="TDynHashArray.Remove">
        <short>Removes an element from the set/hash array.</short>
        <descr>
          <p>An example:</p>
<code>{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
 cthreads,
  {$ENDIF}{$ENDIF}
  Classes, dynhasharray,strings;

var
  A:TDynHashArray;
  s:pchar;
  s2:pchar;
begin
A:=TDynHashArray.Create;
s:=StrNew ('u');
s2:=StrNew ('i');
A.Add(s);
A.Add(s2);
if A.Contains(s2) then
  writeln('1:it contains s2.');
  writeln('1:count:',A.Count);
A.Remove(s2);
if A.Contains(s2) then
  writeln('2:it contains s2.');
  writeln('2:count:',A.Count);
ReadLn;
StrDispose(s);StrDispose(s2);
end.
</code>
        </descr>
        <errors/>
        <seealso/>
      </element>
      <!-- argument Visibility: default -->
      <element name="TDynHashArray.Remove.Item">
        <short/>
      </element>
      <!-- procedure Visibility: public -->
      <element name="TDynHashArray.Clear">
        <short>Removes all elements from the set/hash array.</short>
        <descr>
          <p>An example:</p>
<code>uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
 cthreads,
  {$ENDIF}{$ENDIF}
  Classes, dynhasharray,strings;

var
  A:TDynHashArray;
  s:pchar;
begin
A:=TDynHashArray.Create;
s:=StrNew ('u');
A.Add(s);
if A.Contains(s) then
  writeln('1:it contains s.');
  writeln('1:count:',A.Count);
A.Clear;

if A.Contains(s) then
  writeln('2:it contains s.');
  writeln('2:count:',A.Count);
ReadLn;
StrDispose(s);   </code>
        </descr>
        <errors/>
        <seealso/>
      </element>
      <!-- procedure Visibility: public -->
      <element name="TDynHashArray.ClearCache">
        <short>Clears the FContainsCache cache.</short>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- function Visibility: public -->
      <element name="TDynHashArray.First">
        <short>Returns the first item or nil.</short>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- function result Visibility: default -->
      <element name="TDynHashArray.First.Result">
        <short/>
      </element>
      <!-- property Visibility: public -->
      <element name="TDynHashArray.Count">
        <short>Number of elements stored in the set/array.</short>
        <descr><p>An example:</p><code>uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
 cthreads,
  {$ENDIF}{$ENDIF}
  Classes, dynhasharray,strings;

var
  A:TDynHashArray;
  s:pchar;
begin
A:=TDynHashArray.Create;
s:=StrNew ('u');
A.Add(s);
if A.Contains(s) then
  writeln('1:it contains s.');
  writeln('1:count:',A.Count);
A.Clear;

if A.Contains(s) then
  writeln('2:it contains s.');
  writeln('2:count:',A.Count);
ReadLn;
StrDispose(s);   </code>
        </descr>
        <seealso/>
      </element>
      <!-- function Visibility: public -->
      <element name="TDynHashArray.IndexOf">
        <short>Returns calculated index from Item through OnGetKeyForHashItem.</short>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- function result Visibility: default -->
      <element name="TDynHashArray.IndexOf.Result"/>
      <!-- argument Visibility: default -->
      <element name="TDynHashArray.IndexOf.AnItem">
        <short/>
      </element>
      <!-- function Visibility: public -->
      <element name="TDynHashArray.IndexOfKey">
        <short>Returns calculated index from Item.</short>
        <descr>It uses user-defined hash functions or built-in algorithm</descr>
        <errors/>
        <seealso/>
      </element>
      <!-- function result Visibility: default -->
      <element name="TDynHashArray.IndexOfKey.Result">
        <short/>
      </element>
      <!-- argument Visibility: default -->
      <element name="TDynHashArray.IndexOfKey.Key">
        <short/>
      </element>
      <!-- function Visibility: public -->
      <element name="TDynHashArray.FindHashItem">
        <short>Finds an item as PDynHashArrayItem among all items.</short>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- function result Visibility: default -->
      <element name="TDynHashArray.FindHashItem.Result">
        <short/>
      </element>
      <!-- argument Visibility: default -->
      <element name="TDynHashArray.FindHashItem.Item">
        <short/>
      </element>
      <!-- function Visibility: public -->
      <element name="TDynHashArray.FindHashItemWithKey">
        <short>Finds an item as PDynHashArrayItem among all items (through OnGetKeyForHashItem).</short>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- function result Visibility: default -->
      <element name="TDynHashArray.FindHashItemWithKey.Result">
        <short/>
      </element>
      <!-- argument Visibility: default -->
      <element name="TDynHashArray.FindHashItemWithKey.Key">
        <short/>
      </element>
      <!-- function Visibility: public -->
      <element name="TDynHashArray.FindItemWithKey">
        <short>Finds an item among all items (through OnGetKeyForHashItem).</short>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- function result Visibility: default -->
      <element name="TDynHashArray.FindItemWithKey.Result">
        <short/>
      </element>
      <!-- argument Visibility: default -->
      <element name="TDynHashArray.FindItemWithKey.Key">
        <short/>
      </element>
      <!-- function Visibility: public -->
      <element name="TDynHashArray.GetHashItem">
        <short>Gets a link list from the "main" array FItems by index.</short>
        <descr>So it returns a link list which can be processed.</descr>
        <errors/>
        <seealso/>
      </element>
      <!-- function result Visibility: default -->
      <element name="TDynHashArray.GetHashItem.Result">
        <short/>
      </element>
      <!-- argument Visibility: default -->
      <element name="TDynHashArray.GetHashItem.HashIndex">
        <short/>
      </element>
      <!-- procedure Visibility: public -->
      <element name="TDynHashArray.Delete">
        <short>Deletes a PDynHashArrayItem from link list.</short>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- argument Visibility: default -->
      <element name="TDynHashArray.Delete.ADynHashArrayItem">
        <short/>
      </element>
      <!-- procedure Visibility: public -->
      <element name="TDynHashArray.AssignTo">
        <short>Copies all items into a given TList.</short>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- argument Visibility: default -->
      <element name="TDynHashArray.AssignTo.List">
        <short/>
      </element>

      <element name="TDynHashArray.ForEach">
        <short>Calls the specified function for each of the items in the hash array.</short>
        <descr/>
        <seealso/>
      </element>
      <element name="TDynHashArray.ForEach.Func">
        <short>Boolean function type called for the hash items.</short>
      </element>

      <!-- function Visibility: public -->
      <element name="TDynHashArray.SlowAlternativeHashMethod">
        <short>Another hash function that can be used.</short>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- function result Visibility: default -->
      <element name="TDynHashArray.SlowAlternativeHashMethod.Result">
        <short/>
      </element>
      <!-- argument Visibility: default -->
      <element name="TDynHashArray.SlowAlternativeHashMethod.Sender">
        <short/>
      </element>
      <!-- argument Visibility: default -->
      <element name="TDynHashArray.SlowAlternativeHashMethod.Item">
        <short/>
      </element>
      <!-- function Visibility: public -->
      <element name="TDynHashArray.ConsistencyCheck">
        <short>Check if data in TDynHashArray are OK.</short>
        <descr>Returns a number indicating the nature of inconsistency. 0
         means OK.
</descr>
        <errors/>
        <seealso/>
      </element>
      <!-- function result Visibility: default -->
      <element name="TDynHashArray.ConsistencyCheck.Result">
        <short/>
      </element>
      <!-- procedure Visibility: public -->
      <element name="TDynHashArray.WriteDebugReport">
        <short>Prints out essential data to aid debugging TDynHashArray.</short>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- property Visibility: public -->
      <element name="TDynHashArray.FirstHashItem">
        <short>
          Pointer which provides access to the first TDynHashArrayItem stored in the hash array.
        </short>
        <descr/>
        <seealso/>
      </element>
      <!-- property Visibility: public -->
      <element name="TDynHashArray.MinCapacity">
        <short>The minimum number of items that will be allocated for an array.</short>
        <descr>
          <p>
            The size of the array can be changed at any time. However, even if a size is given for Capacity that is smaller than this minimum number, then this minimum number of items will be allocated. This is done for efficiency and speed.
          </p>
        </descr>
        <seealso/>
      </element>
      <!-- property Visibility: public -->
      <element name="TDynHashArray.MaxCapacity">
        <short>The size of the array cannot be larger than this number.</short>
        <descr>FCapacity is overridden by this number, if that is larger than this.</descr>
        <seealso/>
      </element>
      <!-- property Visibility: public -->
      <element name="TDynHashArray.Capacity">
        <short>Space is allocated for this number of items.</short>
        <descr/>
        <seealso/>
      </element>
      <!-- property Visibility: public -->
      <element name="TDynHashArray.CustomHashFunction">
        <short>The pointer to the user-defined hash function.</short>
        <descr/>
        <seealso/>
      </element>
      <!-- property Visibility: public -->
      <element name="TDynHashArray.OwnerHashFunction">
        <short>The pointer to the user-defined hash function.</short>
        <descr/>
        <seealso/>
      </element>
      <!-- property Visibility: public -->
      <element name="TDynHashArray.OnGetKeyForHashItem">
        <short>User-defined function to obtain a key from an item.</short>
        <descr>
          <p>
            If this function is specified,then it is possible to use this class as an associative array. Otherwise, it implements a set.
          </p>
       </descr>
        <seealso/>
      </element>
      <!-- property Visibility: public -->
      <element name="TDynHashArray.Options">
        <short>Set of TDynHashArrayOption values enabled for the class instance.</short>
        <descr/>
        <seealso/>
      </element>
      <!-- object Visibility: default -->
      <element name="TDynHashArrayItemMemManager">
        <short>Custom memory manager for TDynHashArrayItem instances.</short>
        <descr/>
        <seealso/>
      </element>
      <!-- variable Visibility: private -->
      <element name="TDynHashArrayItemMemManager.FFirstFree">
        <short/>
        <descr/>
        <seealso/>
      </element>
      <!-- variable Visibility: private -->
      <element name="TDynHashArrayItemMemManager.FFreeCount">
        <short/>
        <descr/>
        <seealso/>
      </element>
      <!-- variable Visibility: private -->
      <element name="TDynHashArrayItemMemManager.FCount">
        <short/>
        <descr/>
        <seealso/>
      </element>
      <!-- variable Visibility: private -->
      <element name="TDynHashArrayItemMemManager.FMinFree">
        <short/>
        <descr/>
        <seealso/>
      </element>
      <!-- variable Visibility: private -->
      <element name="TDynHashArrayItemMemManager.FMaxFreeRatio">
        <short/>
        <descr/>
        <seealso/>
      </element>
      <!-- procedure Visibility: private -->
      <element name="TDynHashArrayItemMemManager.SetMaxFreeRatio">
        <short/>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- argument Visibility: default -->
      <element name="TDynHashArrayItemMemManager.SetMaxFreeRatio.NewValue">
        <short/>
      </element>
      <!-- procedure Visibility: private -->
      <element name="TDynHashArrayItemMemManager.SetMinFree">
        <short/>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- argument Visibility: default -->
      <element name="TDynHashArrayItemMemManager.SetMinFree.NewValue">
        <short/>
      </element>
      <!-- procedure Visibility: private -->
      <element name="TDynHashArrayItemMemManager.DisposeFirstFreeItem">
        <short/>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- procedure Visibility: public -->
      <element name="TDynHashArrayItemMemManager.DisposeItem">
        <short>
          Removes references to the specified hash item and adds it to the free list.
        </short>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- argument Visibility: default -->
      <element name="TDynHashArrayItemMemManager.DisposeItem.ADynHashArrayItem">
        <short/>
      </element>
      <!-- function Visibility: public -->
      <element name="TDynHashArrayItemMemManager.NewItem">
        <short>Allocates and initializes a new hash item for the memory manager.</short>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- function result Visibility: default -->
      <element name="TDynHashArrayItemMemManager.NewItem.Result">
        <short/>
      </element>
      <!-- property Visibility: public -->
      <element name="TDynHashArrayItemMemManager.MinimumFreeCount">
        <short>Minimum size for the internal free list storage.</short>
        <descr>
          <p>
            Ensures that MinimumFreeCount cannot be set to a negative value.
          </p>
        </descr>
        <seealso/>
      </element>
      <!-- property Visibility: public -->
      <element name="TDynHashArrayItemMemManager.MaximumFreeRatio">
        <short>Threshold at which items in the free list are released.</short>
        <descr/>
        <seealso/>
      </element>
      <!-- property Visibility: public -->
      <element name="TDynHashArrayItemMemManager.Count">
        <short>Number of hash items allocated by the memory manager.</short>
        <descr/>
        <seealso/>
      </element>
      <!-- procedure Visibility: public -->
      <element name="TDynHashArrayItemMemManager.Clear">
        <short>Disposes of hash items in the free list.</short>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- constructor Visibility: public -->
      <element name="TDynHashArrayItemMemManager.Create">
        <short>Constructor for the class instance.</short>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- destructor Visibility: public -->
      <element name="TDynHashArrayItemMemManager.Destroy">
        <short>Destructor for the class instance.</short>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- function Visibility: public -->
      <element name="TDynHashArrayItemMemManager.ConsistencyCheck">
        <short>
          Ensures that Count mataches the actual number of entries in the free list.
        </short>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- function result Visibility: default -->
      <element name="TDynHashArrayItemMemManager.ConsistencyCheck.Result">
        <short/>
      </element>
      <!-- procedure Visibility: public -->
      <element name="TDynHashArrayItemMemManager.WriteDebugReport">
        <short>Prints out essential data to aid debugging DynHashArrayItemMemManager.</short>
        <descr/>
        <errors/>
        <seealso/>
      </element>
      <!-- object Visibility: default -->
      <element name="EDynHashArrayException">
        <short>Raised if index is invalid in IndexOfKey.</short>
        <descr>The index can be invalid if user-defined/custom function are faulty.</descr>
        <errors/>
        <seealso/>
      </element>
      <!-- constant Visibility: default -->
      <element name="ItemMemManager">
        <short>A small memory manager.</short>
        <descr/>
        <seealso/>
      </element>
    </module>
    <!-- DynHashArray -->
  </package>
</fpdoc-descriptions>