[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [FR-devel] RE: Databus hash problem **URGENT**
From: |
Rich Kilmer |
Subject: |
RE: [FR-devel] RE: Databus hash problem **URGENT** |
Date: |
Fri, 9 Aug 2002 09:11:10 -0400 |
Done...passes unit tests!
Changes all 'hash' behavior to 'map':
#slot.put(key, value)
#slot.get(key) #=> value
#slot.remove(key)
#slot.clear #=> removes all items from map, queue, stack
The methods above remain the same...these change:
#slot.is_map_slot? #slot.map #=> turn slot into map slot and return Map
Extra method on Map
myHash = {1=>"me", 2=>"you}
slot.map.map=myHash
So you can set up a map quickly
-Rich
> -----Original Message-----
> From: address@hidden [mailto:freeride-
> address@hidden On Behalf Of Rich Kilmer
> Sent: Friday, August 09, 2002 8:55 AM
> To: 'Laurent Julliard'
> Cc: 'FreeRIDE'
> Subject: [FR-devel] RE: Databus hash problem **URGENT**
>
> Ok...figured it out. I implemented the new capability in Databus of a
> hash slot. To get the hash(wrapper) from the slot (or force the slot
> into hash mode) you call slot.hash. Unfortunately, the hash method is
> used by a Hash to compute the hashcode of an object ;-)
>
> I will have to change all this stuff over to something other than
> hash...I think I will use 'map'.
>
> Working on changes now...sorry for the inconvenience.
>
> -rich
>
> > -----Original Message-----
> > From: Laurent Julliard [mailto:address@hidden
> > Sent: Friday, August 09, 2002 8:38 AM
> > To: Rich Kilmer
> > Cc: Fox GUI Users
> > Subject: Databus hash problem **URGENT**
> >
> > Rich,
> >
> > I was about to commit a bunch of new changes to the FR CVS repo and
> > before that I have updated my working copy with your changes in the
> > databus.
> >
> > When testing my own code with the new databus version an error
appears
> > in my code that was not there before. Find below a small piece of
code
> > that reproduces the problem. I must say I'm not clear at all about
> what
> > causes this problem and I would very much like that you assist me. I
> > need this to be fix before I can commit my changes
> >
> > Here si the piece of code:
> >
> > ----- begin code -----
> > require 'freebase/freebase'
> > include FreeBASE
> >
> > bus = DataBus.new
> > slot = bus['/my/path']
> >
> > myhash = Hash.new
> >
> > # make the slot a queue
> > slot.queue
> >
> > myhash[slot] = 'something'
> >
> > exit
> > ----- end code -----
> >
> > Runtime error is the following:
> >
> > ./freebase/databus.rb:433:in `check_type': Slot /my/path/ cannot be
> set
> > as a hash_slot because its already a queue_slot (RuntimeError)
> > from ./freebase/databus.rb:410:in `hash'
> > from ../sketch/hashbug.rb:12:in `[]='
> > from ../sketch/hashbug.rb:12
> >
> > Note: if you don't make the slot a queue and comment this line,
you'll
> > have another interesting error.
> >
> > Am I missing something here ?
> >
> > Laurent
> > --
> > Laurent JULLIARD - Xerox R&T/SSTC/XPA - Open Source team
> > >> Host your Xerox Software project on CodeX:
http://codex.xerox.com
> > >> address@hidden community: http://xww.linux.world.xerox.com
> >
>
>
>
> _______________________________________________
> Freeride-devel mailing list
> address@hidden
> http://mail.freesoftware.fsf.org/mailman/listinfo/freeride-devel