use of org.eclipse.titanium.metrics.visitors.CounterVisitor in project titan.EclipsePlug-ins by eclipse.
the class FMLinesOfCode method measure.
@Override
public Number measure(final MetricData data, final Def_Function function) {
final Counter count = new Counter(0);
function.accept(new CounterVisitor(count) {
@Override
public int visit(final IVisitableNode node) {
if (node instanceof Def_Function) {
return V_CONTINUE;
} else if (node instanceof StatementBlock) {
count.set(((LargeLocation) ((StatementBlock) node).getLocation()).getEndLine());
}
return V_SKIP;
}
});
return count.val() - function.getLocation().getLine() + 1;
}
use of org.eclipse.titanium.metrics.visitors.CounterVisitor in project titan.EclipsePlug-ins by eclipse.
the class FMDefaultActivations method measure.
@Override
public Number measure(final MetricData data, final Def_Function function) {
final Counter count = new Counter(0);
function.accept(new CounterVisitor(count) {
@Override
public int visit(final IVisitableNode node) {
if (node instanceof Activate_Statement) {
count.inc();
} else if (node instanceof Activate_Referenced_Statement) {
count.inc();
} else if (node instanceof ActivateDereferedExpression) {
count.inc();
} else if (node instanceof ActivateExpression) {
count.inc();
}
return V_CONTINUE;
}
});
return count.val();
}
use of org.eclipse.titanium.metrics.visitors.CounterVisitor 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.CounterVisitor 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;
}
Aggregations