Solved

What is unit "Generics.Collections" ?

Posted on 2014-10-08
8
1,465 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 27

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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 
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 38

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month11 days, 5 hours left to enroll

628 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