List of usage examples for org.aspectj.apache.bcel.generic MethodGen getArgumentNames
public String[] getArgumentNames()
From source file:br.jabuti.metrics.klass.MetricANPM.java
License:Open Source License
@Override public double getResult(Program prog, String className) { RClass rc = prog.get(className);/* w w w . j av a2s. c om*/ if (!(rc instanceof RClassCode)) { return -1.0; } int countMethods = 0; int countParameters = 0; RClassCode rcc = (RClassCode) rc; JavaClass theClazz = rcc.getTheClass(); ConstantPoolGen cp = new ConstantPoolGen(theClazz.getConstantPool()); Method[] methods = theClazz.getMethods(); for (Method method : methods) { if (method.isAbstract()) { continue; } MethodGen mg = new MethodGen(method, theClazz.getClassName(), cp); countMethods++; countParameters += mg.getArgumentNames().length; } if (countMethods == 0) { return -1.0; } return (double) countParameters / countMethods; }
From source file:br.jabuti.metrics.klass.MetricMNPM.java
License:Open Source License
@Override public double getResult(Program prog, String className) { RClass rc = prog.get(className);/* ww w . j a v a 2 s. co m*/ if (!(rc instanceof RClassCode)) { return -1.0; } int max = 0; RClassCode rcc = (RClassCode) rc; JavaClass theClazz = rcc.getTheClass(); ConstantPoolGen cp = new ConstantPoolGen(theClazz.getConstantPool()); Method[] methods = theClazz.getMethods(); for (int i = 0; i < methods.length; i++) { if (methods[i].isAbstract()) { continue; } MethodGen mg = new MethodGen(methods[i], theClazz.getClassName(), cp); String dummy[] = mg.getArgumentNames(); max = dummy.length > max ? dummy.length : max; } return (double) max; }