Examples of IfThenElseStatement


Examples of org.openquark.cal.internal.javamodel.JavaStatement.IfThenElseStatement

         */
        private static JavaStatement checkForQuit() {
            // Call RTExecutionContext.isQuitRequest() and if true throw RTValue.InterruptException
            MethodInvocation isQuitRequested = new MethodInvocation.Instance(SCJavaDefn.EXECUTION_CONTEXT_VAR, "isQuitRequested", JavaTypeName.BOOLEAN, MethodInvocation.InvocationType.VIRTUAL);
            ThrowStatement throwStatement = new ThrowStatement(new JavaExpression.JavaField.Static(JavaTypeNames.RTVALUE, "INTERRUPT_EXCEPTION", JavaTypeName.CAL_EXECUTOR_EXCEPTION));
            IfThenElseStatement conditional = new IfThenElseStatement(isQuitRequested, throwStatement);
            return conditional;
        }
View Full Code Here

Examples of org.openquark.cal.internal.javamodel.JavaStatement.IfThenElseStatement

            //a result of setting the root node above.
            if (!mf.isTailRecursive()) {
                then.addStatement(new ExpressionStatement(new MethodInvocation.Instance(null, "clearMembers", JavaTypeName.VOID, MethodInvocation.InvocationType.VIRTUAL)));
            }

            reduce.addStatement(new IfThenElseStatement(condition, then));
            reduce.addStatement(new ReturnStatement(resultField));

            return reduce;
        }
View Full Code Here

Examples of org.openquark.cal.internal.javamodel.JavaStatement.IfThenElseStatement

            String fMethodName = functions.getFnNamePrefix(mf.getName()) + "f" + mf.getArity() + "L";
            MethodInvocation fn = new MethodInvocation.Instance (functionField, fMethodName, args, argTypes, JavaTypeNames.RTVALUE, MethodInvocation.InvocationType.VIRTUAL);
            MethodInvocation setResult = new MethodInvocation.Instance (null, "setResult", fn, JavaTypeNames.RTVALUE, JavaTypeName.VOID,  MethodInvocation.InvocationType.VIRTUAL);
            then.addStatement(new ExpressionStatement(setResult));

            reduce.addStatement(new IfThenElseStatement(condition, then));
            reduce.addStatement(new ReturnStatement(resultField));

            return reduce;
        }
View Full Code Here

Examples of org.openquark.cal.internal.javamodel.JavaStatement.IfThenElseStatement

                   Assignment localAssignment = new Assignment(localVariable, field);
                   InstanceOf checkType = new InstanceOf(localAssignment, JavaTypeNames.RTRESULT_FUNCTION);
                   MethodInvocation getValue = new MethodInvocation.Instance(localVariable, "getValue", JavaTypeNames.RTVALUE, MethodInvocation.InvocationType.VIRTUAL);
                   Assignment fieldAssignment = new Assignment(field, getValue);
                   ReturnStatement returnNewVal = new ReturnStatement(fieldAssignment);
                   IfThenElseStatement ifThen = new IfThenElseStatement(checkType, returnNewVal);
                   javaMethod.addStatement(ifThen);
                   javaMethod.addStatement(new ReturnStatement (localVariable));

               } else {
                   // The field is strict and therefore already in WHNF.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.