[Soot-list] confused by soot.tagkit.FirstTagAggregator
Chris Pickett
chris.pickett at mail.mcgill.ca
Mon Oct 4 12:42:51 EDT 2004
Ondrej Lhotak wrote:
> On Sun, Oct 03, 2004 at 04:12:54PM -0400, Chris Pickett wrote:
>
>> From FirstTagAggregator:
>>
>> public void considerTag(Tag t, Unit u)
>> {
>> if( units.size() > 0 && units.getLast() == u ) return;
>> units.add(u);
>> tags.add(t);
>> }
>>
>>Doesn't this just attach the first wanted tag of each unit?
>>
>>I would do something like:
>>
>> if( tags.contains(t) ) return;
>>
>>instead.
>
>
> Hmm, yes, this does look a lot like a bug. Your fix looks OK as well,
> except that it's n^2 in the number of tags, which may or may not become
> a problem.
You could use ArrayList instead of LinkedList for tags and units.
The only subclass of FirstTagAggregator is LineNumberTagAggregator, and
it looks to be positively affected by this change.
Chris
More information about the Soot-list
mailing list