[Soot-list] confused by soot.tagkit.FirstTagAggregator

Ondrej Lhotak olhotak at sable.mcgill.ca
Mon Oct 4 09:41:12 EDT 2004


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.

Ondrej


More information about the Soot-list mailing list