Package org.openquark.cal.internal.javamodel

Examples of org.openquark.cal.internal.javamodel.JavaClassRep.addMethod()


   
                dcClass.addMethod(createMethod_getDCOrdinal(dc.getOrdinal()));

                dcClass.addMethod (JavaDataClassGenerator.this.createMethod_toString(dcInfo.allFieldNames, dcInfo.fieldTypeNames));

                dcClass.addMethod (
                        JavaDataClassGenerator.this.createMethod_equals(
                                dcClassTypeName,
                                dcInfo.allFieldNames,
                                dcInfo.fieldTypeNames));
View Full Code Here


                        JavaDataClassGenerator.this.createMethod_equals(
                                dcClassTypeName,
                                dcInfo.allFieldNames,
                                dcInfo.fieldTypeNames));

                dcClass.addMethod (
                        JavaDataClassGenerator.this.createMethod_hashCode(
                                dcInfo.allFieldNames,
                                dcInfo.fieldTypeNames));

                return dcClass;
View Full Code Here

            // Add the constructor: FieldSelection (RTValue $dataConsExpr, int $fieldOrdinal, ErrorInfo $errorInfo);
            fieldSelectionClass.addConstructor(createDCFieldSelectionClass_constructor ());

            // Add the method: private final String getFieldNameByOrdinal (int ordinal);
            fieldSelectionClass.addMethod(createDCFieldSelectionClass_method_getFieldNameByOrdinal());

            fieldSelectionClass.addMethod (createDCFieldSelectionClass_method_getDCName());

            return fieldSelectionClass;
        }
View Full Code Here

            fieldSelectionClass.addConstructor(createDCFieldSelectionClass_constructor ());

            // Add the method: private final String getFieldNameByOrdinal (int ordinal);
            fieldSelectionClass.addMethod(createDCFieldSelectionClass_method_getFieldNameByOrdinal());

            fieldSelectionClass.addMethod (createDCFieldSelectionClass_method_getDCName());

            return fieldSelectionClass;
        }

        /**
 
View Full Code Here

            // public final int getArity() {return 0;}
            int modifiers = Modifier.PUBLIC | Modifier.FINAL;
            JavaTypeName returnType = JavaTypeName.INT;
            JavaMethod javaMethod = new JavaMethod(modifiers, returnType, "getArity");
            tagDCClassRep.addMethod(javaMethod);
            javaMethod.addStatement(new ReturnStatement(LiteralWrapper.make(Integer.valueOf(0))));

            // public final int getOrdinalValue(){return tag;}
            modifiers = Modifier.PUBLIC | Modifier.FINAL;
            returnType = JavaTypeName.INT;
View Full Code Here

            // public final int getOrdinalValue(){return tag;}
            modifiers = Modifier.PUBLIC | Modifier.FINAL;
            returnType = JavaTypeName.INT;
            javaMethod = new JavaMethod(modifiers, returnType, "getOrdinalValue");
            tagDCClassRep.addMethod(javaMethod);
            javaMethod.addStatement(new ReturnStatement(new JavaField.Instance(null, "tag", JavaTypeName.INT)));

            // public final String getModuleName() ...
            modifiers = Modifier.PUBLIC | Modifier.FINAL;
            returnType = JavaTypeName.STRING;
View Full Code Here

            // public final String getModuleName() ...
            modifiers = Modifier.PUBLIC | Modifier.FINAL;
            returnType = JavaTypeName.STRING;
            javaMethod = new JavaMethod(modifiers, returnType, "getModuleName");
            tagDCClassRep.addMethod(javaMethod);
            javaMethod.addStatement(new ReturnStatement(LiteralWrapper.make (typeConstructor.getName().getModuleName().toSourceText())));

            // public final String getUnqualifiedName() ...
            modifiers = Modifier.PUBLIC | Modifier.FINAL;
            returnType = JavaTypeName.STRING;
View Full Code Here

            // public final String getUnqualifiedName() ...
            modifiers = Modifier.PUBLIC | Modifier.FINAL;
            returnType = JavaTypeName.STRING;
            javaMethod = new JavaMethod(modifiers, returnType, "getUnqualifiedName");
            tagDCClassRep.addMethod(javaMethod);
            SwitchStatement sw = new SwitchStatement (new JavaField.Instance(null, "tag", JavaTypeName.INT));
            for (int i = 0, nDCs = dataConsList.size(); i < nDCs; ++i) {
                DataConstructor dc = dataConsList.get (i);
                sw.addCase(new SwitchStatement.IntCaseGroup(dc.getOrdinal(), new ReturnStatement (LiteralWrapper.make(dc.getName().getUnqualifiedName()))));
            }
View Full Code Here

            // public final String getQualfiedName() ...
            modifiers = Modifier.PUBLIC | Modifier.FINAL;
            returnType = JavaTypeName.STRING;
            javaMethod = new JavaMethod(modifiers, returnType, "getQualifiedName");
            tagDCClassRep.addMethod(javaMethod);
            sw = new SwitchStatement (new JavaField.Instance(null, "tag", JavaTypeName.INT));
            for (int i = 0, nDCs = dataConsList.size(); i < nDCs; ++i) {
                DataConstructor dc = dataConsList.get (i);
                sw.addCase(new SwitchStatement.IntCaseGroup(dc.getOrdinal(), new ReturnStatement (LiteralWrapper.make(dc.getName().getQualifiedName()))));
            }
View Full Code Here

            // Add the constructor
            strictAppClassRep.addConstructor(createStrictAppClass_constructor(mf, functionField, functionArgumentMemberFields));

            // Add the reduce method.
            strictAppClassRep.addMethod(createStrictAppClass_method_reduce(mf, functionField, strictAppTypeName, functionArgumentMemberFields));

            // Add the clearMembers() method.
            JavaMethod clearMembers = new JavaMethod (Modifier.PUBLIC | Modifier.FINAL, JavaTypeName.VOID, "clearMembers");
            //the line "function = null;" should not be added to clearMembers. function is a reference to a singleton
            //so that clearing it doesn't actually free any memory. However, not clearing it means that the the method
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.