From: Wolfgang J. <wj...@so...> - 2007-09-12 09:24:32
|
Eric Bezault wrote: > Wolfgang Jansen wrote: >> some time ago I already asked a related question and you >> gave an answer. But I may have misunderstood something. >> The problem is as follows. I have a class like >> >> class C >> inherit >> DS_EQUALITY_TESTER [KEY_TYPE] >> redefine test >> end >> >> feature >> >> table: DS_HASH_TABLE [ITEM_TYPE,KEY_TYPE] >> >> make is >> do >> create table.make_with_equality_testers(1000, Void, Current) >> end >> >> build(k: KEY_TYPE): ITEM_TYPE is >> do >> if table.has(k) then >> Result := table.item(k) >> else >> create Result.make(k) >> table.force(Result,k) >> end >> end >> >> test(u,v: STRING) is >> do >> -- I would like to do this more intelligent, >> -- but this is a different problem >> Result := u = v >> end >> >> -- other features >> >> end >> >> This works very well for some time (hundreds of calls) >> but then routine `search_position' enters an infinite loop: >> Lines 590,591 of DS_SPARSE_CONTAINER are >> prev := i >> i := clashes_item(i) >> and have the effect that `prev=1', `i=1', i.e. no further >> progress happens. A particular observation: >> `table' has currently 1028 elements. >> >> So, what has gone wrong and how can I fix the bug? > > Is the value of the hash_code of your keys changing while > these keys are used in the hash table? > I don't know, the key type is ET_FEATURE. So, you may answer this best yourself. -- Wolfgang Jansen University of Potsdam, Germany mailto: wj...@so... |