1 19 20 package soot.toolkits.astmetrics; 21 22 import java.util.ArrayList ; 23 import java.util.Iterator ; 24 import polyglot.ast.Node; 25 import soot.options.Options; 26 27 30 public class ComputeASTMetrics { 31 32 ArrayList metrics; 33 36 public ComputeASTMetrics(Node astNode){ 37 metrics = new ArrayList (); 38 41 metrics.add(new AbruptEdgesMetric(astNode)); 43 metrics.add(new NumLocalsMetric(astNode)); 44 metrics.add(new ConstructNumbersMetric(astNode)); 45 metrics.add(new StmtSumWeightedByDepth(astNode)); 46 metrics.add(new ConditionComplexityMetric(astNode)); 47 metrics.add(new ExpressionComplexityMetric(astNode)); 48 metrics.add(new IdentifiersMetric(astNode)); 49 } 50 51 public void apply(){ 52 if(!Options.v().ast_metrics()){ 53 return; 54 } 55 56 Iterator metricIt = metrics.iterator(); 57 while(metricIt.hasNext()) 58 ((MetricInterface)metricIt.next()).execute(); 59 60 } 61 } 62 | Popular Tags |