Skip to content

Package: OneLineChange

OneLineChange

nameinstructionbranchcomplexitylinemethod
OneLineChange(DiffDefinition, ChangeType)
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: 15 C: 29
66%
M: 8 C: 6
43%
M: 7 C: 1
13%
M: 7 C: 8
53%
M: 0 C: 1
100%
getChangeType()
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: 4 C: 28
88%
M: 2 C: 2
50%
M: 2 C: 1
33%
M: 0 C: 7
100%
M: 0 C: 1
100%
toString()
M: 17 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: package migration.processeddifffile;
2:
3: import migration.difffile.objects.DiffDefinition;
4:
5: /**
6: * Represents a change which is caused by one line.
7: */
8: public class OneLineChange implements VariableDefinitionChange {
9:
10:         /**
11:          * the variabledefinition, which is either added or removed.
12:          */
13:         private final DiffDefinition variableDefinition;
14:
15:         /**
16:          * the classification of the change.
17:          */
18:         private final ChangeType classification;
19:
20:         /**
21:          * creates a one line change.
22:          *
23:          * @param variableDefinition
24:          * the variable definition
25:          * @param classification
26:          * the classification of the change
27:          */
28:         public OneLineChange(final DiffDefinition variableDefinition,
29:                         final ChangeType classification) {
30:                 this.variableDefinition = variableDefinition;
31:                 this.classification = classification;
32:         }
33:
34:         @Override
35:         public ChangeType getChangeType() {
36:                 return this.classification;
37:         }
38:
39:         @Override
40:         public int hashCode() {
41:                 final int prime = 31;
42:                 int result = 1;
43:•                result = prime * result + ((classification == null)
44:                                 ? 0
45:                                 : classification.hashCode());
46:•                result = prime * result + ((variableDefinition == null)
47:                                 ? 0
48:                                 : variableDefinition.hashCode());
49:                 return result;
50:         }
51:
52:         @Override
53:         public boolean equals(final Object obj) {
54:•                if (this == obj) {
55:                         return true;
56:                 }
57:•                if (obj == null) {
58:                         return false;
59:                 }
60:•                if (getClass() != obj.getClass()) {
61:                         return false;
62:                 }
63:                 final OneLineChange other = (OneLineChange) obj;
64:•                if (classification != other.classification) {
65:                         return false;
66:                 }
67:•                if (variableDefinition == null) {
68:•                        if (other.variableDefinition != null) {
69:                                 return false;
70:                         }
71:•                } else if (!variableDefinition.equals(other.variableDefinition)) {
72:                         return false;
73:                 }
74:                 return true;
75:         }
76:
77:         @Override
78:         public String toString() {
79:                 return "OneLineChange [variableDefinition=" + variableDefinition + ", classification="
80:                                 + classification + "]";
81:         }
82:
83: }