Skip to content

Package: RefResState

RefResState

nameinstructionbranchcomplexitylinemethod
RefResState(NamedVariableType)
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%
accept(RefStateVisitor)
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%
equals(Object)
M: 0 C: 21
100%
M: 2 C: 4
67%
M: 2 C: 2
50%
M: 0 C: 2
100%
M: 0 C: 1
100%
getType()
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%
hashCode()
M: 0 C: 8
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: package model.type;
2:
3: /**
4: * A state that represents that a reference is resolved.
5: *
6: * @author HFW410RA - Philipp Rammos
7: *
8: */
9: public class RefResState extends AbstractRefState {
10:         /**
11:          * Represents the resolved type.
12:          */
13:         private final NamedVariableType type;
14:
15:         /**
16:          * Constructor, tries to set the field. Checks if it would be a cycle.
17:          *
18:          * @param type
19:          * The type to set.
20:          */
21:         public RefResState(final NamedVariableType type) {
22:                 super(type.getName());
23:                 this.type = type;
24:         }
25:
26:         @Override
27:         public boolean equals(final Object obj) {
28:•                return obj instanceof RefResState && ((RefResState) obj).getType().equals(this.getType())
29:•                                && ((RefResState) obj).getValue().equals(this.getValue());
30:         }
31:
32:         @Override
33:         public int hashCode() {
34:                 return this.getType().hashCode() + this.getValue().hashCode();
35:         }
36:
37:         /**
38:          * Returns the field type. No side effects.
39:          *
40:          * @return this.type
41:          */
42:         @Override
43:         public NamedVariableType getType() {
44:                 return this.type;
45:         }
46:
47:         @Override
48:         public void accept(final RefStateVisitor vis) {
49:                 vis.visit(this);
50:         }
51:
52: }