Collection remove issue
Posted: Fri Aug 07, 2009 12:34 pm
by Jade Starter >> Mon, 5 Apr 2004 22:15:31 GMT
Hi,
I am running into a problem deleting certain references from a collection class. My collection class is called Games and it contains classes of type Game. In the collection class I created a method "deleteSome" which will remove some of the entries from the collection.
Here is the code I am using:
vars
game : Game;begin
foreach game in self do
if condition = true then
self.remove(game);
end if;
endforeach;
end;
When I ran it I got an error msg saying "entry not found in collection". This does not make any sense to me as I am traversing the collection and all entries have to exist. So I decided to take out the condition and try to remove all game instances from the collection. This gave me the same error.
I then tried to play around with the collection and unchecked "duplicates allowed". It required me to do a reorg. I ran it again and it worked. After further testing I noticed that doing a reorg fixes the problem.
Furtherone, I noticed that self.indexOf(loc) returns the correct number, but when I call self.includes(loc) it says false. So for some reasons it finds the entry sometimes, but not all the times.
Does anybody know why I am getting this error? Is there a way in my code to force a reorg before I execute the remove command?
Thanks for all your help in advance!
By the way, I am using Jade 6.0.16.
Hi,
I am running into a problem deleting certain references from a collection class. My collection class is called Games and it contains classes of type Game. In the collection class I created a method "deleteSome" which will remove some of the entries from the collection.
Here is the code I am using:
vars
game : Game;begin
foreach game in self do
if condition = true then
self.remove(game);
end if;
endforeach;
end;
When I ran it I got an error msg saying "entry not found in collection". This does not make any sense to me as I am traversing the collection and all entries have to exist. So I decided to take out the condition and try to remove all game instances from the collection. This gave me the same error.
I then tried to play around with the collection and unchecked "duplicates allowed". It required me to do a reorg. I ran it again and it worked. After further testing I noticed that doing a reorg fixes the problem.
Furtherone, I noticed that self.indexOf(loc) returns the correct number, but when I call self.includes(loc) it says false. So for some reasons it finds the entry sometimes, but not all the times.
Does anybody know why I am getting this error? Is there a way in my code to force a reorg before I execute the remove command?
Thanks for all your help in advance!
By the way, I am using Jade 6.0.16.