class AbruptEdgesMetric extends ASTMetric {

  private int iBreaks, eBreaks;
  private int iContinues, eContinues;

  public AbruptEdgesMetric(polyglot.ast.Node astNode) {
    super(astNode);
  }

  /*
   * (non-Javadoc)
   *
   * @see soot.toolkits.astmetrics.ASTMetric#reset() Implementation of the abstract method which is invoked by parent
   * constructor and whenever the classDecl in the polyglot changes
   */
  public void reset() {
    iBreaks = eBreaks = iContinues = eContinues = 0;
  }

  /*
   * Implementation of the abstract method
   *
   * Should add the metrics to the data object sent
   */
  public void addMetrics(ClassData data) {

    data.addMetric(new MetricData("Total-breaks", new Integer(iBreaks + eBreaks)));
    data.addMetric(new MetricData("I-breaks", new Integer(iBreaks)));
    data.addMetric(new MetricData("E-breaks", new Integer(eBreaks)));

    data.addMetric(new MetricData("Total-continues", new Integer(iContinues + eContinues)));
    data.addMetric(new MetricData("I-continues", new Integer(iContinues)));
    data.addMetric(new MetricData("E-continues", new Integer(eContinues)));

    data.addMetric(new MetricData("Total-Abrupt", new Integer(iBreaks + eBreaks + iContinues + eContinues)));
  }

  /*
   * A branch in polyglot is either a break or continue
   */
  public NodeVisitor enter(Node parent, Node n) {<FILL_FUNCTION_BODY>}
}

    if (n instanceof Branch) {
      Branch branch = (Branch) n;
      if (branch.kind().equals(Branch.BREAK)) {
        if (branch.label() != null) {
          eBreaks++;
        } else {
          iBreaks++;
        }
      } else if (branch.kind().equals(Branch.CONTINUE)) {
        if (branch.label() != null) {
          eContinues++;
        } else {
          iContinues++;
        }
      } else {
        System.out.println("\t Error:'" + branch.toString() + "'");
      }
    }
    return enter(n);
  
<methods>public void <init>(polyglot.ast.Node) ,public abstract void addMetrics(soot.toolkits.astmetrics.ClassData) ,public final polyglot.visit.NodeVisitor enter(polyglot.ast.Node) ,public final void execute() ,public final soot.toolkits.astmetrics.ClassData getClassData() ,public final polyglot.ast.Node leave(polyglot.ast.Node, polyglot.ast.Node, polyglot.ast.Node, polyglot.visit.NodeVisitor) ,public void printAstMetric(polyglot.ast.Node, polyglot.util.CodeWriter) ,public abstract void reset() <variables>polyglot.ast.Node astNode,java.lang.String className