Package: POForAllPredicateContext

POForAllPredicateContext

nameinstructionbranchcomplexitylinemethod
POForAllPredicateContext(ALetBeStExp, IPogAssistantFactory)
M: 0 C: 9
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
POForAllPredicateContext(AMapCompMapExp)
M: 0 C: 8
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
POForAllPredicateContext(ASeqCompSeqExp, IPogAssistantFactory)
M: 0 C: 9
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
POForAllPredicateContext(ASetCompSetExp)
M: 0 C: 8
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
POForAllPredicateContext(ITypeCheckerAssistantFactory, AExists1Exp)
M: 9 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
getContext()
M: 28 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%
getContextNode(PExp)
M: 0 C: 27
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 8
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.contexts;
25:
26: import org.overture.ast.expressions.AExists1Exp;
27: import org.overture.ast.expressions.AForAllExp;
28: import org.overture.ast.expressions.AImpliesBooleanBinaryExp;
29: import org.overture.ast.expressions.ALetBeStExp;
30: import org.overture.ast.expressions.AMapCompMapExp;
31: import org.overture.ast.expressions.ASeqCompSeqExp;
32: import org.overture.ast.expressions.ASetCompSetExp;
33: import org.overture.ast.expressions.PExp;
34: import org.overture.ast.factory.AstExpressionFactory;
35: import org.overture.ast.types.ABooleanBasicType;
36: import org.overture.pog.pub.IPogAssistantFactory;
37: import org.overture.typechecker.assistant.ITypeCheckerAssistantFactory;
38:
39: public class POForAllPredicateContext extends POForAllContext
40: {
41:         public final PExp predicate;
42:
43:         public POForAllPredicateContext(AMapCompMapExp exp)
44:         {
45:                 super(exp);
46:                 this.predicate = exp.getPredicate();
47:         }
48:
49:         public POForAllPredicateContext(ASetCompSetExp exp)
50:         {
51:                 super(exp);
52:                 this.predicate = exp.getPredicate();
53:         }
54:
55:         public POForAllPredicateContext(ASeqCompSeqExp exp,
56:                         IPogAssistantFactory assistantFactory)
57:         {
58:                 super(exp, assistantFactory);
59:                 this.predicate = exp.getPredicate();
60:         }
61:
62:         public POForAllPredicateContext(ITypeCheckerAssistantFactory af,
63:                         AExists1Exp exp)
64:         {
65:                 super(af, exp);
66:                 this.predicate = exp.getPredicate();
67:         }
68:
69:         public POForAllPredicateContext(ALetBeStExp exp,
70:                         IPogAssistantFactory assistantFactory)
71:         {
72:                 super(exp, assistantFactory);
73:                 this.predicate = exp.getSuchThat();
74:         }
75:
76:         @Override
77:         public PExp getContextNode(PExp stitch)
78:         {
79:
80:                 AForAllExp super_exp = super.getSuperContext(stitch);
81:
82:•                if (predicate != null)
83:                 {
84:                         AImpliesBooleanBinaryExp implies_exp = AstExpressionFactory.newAImpliesBooleanBinaryExp(predicate.clone(), stitch);
85:                         implies_exp.setType(new ABooleanBasicType());
86:                         super_exp.setPredicate(implies_exp);
87:                 } else
88:                 {
89:                         super_exp.setPredicate(stitch);
90:                 }
91:
92:                 return super_exp;
93:         }
94:
95:         @Override
96:         public String getContext()
97:         {
98:                 StringBuilder sb = new StringBuilder();
99:                 sb.append(super.getContext());
100:
101:•                if (predicate != null)
102:                 {
103:                         sb.append(" ");
104:                         sb.append(predicate);
105:                         sb.append(" =>");
106:                 }
107:
108:                 return sb.toString();
109:         }
110: }