Search in sources :

Example 11 with Counter

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

the class TMNesting method measure.

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

Example 12 with Counter

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

the class FMOutEnvy method measure.

@Override
public Number measure(final MetricData data, final Def_Function function) {
    final Counter count = new Counter(0);
    final Module myModule = function.getMyScope().getModuleScope();
    function.accept(new ExternalFeatureEnvyDetector(myModule, count));
    return count.val();
}
Also used : Counter(org.eclipse.titanium.metrics.visitors.Counter) ExternalFeatureEnvyDetector(org.eclipse.titanium.metrics.visitors.ExternalFeatureEnvyDetector) Module(org.eclipse.titan.designer.AST.Module)

Example 13 with Counter

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

the class AMOutEnvy method measure.

@Override
public Number measure(final MetricData data, final Def_Altstep altstep) {
    final Counter count = new Counter(0);
    final Module myModule = altstep.getMyScope().getModuleScope();
    altstep.accept(new ExternalFeatureEnvyDetector(myModule, count));
    return count.val();
}
Also used : Counter(org.eclipse.titanium.metrics.visitors.Counter) ExternalFeatureEnvyDetector(org.eclipse.titanium.metrics.visitors.ExternalFeatureEnvyDetector) Module(org.eclipse.titan.designer.AST.Module)

Example 14 with Counter

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

the class FMCyclomaticComplexity method measure.

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

Example 15 with Counter

use of org.eclipse.titanium.metrics.visitors.Counter 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();
}
Also used : ActivateExpression(org.eclipse.titan.designer.AST.TTCN3.values.expressions.ActivateExpression) Counter(org.eclipse.titanium.metrics.visitors.Counter) Activate_Statement(org.eclipse.titan.designer.AST.TTCN3.statements.Activate_Statement) CounterVisitor(org.eclipse.titanium.metrics.visitors.CounterVisitor) Activate_Referenced_Statement(org.eclipse.titan.designer.AST.TTCN3.statements.Activate_Referenced_Statement) ActivateDereferedExpression(org.eclipse.titan.designer.AST.TTCN3.values.expressions.ActivateDereferedExpression) IVisitableNode(org.eclipse.titan.designer.AST.IVisitableNode)

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