Package: VdmNodeInfo

VdmNodeInfo

nameinstructionbranchcomplexitylinemethod
VdmNodeInfo(INode)
M: 9 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
VdmNodeInfo(INode, String)
M: 0 C: 9
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
equals(Object)
M: 23 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 8 C: 0
0%
M: 1 C: 0
0%
getNode()
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%
getReason()
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%
hashCode()
M: 0 C: 22
100%
M: 2 C: 2
50%
M: 2 C: 1
33%
M: 0 C: 6
100%
M: 0 C: 1
100%
matches(VdmNodeInfo, INode, String)
M: 8 C: 24
75%
M: 10 C: 6
38%
M: 8 C: 1
11%
M: 2 C: 5
71%
M: 0 C: 1
100%
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: * 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.ir;
23:
24: import org.overture.ast.node.INode;
25:
26: public class VdmNodeInfo
27: {
28:         private INode node;
29:         private String reason;
30:
31:         public VdmNodeInfo(INode node)
32:         {
33:                 super();
34:                 this.node = node;
35:                 this.reason = null;
36:         }
37:
38:         public VdmNodeInfo(INode node, String reason)
39:         {
40:                 super();
41:                 this.node = node;
42:                 this.reason = reason;
43:         }
44:
45:         public INode getNode()
46:         {
47:                 return node;
48:         }
49:
50:         public String getReason()
51:         {
52:                 return reason;
53:         }
54:
55:         @Override
56:         public int hashCode()
57:         {
58:                 int hash = 0;
59:
60:•                if (node != null)
61:                 {
62:                         hash += node.hashCode();
63:                 }
64:
65:•                if (reason != null)
66:                 {
67:                         hash += reason.hashCode();
68:                 }
69:
70:                 return hash;
71:         }
72:
73:         @Override
74:         public boolean equals(Object obj)
75:         {
76:•                if (obj == null)
77:                 {
78:                         return false;
79:                 }
80:
81:•                if (!(obj instanceof VdmNodeInfo))
82:                 {
83:                         return false;
84:                 }
85:
86:                 VdmNodeInfo other = (VdmNodeInfo) obj;
87:
88:                 INode otherNode = other.node;
89:                 String otherReason = other.reason;
90:
91:                 return matches(this, otherNode, otherReason);
92:         }
93:
94:         public static boolean matches(VdmNodeInfo vdmNodeInfo, INode otherNode,
95:                         String otherReason)
96:         {
97:•                if (vdmNodeInfo.node == null && otherNode != null
98:                                 || vdmNodeInfo.node != null
99:•                                                && !vdmNodeInfo.node.equals(otherNode))
100:                 {
101:                         return false;
102:                 }
103:
104:•                if (vdmNodeInfo.reason == null && otherReason != null
105:                                 || vdmNodeInfo.reason != null
106:•                                                && !vdmNodeInfo.reason.equals(otherReason))
107:                 {
108:                         return false;
109:                 }
110:
111:                 return true;
112:         }
113:
114:         @Override
115:         public String toString()
116:         {
117:                 return "Node: " + node + ". Reason: " + reason;
118:         }
119: }