Package: VdmRuntimeError

VdmRuntimeError

nameinstructionbranchcomplexitylinemethod
VdmRuntimeError()
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%
abort(ILexLocation, ValueException)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
abort(ILexLocation, int, String, Context)
M: 0 C: 8
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
abort(LocatedException, Context)
M: 11 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
patternFail(ValueException, ILexLocation)
M: 0 C: 9
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
patternFail(int, String, ILexLocation)
M: 0 C: 7
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: package org.overture.interpreter.runtime;
2:
3: import org.overture.ast.intf.lex.ILexLocation;
4: import org.overture.interpreter.values.Value;
5: import org.overture.parser.messages.LocatedException;
6:
7: public class VdmRuntimeError
8: {
9:
10:         public static Value abort(ILexLocation location, int number, String msg,
11:                         Context ctxt)
12:         {
13:                 throw new ContextException(number, msg, location, ctxt);
14:         }
15:
16:         public static Value abort(ILexLocation location, ValueException ve)
17:         {
18:                 throw new ContextException(ve, location);
19:         }
20:
21:         /**
22:          * Abort the runtime interpretation of the definition, throwing a ContextException to indicate the call stack. The
23:          * information is based on that in the Exception passed.
24:          *
25:          * @param e
26:          * The Exception that caused the problem.
27:          * @param ctxt
28:          * The runtime context that caught the exception.
29:          * @return
30:          */
31:
32:         public static Value abort(LocatedException e, Context ctxt)
33:         {
34:                 throw new ContextException(e.number, e.getMessage(), e.location, ctxt);
35:         }
36:
37:         /**
38:          * Throw a PatternMatchException with the given message.
39:          *
40:          * @param number
41:          * @param msg
42:          * @param location
43:          * @throws PatternMatchException
44:          */
45:         public static void patternFail(int number, String msg, ILexLocation location)
46:                         throws PatternMatchException
47:         {
48:                 throw new PatternMatchException(number, msg, location);
49:         }
50:
51:         /**
52:          * Throw a PatternMatchException with a message from the ValueException.
53:          *
54:          * @param ve
55:          * @param location
56:          * @return
57:          * @throws PatternMatchException
58:          */
59:
60:         public static Value patternFail(ValueException ve, ILexLocation location)
61:                         throws PatternMatchException
62:         {
63:                 throw new PatternMatchException(ve.number, ve.getMessage(), location);
64:         }
65:
66:         // public static Value abortRethrow(Throwable e)
67:         // {
68:         // if(e instanceof RuntimeException)
69:         // {
70:         // throw (RuntimeException) e;
71:         // }
72:         // else
73:         // {
74:         // e.printStackTrace();
75:         // return null;
76:         // }
77:         //
78:         // }
79:
80: }