Package: BreakpointExpression

BreakpointExpression

nameinstructionbranchcomplexitylinemethod
BreakpointExpression(Breakpoint, BreakpointCondition, long)
M: 15 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
apply(IAnalysis)
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
apply(IAnswer)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
apply(IQuestion, Object)
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
apply(IQuestionAnswer, Object)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
clone()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
clone(Map)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
eval(Context)
M: 62 C: 0
0%
M: 13 C: 0
0%
M: 9 C: 0
0%
M: 10 C: 0
0%
M: 1 C: 0
0%
toString()
M: 15 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: *
3: *        Copyright (c) 2008 Fujitsu Services Ltd.
4: *
5: *        Author: Nick Battle
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.ast.expressions;
25:
26: import java.util.Map;
27:
28: import org.overture.ast.analysis.AnalysisException;
29: import org.overture.ast.analysis.intf.IAnalysis;
30: import org.overture.ast.analysis.intf.IAnswer;
31: import org.overture.ast.analysis.intf.IQuestion;
32: import org.overture.ast.analysis.intf.IQuestionAnswer;
33: import org.overture.ast.expressions.PExp;
34: import org.overture.ast.expressions.PExpBase;
35: import org.overture.ast.node.INode;
36: import org.overture.interpreter.runtime.Breakpoint;
37: import org.overture.interpreter.runtime.BreakpointCondition;
38: import org.overture.interpreter.runtime.Context;
39: import org.overture.interpreter.values.BooleanValue;
40: import org.overture.interpreter.values.Value;
41:
42: public class BreakpointExpression extends PExpBase
43: {
44:         private static final long serialVersionUID = 1L;
45:         private final Breakpoint bp;
46:         private final BreakpointCondition cond;
47:         private final long arg;
48:
49:         @SuppressWarnings("deprecation")
50:         public BreakpointExpression(Breakpoint breakpoint,
51:                         BreakpointCondition cond, long arg)
52:         {
53:                 super(breakpoint.location, null);
54:                 this.bp = breakpoint;
55:                 this.cond = cond;
56:                 this.arg = arg;
57:         }
58:
59:         @Override
60:         public String toString()
61:         {
62:                 return "hits " + cond + " " + arg;
63:         }
64:
65:         @Override
66:         public PExp clone(Map<INode, INode> oldToNewMap)
67:         {
68:                 return null;
69:         }
70:
71:         @Override
72:         public PExp clone()
73:         {
74:                 return null;
75:         }
76:
77:         @Override
78:         public void apply(IAnalysis analysis) throws AnalysisException
79:         {
80:
81:         }
82:
83:         @Override
84:         public <A> A apply(IAnswer<A> caller) throws AnalysisException
85:         {
86:                 return null;
87:         }
88:
89:         @Override
90:         public <Q> void apply(IQuestion<Q> caller, Q question)
91:                         throws AnalysisException
92:         {
93:
94:         }
95:
96:         @Override
97:         public <Q, A> A apply(IQuestionAnswer<Q, A> caller, Q question)
98:                         throws AnalysisException
99:         {
100:                 return null;
101:         }
102:
103:         // @Override
104:         // public Type typeCheck(Environment env, TypeList qualifiers, NameScope scope)
105:         // {
106:         // return new BooleanType(location);
107:         // }
108:
109:         // @Override
110:         public Value eval(Context ctxt)
111:         {
112:                 boolean rv = false;
113:
114:•                switch (cond)
115:                 {
116:                         case EQ:
117:•                                rv = bp.hits == arg;
118:                                 break;
119:
120:                         case GT:
121:•                                rv = bp.hits > arg;
122:                                 break;
123:
124:                         case GE:
125:•                                rv = bp.hits >= arg;
126:                                 break;
127:
128:                         case MOD:
129:•                                rv = bp.hits % arg == 0;
130:                                 break;
131:                 }
132:
133:                 return new BooleanValue(rv);
134:         }
135:         //
136:         // @Override
137:         // public String kind()
138:         // {
139:         // return "breakpoint condition";
140:         // }
141: }