Package: PatternBlockData

PatternBlockData

nameinstructionbranchcomplexitylinemethod
IsRootPattern(SPatternIR)
M: 0 C: 8
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
PatternBlockData(MismatchHandling)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
PatternBlockData(SPatternIR, ABlockStmIR, MismatchHandling)
M: 0 C: 15
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 6
100%
M: 0 C: 1
100%
getDeclBlock()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getMismatchHandling()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getPattern()
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%
getRootPatternVar()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getSuccessVar()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getSuccessVarDecl()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
setDeclBlock(ABlockStmIR)
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%
setMismatchHandling(MismatchHandling)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setPattern(SPatternIR)
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%
setRootPatternVar(AIdentifierVarExpIR)
M: 0 C: 7
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
setSuccessVar(AIdentifierVarExpIR)
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%
setSuccessVarDecl(AVarDeclIR)
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%
toString()
M: 25 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: * 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.patterns;
23:
24: import org.overture.codegen.ir.SPatternIR;
25: import org.overture.codegen.ir.declarations.AVarDeclIR;
26: import org.overture.codegen.ir.expressions.AIdentifierVarExpIR;
27: import org.overture.codegen.ir.statements.ABlockStmIR;
28:
29: public class PatternBlockData
30: {
31:         private SPatternIR pattern;
32:         private AVarDeclIR successVarDecl;
33:         private AIdentifierVarExpIR successVar;
34:         private ABlockStmIR declBlock;
35:         private AIdentifierVarExpIR rootPatternVar;
36:         private MismatchHandling mismatchHandling;
37:
38:         public PatternBlockData(SPatternIR pattern, ABlockStmIR declBlock,
39:                         MismatchHandling mismatchHandling)
40:         {
41:                 this.pattern = pattern;
42:                 this.declBlock = declBlock;
43:                 this.rootPatternVar = null;
44:                 this.mismatchHandling = mismatchHandling;
45:         }
46:
47:         public PatternBlockData(MismatchHandling mismatchHandling)
48:         {
49:                 this(null, null, mismatchHandling);
50:         }
51:
52:         public boolean IsRootPattern(SPatternIR pattern)
53:         {
54:•                return this.pattern == pattern;
55:         }
56:
57:         public SPatternIR getPattern()
58:         {
59:                 return pattern;
60:         }
61:
62:         public void setPattern(SPatternIR pattern)
63:         {
64:                 this.pattern = pattern;
65:         }
66:
67:         public AVarDeclIR getSuccessVarDecl()
68:         {
69:                 return successVarDecl;
70:         }
71:
72:         public void setSuccessVarDecl(AVarDeclIR successVarDecl)
73:         {
74:                 this.successVarDecl = successVarDecl;
75:         }
76:
77:         public AIdentifierVarExpIR getSuccessVar()
78:         {
79:                 return successVar;
80:         }
81:
82:         public void setSuccessVar(AIdentifierVarExpIR successVar)
83:         {
84:                 this.successVar = successVar;
85:         }
86:
87:         public ABlockStmIR getDeclBlock()
88:         {
89:                 return declBlock;
90:         }
91:
92:         public void setDeclBlock(ABlockStmIR declBlock)
93:         {
94:                 this.declBlock = declBlock;
95:         }
96:
97:         public void setRootPatternVar(AIdentifierVarExpIR var)
98:         {
99:                 // There can only be one root pattern variable
100:•                if (this.rootPatternVar == null)
101:                 {
102:                         this.rootPatternVar = var;
103:                 }
104:         }
105:
106:         public AIdentifierVarExpIR getRootPatternVar()
107:         {
108:                 return rootPatternVar;
109:         }
110:
111:         public void setMismatchHandling(MismatchHandling mismatchHandling)
112:         {
113:                 this.mismatchHandling = mismatchHandling;
114:         }
115:
116:         public MismatchHandling getMismatchHandling()
117:         {
118:                 return mismatchHandling;
119:         }
120:
121:         @Override
122:         public String toString()
123:         {
124:                 return String.format("Pattern %s\nSuccess var: %s\n"
125:                                 + "Mismatch handling: %s\nDeclaration block: %s", pattern, successVar, mismatchHandling, declBlock);
126:         }
127: }