Package: ValueBindingObligation

ValueBindingObligation

nameinstructionbranchcomplexitylinemethod
ValueBindingObligation(AEqualsDefinition, IPOContextStack, IPogAssistantFactory)
M: 11 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
ValueBindingObligation(AValueDefinition, IPOContextStack, IPogAssistantFactory)
M: 0 C: 11
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
ValueBindingObligation(PPattern, PType, PExp, IPOContextStack, IPogAssistantFactory)
M: 0 C: 64
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 15
100%
M: 0 C: 1
100%

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.pog.obligation;
25:
26: import java.util.List;
27: import java.util.Vector;
28:
29: import org.overture.ast.analysis.AnalysisException;
30: import org.overture.ast.definitions.AEqualsDefinition;
31: import org.overture.ast.definitions.AValueDefinition;
32: import org.overture.ast.expressions.AEqualsBinaryExp;
33: import org.overture.ast.expressions.AExistsExp;
34: import org.overture.ast.expressions.PExp;
35: import org.overture.ast.factory.AstExpressionFactory;
36: import org.overture.ast.patterns.ATypeMultipleBind;
37: import org.overture.ast.patterns.PMultipleBind;
38: import org.overture.ast.patterns.PPattern;
39: import org.overture.ast.types.PType;
40: import org.overture.pog.pub.IPOContextStack;
41: import org.overture.pog.pub.IPogAssistantFactory;
42: import org.overture.pog.pub.POType;
43:
44: public class ValueBindingObligation extends ProofObligation
45: {
46:         private static final long serialVersionUID = -7549866948129324892L;
47:
48:         public ValueBindingObligation(AValueDefinition def, IPOContextStack ctxt,
49:                         IPogAssistantFactory af) throws AnalysisException
50:         {
51:                 this(def.getPattern(), def.getType(), def.getExpression(), ctxt, af);
52:         }
53:
54:         public ValueBindingObligation(AEqualsDefinition def, IPOContextStack ctxt,
55:                         IPogAssistantFactory af) throws AnalysisException
56:         {
57:                 this(def.getPattern(), def.getType(), def.getTest(), ctxt, af);
58:         }
59:
60:         public ValueBindingObligation(PPattern pattern, PType type, PExp exp,
61:                         IPOContextStack ctxt, IPogAssistantFactory af)
62:                         throws AnalysisException
63:         {
64:                 super(pattern, POType.VALUE_BINDING, ctxt, pattern.getLocation(), af);
65:                 AExistsExp existsExp = new AExistsExp();
66:
67:                 List<PPattern> patternList = new Vector<PPattern>();
68:                 patternList.add(pattern.clone());
69:                 ATypeMultipleBind typeBind = new ATypeMultipleBind();
70:                 typeBind.setPlist(patternList);
71:                 typeBind.setType(type.clone());
72:                 List<PMultipleBind> bindList = new Vector<PMultipleBind>();
73:                 bindList.add(typeBind);
74:                 existsExp.setBindList(bindList);
75:
76:                 AEqualsBinaryExp equals = AstExpressionFactory.newAEqualsBinaryExp(patternToExp(pattern.clone()), exp.clone());
77:                 existsExp.setPredicate(equals);
78:
79:                 stitch = existsExp;
80:                 valuetree.setPredicate(ctxt.getPredWithContext(existsExp));
81:                 // valuetree.setContext(ctxt.getContextNodeList());
82:         }
83: }