class TagAggregator extends BodyTransformer {

  /** Decide whether this tag should be aggregated by this aggregator. */
  public abstract boolean wantTag(Tag t);

  /** Aggregate the given tag assigned to the given unit */
  public abstract void considerTag(Tag t, Unit u, LinkedList<Tag> tags, LinkedList<Unit> units);

  /** Return name of the resulting aggregated tag. */
  public abstract String aggregatedName();

  @Override
  protected void internalTransform(Body b, String phaseName, Map<String, String> options) {<FILL_FUNCTION_BODY>}

  /** Called after all tags for a method have been aggregated. */
  public void fini() {
  }
}

    BafBody body = (BafBody) b;

    LinkedList<Tag> tags = new LinkedList<Tag>();
    LinkedList<Unit> units = new LinkedList<Unit>();

    /* aggregate all tags */
    for (Unit unit : body.getUnits()) {
      for (Tag tag : unit.getTags()) {
        if (wantTag(tag)) {
          considerTag(tag, unit, tags, units);
        }
      }
    }

    if (units.size() > 0) {
      b.addTag(new CodeAttribute(aggregatedName(), new LinkedList<Unit>(units), new LinkedList<Tag>(tags)));
    }
    fini();
  
<methods>public non-sealed void <init>() ,public final void transform(soot.Body, java.lang.String, Map<java.lang.String,java.lang.String>) ,public final void transform(soot.Body, java.lang.String) ,public final void transform(soot.Body) <variables>private static final Map<java.lang.String,java.lang.String> enabledOnlyMap