Search in sources :

Example 11 with Def_Altstep

use of org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Altstep 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)

Aggregations

Def_Altstep (org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Altstep)10 Def_Function (org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Function)5 Def_Testcase (org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Testcase)5 ArrayList (java.util.ArrayList)3 RunsOnScope (org.eclipse.titan.designer.AST.TTCN3.definitions.RunsOnScope)3 StatementBlock (org.eclipse.titan.designer.AST.TTCN3.statements.StatementBlock)3 IType (org.eclipse.titan.designer.AST.IType)2 IValue (org.eclipse.titan.designer.AST.IValue)2 FormalParameterList (org.eclipse.titan.designer.AST.TTCN3.definitions.FormalParameterList)2 Component_Type (org.eclipse.titan.designer.AST.TTCN3.types.Component_Type)2 Altstep_Reference_Value (org.eclipse.titan.designer.AST.TTCN3.values.Altstep_Reference_Value)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 ASN1Assignment (org.eclipse.titan.designer.AST.ASN1.ASN1Assignment)1 INamedNode (org.eclipse.titan.designer.AST.INamedNode)1 IReferenceChain (org.eclipse.titan.designer.AST.IReferenceChain)1 IVisitableNode (org.eclipse.titan.designer.AST.IVisitableNode)1 Identifier (org.eclipse.titan.designer.AST.Identifier)1 LargeLocation (org.eclipse.titan.designer.AST.LargeLocation)1