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

Chris Pickett chris.pickett at mail.mcgill.ca
Sun Oct 3 16:12:54 EDT 2004


I'm unsure why soot.tagkit.FirstTagAggregator claims to be what it is.

 From TagAggregator:

         /* aggregate all tags */
         for( Iterator unitIt = body.getUnits().iterator();
              unitIt.hasNext(); ) {

             final Unit unit = (Unit) unitIt.next();

             for( Iterator tagIt = unit.getTags().iterator();
                  tagIt.hasNext(); ) {

                 final Tag tag = (Tag) tagIt.next();
                 if( wantTag( tag ) ) considerTag( tag, unit );
             }
         }

 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.

Chris


More information about the Soot-list mailing list