Re: post condition violation with KL_CASE_INSENSITIVE_STRING_EQUALITY_TESTER

Eric Bezault <[email protected]> Wed, 13 Jan 2016 09:15:02 +0100
Newsgroups gmane.comp.lang.eiffel.gobo.devel
Message-ID <[email protected]>
On 1/13/2016 03:45, Berend de Boer wrote:
> Doesn't make much sense. to me, but in case something pops in your
> head, let me know, else I may try to come up with a program that
> repeats this.
>
> This is the code that creates the structure:
>
>       local
>         fields: DS_HASH_TABLE [EPX_MIME_FIELD, STRING]
>         equality_tester: KL_CASE_INSENSITIVE_STRING_EQUALITY_TESTER
>       do
>               create fields.make (64)
>               create equality_tester
>                fields.set_key_equality_tester (equality_tester)
>         ....
>         if fields.has ("ST) then
>           ...
>         end
>       end

When you change the key equality tester in a hash table, you should
also change the hash function accordingly. Otherwise you might end
up with two keys which are considered equal but which have two
different hash code.


      l_hash_function: KL_AGENT_HASH_FUNCTION [STRING]
      ...
      create l_hash_function.make (agent STRING_.case_insensitive_hash_code)
      ...
      fields.set_hash_function (l_hash_function)

-- 
Eric Bezault
mailto:[email protected]
http://www.gobosoft.com

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140