Solved

What is unit "Generics.Collections" ?

Posted on 2014-10-08
8
1,037 Views
Last Modified: 2014-10-16
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
0
Comment
Question by:shawn857
8 Comments
 
LVL 9

Assisted Solution

by:bas2754
bas2754 earned 250 total points
ID: 40369540
It does not appear to be available in Delphi 7.  About halfway down this page (http://edn.embarcadero.com/article/39136) it discusses this is implemented in Delphi 2009.

Look for Section 7: Generics

Looks like an upgrade may be in your future.
0
 

Author Comment

by:shawn857
ID: 40369657
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
0
 
LVL 25

Expert Comment

by:Sinisa Vuk
ID: 40370056
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
0
 

Author Comment

by:shawn857
ID: 40370075
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
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 19

Expert Comment

by:MerijnB
ID: 40370190
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.
0
 
LVL 36

Expert Comment

by:Geert Gruwez
ID: 40372736
there is a queue and stack type in the contnrs unit.
0
 

Author Comment

by:shawn857
ID: 40374015
what is the difference between the "generic" queue and stack, and the queue and stack found in D7's contnrs unit?

Thanks
   Shawn
0
 
LVL 19

Accepted Solution

by:
MerijnB earned 250 total points
ID: 40376539
what is the difference between the "generic" queue and stack, and the queue and stack found in D7's contnrs unit?

To put it simply, the queue and stack from D7 works with TObject or pointer, while with generic's you can make a queue and stack for a specific type of object, so you don't need to typecast (and can't make mistakes, etc).
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now