Package: VdmToolsOptions

VdmToolsOptions

nameinstructionbranchcomplexitylinemethod
Save(File, String)
M: 30 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 8 C: 0
0%
M: 1 C: 0
0%
VdmToolsOptions()
M: 156 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 41 C: 0
0%
M: 1 C: 0
0%
getEntry()
M: 56 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
getValue(Object)
M: 14 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * #%~
3: * org.overture.ide.plugins.csk
4: * %%
5: * Copyright (C) 2008 - 2014 Overture
6: * %%
7: * This program is free software: you can redistribute it and/or modify
8: * it under the terms of the GNU General Public License as
9: * published by the Free Software Foundation, either version 3 of the
10: * License, or (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public
18: * License along with this program. If not, see
19: * <http://www.gnu.org/licenses/gpl-3.0.html>.
20: * #~%
21: */
22: package org.overture.ide.plugins.csk.internal;
23:
24: import java.io.File;
25: import java.io.IOException;
26: import java.lang.reflect.Field;
27:
28: import org.overture.ide.ui.utility.PluginFolderInclude;
29:
30: public class VdmToolsOptions
31: {
32:         public Integer FormatVersion = 2;
33:         public Boolean DTC = true;
34:         public Boolean PRE = true;
35:         public Boolean POST = true;
36:         public Boolean INV = true;
37:         public Boolean CONTEXT = false;
38:         public Integer MAXINSTR = 1000;
39:         public Integer PRIORITY = 0;
40:         public String PRIMARYALGORITHM = "instruction_number_slice";
41:         public Boolean TASKSWITCH = false;
42:         public Integer MAXTIME = 1000;
43:         public Integer TIMEFACTOR = 1;
44:         public Integer STEPSIZE = 100;
45:         public String JITTERMODE = "Early";
46:         public Integer DEFAULTCPUCAPACITY = 1000000;
47:         public String DEFAULTVCPUCAPACITY = "INFINITE";
48:         public String LOGARGS = "";
49:         public Integer PRINT_FORMAT = 1;
50:         public String DEF = "pos";
51:         public Integer errlevel = 1;
52:         public Integer SEP = 1;
53:         public Integer VDMSLMOD = 0;
54:         public Integer INDEX = 0;
55:         public Boolean PrettyPrint_RTI = false;
56:         public Boolean CG_RTI = false;
57:         public Boolean CG_CHECKPREPOST = true;
58:         public Integer C_flag = 0;
59:         public Integer JCG_SKEL = 0;
60:         public Boolean JCG_GENPREPOST = false;
61:         public Boolean JCG_TYPES = false;
62:         public Boolean JCG_SMALLTYPES = false;
63:         public Boolean JCG_LONGS = true;
64:         public String JCG_PACKAGE = "";
65:         public Boolean JCG_CONCUR = false;
66:         public Boolean JCG_CHECKPREPOST = false;
67:         public Boolean JCG_VDMPREFIX = true;
68:         public String JCG_INTERFACES = "";
69:         public Integer Seed_nondetstmt = -1;
70:         public Boolean j2v_stubsOnly = false;
71:         public Boolean j2v_transforms = false;
72:
73:         public void Save(File location, String projectName) throws IOException
74:         {
75:                 StringBuilder sb = new StringBuilder();
76:                 try
77:                 {
78:                         sb.append(getEntry());
79:                 } catch (IllegalArgumentException e)
80:                 {
81:                         e.printStackTrace();
82:                 } catch (IllegalAccessException e)
83:                 {
84:                         e.printStackTrace();
85:                 }
86:                 
87:                 
88:                 PluginFolderInclude.writeFile(location,projectName+".opt", sb.toString());
89:         }
90:
91:         private String getEntry(/*Object... entries*/) throws IllegalArgumentException, IllegalAccessException
92:         {
93:                 StringBuilder data = new StringBuilder();
94: //                List<Object> fooList = Arrays.asList(entries);
95:•                for (Field field : this.getClass().getFields())
96:                 {
97: //                        if (fooList.contains(field.get(this)))
98: //                        {
99:                                 data.append(field.getName()+":"+getValue(field.get(this))+"\n");
100: //                        }
101:                 }
102:•                if(data.length()>1)
103:                 {
104:                         data.deleteCharAt(data.length()-1);        
105:                 }
106:                 return data.toString();
107:                 
108:         }
109:
110:         private String getValue(Object object)
111:         {
112:•                if(object instanceof Boolean)
113:                 {
114:•                        if((Boolean)object)
115:                         {
116:                                 return "1";
117:                         }else
118:                         {
119:                                 return "0";
120:                         }
121:                 }else
122:                 {
123:                         return object.toString();
124:                 }
125:         }
126: }