use of org.eclipse.titanium.metrics.visitors.Counter in project titan.EclipsePlug-ins by eclipse.
the class TMLinesOfCode method measure.
@Override
public Number measure(final MetricData data, final Def_Testcase testcase) {
final Counter count = new Counter(0);
testcase.accept(new CounterVisitor(count) {
@Override
public int visit(final IVisitableNode node) {
if (node instanceof Def_Testcase) {
return V_CONTINUE;
}
if (node instanceof StatementBlock) {
count.set(((LargeLocation) ((StatementBlock) node).getLocation()).getEndLine());
}
return V_SKIP;
}
});
return count.val() - testcase.getLocation().getLine() + 1;
}
use of org.eclipse.titanium.metrics.visitors.Counter in project titan.EclipsePlug-ins by eclipse.
the class TMOutEnvy method measure.
@Override
public Number measure(final MetricData data, final Def_Testcase testcase) {
final Counter count = new Counter(0);
final Module myModule = testcase.getMyScope().getModuleScope();
testcase.accept(new ExternalFeatureEnvyDetector(myModule, count));
return count.val();
}
use of org.eclipse.titanium.metrics.visitors.Counter in project titan.EclipsePlug-ins by eclipse.
the class AMLinesOfCode method measure.
@Override
public Number measure(final MetricData data, final Def_Altstep altstep) {
final Counter count = new Counter(0);
altstep.accept(new CounterVisitor(count) {
@Override
public int visit(final IVisitableNode node) {
if (node instanceof Def_Altstep) {
return V_CONTINUE;
}
if (node instanceof StatementBlock) {
count.set(((LargeLocation) ((StatementBlock) node).getLocation()).getEndLine());
}
return V_SKIP;
}
});
return count.val() - altstep.getLocation().getLine() + 1;
}
use of org.eclipse.titanium.metrics.visitors.Counter in project titan.EclipsePlug-ins by eclipse.
the class MMNofStatements method measure.
@Override
public Number measure(final MetricData data, final Module module) {
final Counter statements = new Counter(0);
final StatementCounterVisitor visitor = new StatementCounterVisitor(statements);
module.accept(visitor);
return statements.val();
}
use of org.eclipse.titanium.metrics.visitors.Counter in project titan.EclipsePlug-ins by eclipse.
the class MMOutEnvy method measure.
@Override
public Number measure(final MetricData data, final Module module) {
final Counter externalReferences = new Counter(0);
final ExternalFeatureEnvyDetector detector = new ExternalFeatureEnvyDetector(module, externalReferences);
module.accept(detector);
return externalReferences.val();
}
Aggregations