Link to home
Start Free TrialLog in
Avatar of shawn857
shawn857

asked on

What is unit "Generics.Collections" ?

hello, I've found a Delphi unit for implementing the AhoCorasick string search algorithm on this site:

https://gist.github.com/madhurjain/10067345

... but it makes a call to a unit "Generics.Collections" that my Delphi 7 compiler doesn't like ("File not found : "Generics.Collections.dcu"). Is this because my Delphi 7 is too old? Is there a workaround...?

Thanks!
    Shawn
SOLUTION
Avatar of bas2754
bas2754
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of shawn857
shawn857

ASKER

Thanks Bas... yeah maybe I'll have to sooner than I figured. I did find the Generics.Collections.dcu compiled unit file while googling around. Do you think if I just added this file to my Search Path and compiled my project, it might somehow work??

Thanks
   Shawn
Avatar of Sinisa Vuk
No, it is not good to put this file - because it is compiled with another version of Delphi and needs compatible units. Workaroud is to try to make unit compatible to older Delphi. If you get stuck - ask for help here.

Add: Similar search algorithm: Boyer-Moore-Horspool
OK thank you Sinisa. I think mainly what I need from the Generics.Collections unit is the Queue and Stack capability. Do you know if there's maybe a 3rd party implementation of these data structures for D7?

Also regarding the Boyer-Moore-Horspool method - I looked at that one already and it's not suitable for me as it searches for only one pattern in the target string. I need to be able to search for multiple patterns in the target string.

Thanks!
   Shawn
Queue and Stack do exists in D7 iirc, but not a generic queue and stack.

Generics is a mechanism which the compiler needs to support, you can not build or use it if it's not in the compiler, read this for more information.
there is a queue and stack type in the contnrs unit.
what is the difference between the "generic" queue and stack, and the queue and stack found in D7's contnrs unit?

Thanks
   Shawn
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial