Package: RuntimeValidator

RuntimeValidator

nameinstructionbranchcomplexitylinemethod
RuntimeValidator()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
bindSystemVariables(ASystemClassDefinition, IInterpreterAssistantFactory)
M: 6 C: 3
33%
M: 3 C: 1
25%
M: 2 C: 1
33%
M: 2 C: 2
50%
M: 0 C: 1
100%
init(ClassInterpreter)
M: 7 C: 3
30%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 2 C: 2
50%
M: 0 C: 1
100%
setLogFile(PrintWriter)
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
static {...}
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
stop()
M: 18 C: 3
14%
M: 5 C: 1
17%
M: 3 C: 1
25%
M: 7 C: 2
22%
M: 0 C: 1
100%
validate(OperationValue, RTMessage.MessageType)
M: 6 C: 3
33%
M: 3 C: 1
25%
M: 2 C: 1
33%
M: 2 C: 2
50%
M: 0 C: 1
100%
validateAsync(OperationValue, AsyncThread)
M: 6 C: 3
33%
M: 3 C: 1
25%
M: 2 C: 1
33%
M: 2 C: 2
50%
M: 0 C: 1
100%

Coverage

1: /***************************************************************************
2: *
3: *        Copyright (c) 2009 IHA
4: *
5: *        Author: Kenneth Lausdahl and Augusto Ribeiro
6: *
7: *        This file is part of VDMJ.
8: *
9: *        VDMJ is free software: you can redistribute it and/or modify
10: *        it under the terms of the GNU General Public License as published by
11: *        the Free Software Foundation, either version 3 of the License, or
12: *        (at your option) any later version.
13: *
14: *        VDMJ is distributed in the hope that it will be useful,
15: *        but WITHOUT ANY WARRANTY; without even the implied warranty of
16: *        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17: *        GNU General Public License for more details.
18: *
19: *        You should have received a copy of the GNU General Public License
20: *        along with VDMJ. If not, see <http://www.gnu.org/licenses/>.
21: *
22: **************************************************************************/
23:
24: package org.overture.interpreter.runtime;
25:
26: import java.io.PrintWriter;
27:
28: import org.overture.ast.definitions.ASystemClassDefinition;
29: import org.overture.config.Settings;
30: import org.overture.interpreter.assistant.IInterpreterAssistantFactory;
31: import org.overture.interpreter.messages.Console;
32: import org.overture.interpreter.messages.rtlog.RTMessage.MessageType;
33: import org.overture.interpreter.runtime.validation.BasicRuntimeValidator;
34: import org.overture.interpreter.runtime.validation.IRuntimeValidatior;
35: import org.overture.interpreter.scheduler.AsyncThread;
36: import org.overture.interpreter.values.OperationValue;
37:
38: public class RuntimeValidator
39: {
40:
41:         public static IRuntimeValidatior validator;
42:         private static PrintWriter logfile = null;
43:
44:         public static void init(ClassInterpreter classInterpreter)
45:         {
46:•                if (Settings.timingInvChecks)
47:                 {
48:                         validator = new BasicRuntimeValidator();
49:                         validator.init(classInterpreter);
50:                 }
51:         }
52:
53:         public static void bindSystemVariables(
54:                         ASystemClassDefinition systemDefinition,
55:                         IInterpreterAssistantFactory af)
56:         {
57:•                if (Settings.timingInvChecks)
58:                 {
59:•                        if (validator != null)
60:                         {
61:                                 validator.bindSystemVariables(systemDefinition, af);
62:                         }
63:
64:                 }
65:         }
66:
67:         public static void validate(OperationValue operationValue, MessageType type)
68:         {
69:•                if (Settings.timingInvChecks)
70:                 {
71:•                        if (validator != null)
72:                         {
73:                                 validator.validate(operationValue, type);
74:                         }
75:                 }
76:         }
77:
78:         public static void validateAsync(OperationValue operationValue,
79:                         AsyncThread t)
80:         {
81:•                if (Settings.timingInvChecks)
82:                 {
83:•                        if (validator != null)
84:                         {
85:                                 validator.validateAsync(operationValue, t);
86:                         }
87:                 }
88:         }
89:
90:         public static void stop()
91:         {
92:•                if (Settings.timingInvChecks)
93:                 {
94:•                        if (validator != null)
95:                         {
96:                                 String res = validator.stop();
97:•                                if (logfile != null)
98:                                 {
99:                                         logfile.write(res);
100:                                         logfile.flush();
101:                                         logfile.close();
102:                                 } else
103:                                 {
104:                                         Console.out.print(res);
105:                                 }
106:
107:                         }
108:                 }
109:         }
110:
111:         public static void setLogFile(PrintWriter out)
112:         {
113:                 logfile = out;
114:         }
115:
116: }