Package org.tod.meta.sourcecode

Examples of org.tod.meta.sourcecode.BlockScope


public class ProgramStepFactory {

    public static TestConditionalStep conditionalStep(TODSession session, ICallerSideEvent event, int newLine, int lastLineNumber, boolean forward) {
        // Did the conditional evaluate to true or false?
        boolean conditionalTrue;
        BlockScope targetScope;
        if (event == null) {
            return null;
        }
       
        if(event.getOperationBehavior() == null){
            return null;
        }
        // Gather information about i) the class we're in,
        // ii) the last scope we were in (from lastLineNumber) and
        // iii) the current scope we are in.
        ClassInfo classInfo = session.getClassInformationProvider().getClassInfo(event.getOperationBehavior().getDeclaringType());
        SourceInfo sourceInfo = classInfo.getSourceInfo();
        BlockScope lastScope = sourceInfo.findScope(lastLineNumber);
        BlockScope newScope = sourceInfo.findScope(newLine);
       
        if (newScope == null && lastScope == null) {
            return null;
        }
       
        // We want to generate a test conditional step under the following cases:
        // i) We just entered the body of an if/elseif/else;
        // ii) We skipped over the body of an if/elseif.
       
        // If we weren't in a scope on lastLine, then don't worry about it--
        // just skip.
        if (lastScope != null) {
            // If the lastLineNumber was the start of an if/elseif...
            if (lastLineNumber == lastScope.getStartLine()) {
                // ...and we're in the same scope now, then it's true.
                if (newScope != null && newScope.getEndLine() <= lastScope.getEndLine()) {
                    conditionalTrue = true;
                    targetScope = lastScope;
                } else {
                    // We're not in that scope, so it was false.
                    // Is our current scope an else? If so, the "else"
                    // has evaluated to true.
                    if (newScope != null && newScope.getType() == Scope.ELSE) {
                        conditionalTrue = true;
                        targetScope = newScope;
                    } else {
                        conditionalTrue = false;
                        targetScope = lastScope;
View Full Code Here


    }
   
    public static TestLoopStep loopStep(TODSession session, ICallerSideEvent event, int newLine, int lastLineNumber, boolean forward) {
        // Did the loop evaluate to true or false?
        boolean loopTrue = false;
        BlockScope targetScope = null;
        if (event == null) {
            return null;
        }
       
        if(event.getOperationBehavior() == null){
            return null;
        }
        // Gather information about i) the class we're in,
        // ii) the last scope we were in (from lastLineNumber) and
        // iii) the current scope we are in.
        ClassInfo classInfo = session.getClassInformationProvider().getClassInfo(event.getOperationBehavior().getDeclaringType());
        SourceInfo sourceInfo = classInfo.getSourceInfo();
        BlockScope lastScope = sourceInfo.findScope(lastLineNumber);
        BlockScope newScope = sourceInfo.findScope(newLine);
       
        if (newScope == null && lastScope == null) {
            return null;
        }
       
        // We want to generate a test conditional step under the following cases:
        // i) We just entered the body of an if/elseif/else;
        // ii) We skipped over the body of an if/elseif.
       
        // If we weren't in a scope on lastLine, then don't worry about it--
        // just skip.
        if (lastScope != null) {
            // If the lastLineNumber was the start of a repeat...
            if (lastLineNumber == lastScope.getStartLine() && lastScope.getType() == Scope.REPEAT) {
                // ...and we're in the same scope now, then it's true.
                if (newScope != null && newScope.getEndLine() <= lastScope.getEndLine()) {
                    loopTrue = true;
                    targetScope = lastScope;
                } else {
                    // We're not in that scope, so it was false.
                    loopTrue = false;
View Full Code Here

TOP

Related Classes of org.tod.meta.sourcecode.BlockScope

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.