Search in sources :

Example 16 with Counter

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

Example 17 with Counter

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();
}
Also used : Counter(org.eclipse.titanium.metrics.visitors.Counter) ExternalFeatureEnvyDetector(org.eclipse.titanium.metrics.visitors.ExternalFeatureEnvyDetector) Module(org.eclipse.titan.designer.AST.Module)

Example 18 with Counter

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

Example 19 with Counter

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();
}
Also used : Counter(org.eclipse.titanium.metrics.visitors.Counter)

Example 20 with Counter

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();
}
Also used : Counter(org.eclipse.titanium.metrics.visitors.Counter) ExternalFeatureEnvyDetector(org.eclipse.titanium.metrics.visitors.ExternalFeatureEnvyDetector)

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