Package: AbstractIterationStrategy

AbstractIterationStrategy

nameinstructionbranchcomplexitylinemethod
AbstractIterationStrategy(TransAssistantIR, ILanguageIterator, ITempVarGen, IterationVarPrefixes)
M: 0 C: 21
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 8
100%
M: 0 C: 1
100%
consDeclarationTag()
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%
getForLoopCond(AIdentifierVarExpIR, List, SPatternIR)
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%
getForLoopInc(AIdentifierVarExpIR, List, SPatternIR)
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%
getForLoopInit(AIdentifierVarExpIR, List, SPatternIR)
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%
getForLoopStms(AIdentifierVarExpIR, List, SPatternIR)
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%
getNextElementAssigned(AIdentifierVarExpIR, List, SPatternIR)
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getNextElementDeclared(AIdentifierVarExpIR, List, SPatternIR)
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%
getOuterBlockDecls(AIdentifierVarExpIR, List)
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%
getPostOuterBlockStms(AIdentifierVarExpIR, List)
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getPreForLoopStms(AIdentifierVarExpIR, List, SPatternIR)
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%
packDecl(AVarDeclIR)
M: 0 C: 10
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
packStm(SStmIR)
M: 0 C: 10
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
setFirstBind(boolean)
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
setLastBind(boolean)
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
tagNextElementDeclared(AVarDeclIR)
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%

Coverage

1: /*
2: * #%~
3: * VDM Code Generator
4: * %%
5: * Copyright (C) 2008 - 2014 Overture
6: * %%
7: * This program is free software: you can redistribute it and/or modify
8: * it under the terms of the GNU General Public License as
9: * published by the Free Software Foundation, either version 3 of the
10: * License, or (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public
18: * License along with this program. If not, see
19: * <http://www.gnu.org/licenses/gpl-3.0.html>.
20: * #~%
21: */
22: package org.overture.codegen.trans;
23:
24: import java.util.LinkedList;
25: import java.util.List;
26:
27: import org.overture.codegen.ir.ITempVarGen;
28: import org.overture.codegen.ir.SExpIR;
29: import org.overture.codegen.ir.SPatternIR;
30: import org.overture.codegen.ir.SStmIR;
31: import org.overture.codegen.ir.analysis.AnalysisException;
32: import org.overture.codegen.ir.declarations.AVarDeclIR;
33: import org.overture.codegen.ir.expressions.AIdentifierVarExpIR;
34: import org.overture.codegen.ir.statements.ALocalPatternAssignmentStmIR;
35: import org.overture.codegen.trans.assistants.TransAssistantIR;
36: import org.overture.codegen.trans.iterator.ILanguageIterator;
37:
38: public abstract class AbstractIterationStrategy implements IIterationStrategy
39: {
40:         protected boolean firstBind;
41:         protected boolean lastBind;
42:
43:         protected TransAssistantIR transAssist;
44:         protected ILanguageIterator langIterator;
45:         protected ITempVarGen tempGen;
46:         protected IterationVarPrefixes iteVarPrefixes;
47:
48:         protected AVarDeclIR successVarDecl = null;
49:
50:         protected AVarDeclIR nextElementDeclared = null;
51:
52:         public AbstractIterationStrategy(TransAssistantIR transformationAssistant,
53:                         ILanguageIterator langIterator, ITempVarGen tempGen,
54:                         IterationVarPrefixes iteVarPrefixes)
55:         {
56:                 this.transAssist = transformationAssistant;
57:                 this.langIterator = langIterator;
58:                 this.tempGen = tempGen;
59:                 this.iteVarPrefixes = iteVarPrefixes;
60:         }
61:
62:         @Override
63:         public List<AVarDeclIR> getOuterBlockDecls(AIdentifierVarExpIR setVar,
64:                         List<SPatternIR> patterns) throws AnalysisException
65:         {
66:                 return null;
67:         }
68:
69:         public List<SStmIR> getPreForLoopStms(AIdentifierVarExpIR setVar,
70:                         List<SPatternIR> patterns, SPatternIR pattern)
71:         {
72:                 return langIterator.getPreForLoopStms(setVar, patterns, pattern);
73:         }
74:
75:         @Override
76:         public AVarDeclIR getForLoopInit(AIdentifierVarExpIR setVar,
77:                         List<SPatternIR> patterns, SPatternIR pattern)
78:         {
79:                 return langIterator.getForLoopInit(setVar, patterns, pattern);
80:         }
81:
82:         @Override
83:         public SExpIR getForLoopCond(AIdentifierVarExpIR setVar,
84:                         List<SPatternIR> patterns, SPatternIR pattern)
85:                         throws AnalysisException
86:         {
87:                 return langIterator.getForLoopCond(setVar, patterns, pattern);
88:         }
89:
90:         @Override
91:         public SExpIR getForLoopInc(AIdentifierVarExpIR setVar,
92:                         List<SPatternIR> patterns, SPatternIR pattern)
93:         {
94:                 return langIterator.getForLoopInc(setVar, patterns, pattern);
95:         }
96:
97:         public void tagNextElementDeclared(AVarDeclIR nextElementDecl)
98:         {
99:                 nextElementDecl.setTag(consDeclarationTag());
100:                 this.nextElementDeclared = nextElementDecl;
101:         }
102:
103:         public DeclarationTag consDeclarationTag()
104:         {
105:                 return new DeclarationTag(false, successVarDecl);
106:         }
107:
108:         @Override
109:         public AVarDeclIR getNextElementDeclared(AIdentifierVarExpIR setVar,
110:                         List<SPatternIR> patterns, SPatternIR pattern)
111:                         throws AnalysisException
112:         {
113:                 tagNextElementDeclared(langIterator.getNextElementDeclared(setVar, patterns, pattern));
114:
115:                 return nextElementDeclared;
116:         }
117:
118:         @Override
119:         public ALocalPatternAssignmentStmIR getNextElementAssigned(
120:                         AIdentifierVarExpIR setVar, List<SPatternIR> patterns,
121:                         SPatternIR pattern) throws AnalysisException
122:         {
123:                 return null;
124:         }
125:
126:         @Override
127:         public List<SStmIR> getForLoopStms(AIdentifierVarExpIR setVar,
128:                         List<SPatternIR> patterns, SPatternIR pattern)
129:         {
130:                 return null;
131:         }
132:
133:         @Override
134:         public List<SStmIR> getPostOuterBlockStms(AIdentifierVarExpIR setVar,
135:                         List<SPatternIR> patterns)
136:         {
137:                 return null;
138:         }
139:
140:         @Override
141:         public void setFirstBind(boolean firstBind)
142:         {
143:                 this.firstBind = firstBind;
144:         }
145:
146:         @Override
147:         public void setLastBind(boolean lastBind)
148:         {
149:                 this.lastBind = lastBind;
150:         }
151:
152:         protected List<SStmIR> packStm(SStmIR stm)
153:         {
154:                 List<SStmIR> stms = new LinkedList<SStmIR>();
155:
156:                 stms.add(stm);
157:
158:                 return stms;
159:         }
160:
161:         protected List<AVarDeclIR> packDecl(AVarDeclIR decl)
162:         {
163:                 List<AVarDeclIR> decls = new LinkedList<AVarDeclIR>();
164:
165:                 decls.add(decl);
166:
167:                 return decls;
168:         }
169: }