Method: setOptional(boolean)

1: package org.overture.codegen.vdm2jml.predgen.info;
2:
3: import java.util.List;
4:
5: import org.overture.codegen.vdm2jml.util.NameGen;
6:
7: public abstract class AbstractTypeInfo
8: {
9:         private boolean optional;
10:
11:         public AbstractTypeInfo(boolean optional)
12:         {
13:                 this.optional = optional;
14:         }
15:
16:         public final boolean isOptional()
17:         {
18:                 return optional;
19:         }
20:
21:         public void setOptional(boolean optional)
22:         {
23:                 this.optional = optional;
24:         }
25:
26:         abstract public List<LeafTypeInfo> getLeafTypesRecursively();
27:
28:         abstract public String consCheckExp(String enclosingClass,
29:                         String javaRootPackage, String arg, NameGen nameGen);
30:
31:         public String consIsNullCheck(String arg)
32:         {
33:                 return "(" + arg + " == null)";
34:         }
35:
36:         public static String consSubjectCheck(String className, String methodName,
37:                         String subject)
38:         {
39:                 return consSubjectCheckExtraArg(className, methodName, subject, null);
40:         }
41:
42:         public static String consSubjectCheckExtraArg(String className,
43:                         String methodName, String subject, String arg)
44:         {
45:                 String call = className + "." + methodName + "(" + subject;
46:
47:                 if (arg != null)
48:                 {
49:                         call += "," + arg;
50:                 }
51:
52:                 call += ")";
53:
54:                 return call;
55:         }
56: }