public AMethodDeclIR consDefaultCtorSignature(String className) { AMethodDeclIR constructor = new AMethodDeclIR(); constructor.setImplicit(false); constructor.setAccess(IJavaConstants.PUBLIC); constructor.setIsConstructor(true); constructor.setName(className); return constructor; }
public AMethodDeclIR consCopySignature(AMethodTypeIR methodType) { AMethodDeclIR method = new AMethodDeclIR(); method.setIsConstructor(false); method.setImplicit(false); method.setAccess(IJavaConstants.PUBLIC); method.setName(COPY); method.setMethodType(methodType); return method; }
public AMethodDeclIR consToStringSignature() { AMethodDeclIR toStringMethod = new AMethodDeclIR(); toStringMethod.setTag(new IRGeneratedTag(getClass().getName())); toStringMethod.setIsConstructor(false); toStringMethod.setAccess(IJavaConstants.PUBLIC); toStringMethod.setStatic(false); toStringMethod.setName(IJavaConstants.TO_STRING); toStringMethod.setAbstract(false); AStringTypeIR returnType = new AStringTypeIR(); AMethodTypeIR methodType = new AMethodTypeIR(); methodType.setResult(returnType); toStringMethod.setMethodType(methodType); return toStringMethod; }
public AMethodDeclIR consHashcodeMethodSignature() { AMethodDeclIR hashcodeMethod = new AMethodDeclIR(); hashcodeMethod.setImplicit(false); hashcodeMethod.setIsConstructor(false); hashcodeMethod.setAccess(IJavaConstants.PUBLIC); hashcodeMethod.setName(IJavaConstants.HASH_CODE); String intTypeName = IJavaConstants.INT; AExternalTypeIR intBasicType = new AExternalTypeIR(); intBasicType.setName(intTypeName); AMethodTypeIR methodType = new AMethodTypeIR(); methodType.setResult(intBasicType); hashcodeMethod.setMethodType(methodType); return hashcodeMethod; }
protected AMethodDeclIR initPredDecl(String name) { AMethodTypeIR methodType = new AMethodTypeIR(); methodType.setResult(new ABoolBasicTypeIR()); AMethodDeclIR meetsPredMethod = new AMethodDeclIR(); meetsPredMethod.setImplicit(false); meetsPredMethod.setAbstract(false); meetsPredMethod.setAccess(IRConstants.PUBLIC); meetsPredMethod.setAsync(false); meetsPredMethod.setIsConstructor(false); meetsPredMethod.setMethodType(methodType); meetsPredMethod.setStatic(false); meetsPredMethod.setName(name); return meetsPredMethod; }
evalMethod.setAccess(IRConstants.PUBLIC); evalMethod.setBody(null); evalMethod.setIsConstructor(false); evalMethod.setMethodType(methodType.clone()); evalMethod.setName(funcValPrefixes.evalMethod());
public AMethodDeclIR consEqualMethodSignature(String paramName) { AMethodDeclIR equalsMethod = new AMethodDeclIR(); equalsMethod.setImplicit(false); AMethodTypeIR methodType = new AMethodTypeIR(); methodType.getParams().add(new AObjectTypeIR()); AExternalTypeIR returnType = new AExternalTypeIR(); returnType.setInfo(null); returnType.setName(IJavaConstants.BOOLEAN); methodType.setResult(returnType); equalsMethod.setAccess(IJavaConstants.PUBLIC); equalsMethod.setIsConstructor(false); equalsMethod.setName(IJavaConstants.EQUALS); equalsMethod.setMethodType(methodType); // Add the formal parameter "Object obj" to the method AFormalParamLocalParamIR formalParam = new AFormalParamLocalParamIR(); AIdentifierPatternIR idPattern = new AIdentifierPatternIR(); idPattern.setName(paramName); formalParam.setPattern(idPattern); AObjectTypeIR paramType = new AObjectTypeIR(); formalParam.setType(paramType); equalsMethod.getFormalParams().add(formalParam); return equalsMethod; }
public AMethodDeclIR consDefaultContructor(String name) { AMethodDeclIR constructor = new AMethodDeclIR(); AClassTypeIR classType = new AClassTypeIR(); classType.setName(name); AMethodTypeIR methodType = new AMethodTypeIR(); methodType.setResult(classType); constructor.setMethodType(methodType); constructor.setAccess(IRConstants.PUBLIC); constructor.setAbstract(false); constructor.setIsConstructor(true); constructor.setName(name); constructor.setImplicit(false); constructor.setBody(new ABlockStmIR()); return constructor; }
protected AMethodDeclIR consExecuteMethod(SStmIR stm) { AMethodTypeIR methodType = new AMethodTypeIR(); methodType.setResult(new AObjectTypeIR()); AMethodDeclIR execMethod = new AMethodDeclIR(); execMethod.setImplicit(false); execMethod.setAbstract(false); execMethod.setAccess(IRConstants.PUBLIC); execMethod.setAsync(false); execMethod.setIsConstructor(false); execMethod.setMethodType(methodType); execMethod.setName(traceTrans.getTracePrefixes().callStmExecMethodNamePrefix()); execMethod.setStatic(false); ABlockStmIR body = new ABlockStmIR(); body.getStatements().add(makeInstanceCall(stm)); ensureStoreLookups(body); execMethod.setBody(body); return execMethod; }
this.setName(name_); this.setFormalParams(formalParams_); this.setIsConstructor(isConstructor_); this.setTemplateTypes(templateTypes_); this.setImplicit(implicit_);
private AMethodDeclIR consTraceMethod(ANamedTraceDeclIR node) throws AnalysisException { AClassTypeIR testAccType = transAssistant.consClassType(tracePrefixes.testAccumulatorClassName()); AMethodTypeIR methodType = new AMethodTypeIR(); methodType.setResult(new AVoidTypeIR()); methodType.getParams().add(testAccType); AFormalParamLocalParamIR instanceParam = new AFormalParamLocalParamIR(); instanceParam.setType(testAccType.clone()); instanceParam.setPattern(transAssistant.getInfo().getPatternAssistant().consIdPattern(tracePrefixes.traceMethodParamName())); AMethodDeclIR traceMethod = new AMethodDeclIR(); traceMethod.setTag(new TraceMethodTag()); traceMethod.getFormalParams().add(instanceParam); traceMethod.setImplicit(false); traceMethod.setAbstract(false); traceMethod.setAccess(IRConstants.PUBLIC); traceMethod.setBody(consTraceMethodBody(node)); traceMethod.setIsConstructor(false); traceMethod.setStatic(Settings.dialect == Dialect.VDM_SL); traceMethod.setMethodType(methodType); traceMethod.setName(getTraceName(node) + "_" + tracePrefixes.runTraceMethodName()); return traceMethod; }
objInitializer.setName(initName); objInitializer.getMethodType().setResult(new AVoidTypeIR()); objInitializer.setIsConstructor(false); objInitializer.setPreCond(null); objInitializer.setPostCond(null);
this.setName(name_); this.setFormalParams(formalParams_); this.setIsConstructor(isConstructor_); this.setTemplateTypes(templateTypes_); this.setImplicit(implicit_);
public AMethodDeclIR genInvMethod(ADefaultClassDeclIR clazz, ANamedTypeDeclIR namedTypeDecl) { AReturnStmIR body = new AReturnStmIR(); body.setExp(jmlGen.getJavaGen().getInfo().getExpAssistant().consBoolLiteral(true)); STypeIR paramType = namedTypeDecl.getType(); AMethodTypeIR invMethodType = new AMethodTypeIR(); invMethodType.setResult(new ABoolBasicTypeIR()); invMethodType.getParams().add(paramType.clone()); String formalParamName = new NameGen(clazz).getName(JmlGenerator.GEN_INV_METHOD_PARAM_NAME); AFormalParamLocalParamIR formalParam = new AFormalParamLocalParamIR(); formalParam.setType(paramType.clone()); formalParam.setPattern(jmlGen.getJavaGen().getInfo().getPatternAssistant().consIdPattern(formalParamName)); AMethodDeclIR method = new AMethodDeclIR(); method.setImplicit(false); method.setAbstract(false); method.setAccess(IRConstants.PUBLIC); method.setAsync(false); method.setBody(body); method.getFormalParams().add(formalParam); method.setIsConstructor(false); method.setMethodType(invMethodType); method.setName("inv_" + namedTypeDecl.getName()); method.setStatic(true); return method; }
public AMethodDeclIR consValidMethod() { AMethodDeclIR validMethod = new AMethodDeclIR(); validMethod.setAbstract(false); validMethod.setAccess(IRConstants.PUBLIC); validMethod.setAsync(false); validMethod.setImplicit(false); validMethod.setIsConstructor(false); validMethod.setName(JmlGenerator.REC_VALID_METHOD_NAMEVALID); validMethod.setStatic(false); AMethodTypeIR methodType = new AMethodTypeIR(); methodType.setResult(new ABoolBasicTypeIR()); validMethod.setMethodType(methodType); AReturnStmIR body = new AReturnStmIR(); body.setExp(jmlGen.getJavaGen().getInfo().getExpAssistant().consBoolLiteral(true)); validMethod.setBody(body); jmlGen.getAnnotator().makePure(validMethod); return validMethod; }
private AMethodDeclIR consSetter(AFieldDeclIR f) { AMethodDeclIR setter = new AMethodDeclIR(); setter.setAbstract(false); setter.setAccess(IRConstants.PUBLIC); setter.setAsync(false); setter.setImplicit(false); setter.setIsConstructor(false); setter.setName(consSetCallName(f.getName())); setter.setStatic(false); setter.setSourceNode(f.getSourceNode()); String paramName = consParamName(f); AFormalParamLocalParamIR param = new AFormalParamLocalParamIR(); param.setType(f.getType().clone()); param.setPattern(jmlGen.getJavaGen().getInfo().getPatternAssistant().consIdPattern(paramName)); setter.getFormalParams().add(param); AMethodTypeIR methodType = new AMethodTypeIR(); methodType.setResult(new AVoidTypeIR()); methodType.getParams().add(f.getType().clone()); setter.setMethodType(methodType); AAssignToExpStmIR fieldUpdate = new AAssignToExpStmIR(); fieldUpdate.setTarget(jmlGen.getJavaGen().getInfo().getExpAssistant().consIdVar(f.getName(), f.getType().clone())); fieldUpdate.setExp(jmlGen.getJavaGen().getInfo().getExpAssistant().consIdVar(paramName, f.getType().clone())); setter.setBody(fieldUpdate); return setter; }
private AMethodDeclIR consGetter(AFieldDeclIR f) { AMethodDeclIR getter = new AMethodDeclIR(); getter.setAbstract(false); getter.setAccess(IRConstants.PUBLIC); getter.setAsync(false); getter.setImplicit(false); getter.setIsConstructor(false); getter.setName(consGetCallName(f.getName())); getter.setStatic(false); getter.setSourceNode(f.getSourceNode()); AMethodTypeIR methodType = new AMethodTypeIR(); methodType.setResult(f.getType().clone()); getter.setMethodType(methodType); AReturnStmIR returnField = new AReturnStmIR(); returnField.setExp(jmlGen.getJavaGen().getInfo().getExpAssistant().consIdVar(f.getName(), f.getType().clone())); getter.setBody(returnField); jmlGen.getAnnotator().makePure(getter); return getter; }
getInstanceMethod.setAbstract(false); getInstanceMethod.setAccess(IJavaConstants.PUBLIC); getInstanceMethod.setIsConstructor(false); getInstanceMethod.setName(GET_INSTANCE_METHOD); getInstanceMethod.setStatic(true);
method.setName(name); method.setStatic(true); method.setIsConstructor(false); method.setImplicit(node.getImplicit());
method.setName(operationName); method.setBody(bodyCg); method.setIsConstructor(isConstructor); method.setAbstract(isAbstract); method.setImplicit(node instanceof AImplicitOperationDefinition);