Search in sources :

Example 1 with Counter

use of org.eclipse.titanium.metrics.visitors.Counter 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;
}
Also used : Counter(org.eclipse.titanium.metrics.visitors.Counter) CounterVisitor(org.eclipse.titanium.metrics.visitors.CounterVisitor) Def_Function(org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Function) StatementBlock(org.eclipse.titan.designer.AST.TTCN3.statements.StatementBlock) IVisitableNode(org.eclipse.titan.designer.AST.IVisitableNode)

Example 2 with Counter

use of org.eclipse.titanium.metrics.visitors.Counter in project titan.EclipsePlug-ins by eclipse.

the class FMNesting method measure.

@Override
public Number measure(final MetricData data, final Def_Function function) {
    final Counter count = new Counter(0);
    function.accept(new DepthVisitor(count));
    return count.val();
}
Also used : Counter(org.eclipse.titanium.metrics.visitors.Counter) DepthVisitor(org.eclipse.titanium.metrics.visitors.DepthVisitor)

Example 3 with Counter

use of org.eclipse.titanium.metrics.visitors.Counter in project titan.EclipsePlug-ins by eclipse.

the class FMReturnPoints method measure.

@Override
public Number measure(final MetricData data, final Def_Function function) {
    final Counter count = new Counter(0);
    function.accept(new ReturnPointVisitor(count));
    return count.val();
}
Also used : Counter(org.eclipse.titanium.metrics.visitors.Counter) ReturnPointVisitor(org.eclipse.titanium.metrics.visitors.ReturnPointVisitor)

Example 4 with Counter

use of org.eclipse.titanium.metrics.visitors.Counter in project titan.EclipsePlug-ins by eclipse.

the class MMInEnvy method measure.

@Override
public Number measure(final MetricData data, final Module module) {
    final Counter innerReferences = new Counter(0);
    final InternalFeatureEnvyDetector detector = new InternalFeatureEnvyDetector(module, innerReferences);
    module.accept(detector);
    return innerReferences.val();
}
Also used : Counter(org.eclipse.titanium.metrics.visitors.Counter) InternalFeatureEnvyDetector(org.eclipse.titanium.metrics.visitors.InternalFeatureEnvyDetector)

Example 5 with Counter

use of org.eclipse.titanium.metrics.visitors.Counter in project titan.EclipsePlug-ins by eclipse.

the class AMCyclomaticComplexity method measure.

@Override
public Number measure(final MetricData data, final Def_Altstep altstep) {
    final Counter count = new Counter(0);
    altstep.accept(new CCVisitor(count));
    return count.val();
}
Also used : Counter(org.eclipse.titanium.metrics.visitors.Counter) CCVisitor(org.eclipse.titanium.metrics.visitors.CCVisitor)

Aggregations

Counter (org.eclipse.titanium.metrics.visitors.Counter)20 Module (org.eclipse.titan.designer.AST.Module)6 IVisitableNode (org.eclipse.titan.designer.AST.IVisitableNode)4 CounterVisitor (org.eclipse.titanium.metrics.visitors.CounterVisitor)4 ExternalFeatureEnvyDetector (org.eclipse.titanium.metrics.visitors.ExternalFeatureEnvyDetector)4 InternalFeatureEnvyDetector (org.eclipse.titanium.metrics.visitors.InternalFeatureEnvyDetector)4 StatementBlock (org.eclipse.titan.designer.AST.TTCN3.statements.StatementBlock)3 CCVisitor (org.eclipse.titanium.metrics.visitors.CCVisitor)3 DepthVisitor (org.eclipse.titanium.metrics.visitors.DepthVisitor)3 LargeLocation (org.eclipse.titan.designer.AST.LargeLocation)2 Def_Altstep (org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Altstep)1 Def_Function (org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Function)1 Def_Testcase (org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Testcase)1 Activate_Referenced_Statement (org.eclipse.titan.designer.AST.TTCN3.statements.Activate_Referenced_Statement)1 Activate_Statement (org.eclipse.titan.designer.AST.TTCN3.statements.Activate_Statement)1 ActivateDereferedExpression (org.eclipse.titan.designer.AST.TTCN3.values.expressions.ActivateDereferedExpression)1 ActivateExpression (org.eclipse.titan.designer.AST.TTCN3.values.expressions.ActivateExpression)1 ReturnPointVisitor (org.eclipse.titanium.metrics.visitors.ReturnPointVisitor)1