each statistic calculation can only be done once

Discussion of development versions only
Post Reply
User avatar
pbittner
Gephi Plugin Developer
Posts: 35
Joined: 18 Mar 2010 23:03
Location: London, UK

each statistic calculation can only be done once

Post by pbittner » 27 Apr 2010 19:28

The first time a statistic is calculated, the values of the parameters used (epsilon, directed/undirected...) are correctly interpreted and the report shown. But if I try to run a statistic calculation again with other values for the parameters, the report shown is always the first one that was created.

By looking at the source code of the module, it seems that the statistic is run correctly each time but the Statistics object used to generate the report (inside the method showReport of the class StatisticsFrontEnd) is always the one that was created the first time the statistic was run. The method doesn't use the last Statistics object created.

Is it a bug ? If so, do you mind if I have a look into it ?

User avatar
mbastian
Gephi Architect
Posts: 728
Joined: 10 Dec 2009 10:11
Location: San Francisco, CA

Re: each statistic calculation can only be done once

Post by mbastian » 27 Apr 2010 22:36

Hi, thanks for finding this issue. It's indeed a bug. Could you please report it on our bug tracker?

For sure you can have a look and propose a patch, that would be nice. As you suggested it the StatisticsModel is not correctly maintaining the list of Statistics instances.

User avatar
pbittner
Gephi Plugin Developer
Posts: 35
Joined: 18 Mar 2010 23:03
Location: London, UK

Re: each statistic calculation can only be done once

Post by pbittner » 27 Apr 2010 23:09

I just reported the bug and will try to find a fix.

User avatar
pbittner
Gephi Plugin Developer
Posts: 35
Joined: 18 Mar 2010 23:03
Location: London, UK

Re: each statistic calculation can only be done once

Post by pbittner » 28 Apr 2010 21:11

I found a way to fix the bug by making sure that only one instance of Statistic can be created for each StatisticUI. It is reused if the statistic is run more than once. It compiles and each statistic can now be run more than once.

I created a branch on Launchpad and updated the fix on it. Is it the correct thing to do ? Also I was not sure whether I had to include the description of the changes in the 2 files modified. I just made corrections and added small comments.

User avatar
mbastian
Gephi Architect
Posts: 728
Joined: 10 Dec 2009 10:11
Location: San Francisco, CA

Re: each statistic calculation can only be done once

Post by mbastian » 29 Apr 2010 00:30

Excellent job, I'lm looking at the patch right now. I'll merge it tomorrow, seems fixing the problem.

Creating a branch is indeed the best way to do this. For me it's really easy I just do a merge with your branch to integrate the fixes.

Just a tip: Format your code using Netbeans (Right-Click > Format on source code). We all do this, it avoids commit format change later on.

User avatar
mbastian
Gephi Architect
Posts: 728
Joined: 10 Dec 2009 10:11
Location: San Francisco, CA

Re: each statistic calculation can only be done once

Post by mbastian » 29 Apr 2010 23:01

I merged your patch, thanks for your contribution :)

Post Reply