Skip to content

Package: PackageRule

PackageRule

nameinstructionbranchcomplexitylinemethod
PackageRule(RegEx, Path, List, Position, List)
M: 0 C: 24
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 7
100%
M: 0 C: 1
100%
equals(Object)
M: 0 C: 42
100%
M: 2 C: 10
83%
M: 2 C: 5
71%
M: 0 C: 7
100%
M: 0 C: 1
100%
getOptions()
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getPath()
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%
getPosition()
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%
getValue()
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%
getVariableDefinition()
M: 0 C: 6
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: 20
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
toString()
M: 0 C: 30
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%

Coverage

1: /**
2: *
3: */
4: package model.packages;
5:
6: import java.util.ArrayList;
7: import java.util.List;
8:
9: import scanner.ScannerConstants;
10:
11: import model.Position;
12: import model.definition.AbstractVariableDefinition;
13: import model.type.RegEx;
14: import basic.ModelConstants;
15:
16: /**
17: * This class represents the rules of the packages in one line of the package description file.
18: *
19: * @author HFW410
20: *
21: */
22: public class PackageRule {
23:         /**
24:          * the value which the variable should have.
25:          */
26:         private final RegEx value;
27:         /**
28:          * represents the List of options.
29:          */
30:         private final transient List<Option> options;
31:
32:         /**
33:          * represents the path.
34:          */
35:         private final transient Path path;
36:         /**
37:          * represents the List of the variable definitions.
38:          */
39:         private final transient List<AbstractVariableDefinition> variableDefinition;
40:         /**
41:          * represents the position of the package rule.
42:          */
43:         private final transient Position position;
44:
45:         /**
46:          * @param value
47:          * String of value
48:          * @param options
49:          * of the rule
50:          * @param path
51:          * of the rule
52:          * @param variableDef
53:          * is the list of variableDefinitions, which the assigmentparser owns. rule
54:          * @param position
55:          * of the rule
56:          */
57:         public PackageRule(final RegEx value, final Path path,
58:                         final List<AbstractVariableDefinition> variableDef, final Position position,
59:                         final List<Option> options) {
60:                 super();
61:                 this.value = value;
62:                 this.path = path;
63:                 this.variableDefinition = new ArrayList<AbstractVariableDefinition>(variableDef);
64:                 this.position = position;
65:                 this.options = new ArrayList<Option>(options);
66:         }
67:
68:         /**
69:          * @return the value
70:          */
71:         public RegEx getValue() {
72:                 return this.value;
73:         }
74:
75:         /**
76:          * @return the options
77:          */
78:         public List<Option> getOptions() {
79:                 return new ArrayList<Option>(this.options);
80:         }
81:
82:         /**
83:          * @return the path
84:          */
85:         public Path getPath() {
86:                 return this.path;
87:         }
88:
89:         /**
90:          * @return the variableDefinition
91:          */
92:         public List<AbstractVariableDefinition> getVariableDefinition() {
93:                 return new ArrayList<AbstractVariableDefinition>(this.variableDefinition);
94:         }
95:
96:         /**
97:          * @return the position
98:          */
99:         public Position getPosition() {
100:                 return this.position;
101:         }
102:
103:         @Override
104:         public int hashCode() {
105:                 return this.getOptions().hashCode() + this.getPath().hashCode()
106:                                 + this.getValue().hashCode() + this.getPosition().hashCode()
107:                                 + this.getVariableDefinition().hashCode();
108:         }
109:
110:         @Override
111:         public boolean equals(final Object obj) {
112:•                return obj instanceof PackageRule
113:•                                && ((PackageRule) obj).getOptions().equals(this.getOptions())
114:•                                && ((PackageRule) obj).getPath().equals(this.getPath())
115:•                                && ((PackageRule) obj).getPosition().equals(this.getPosition())
116:•                                && ((PackageRule) obj).getValue().equals(this.getValue())
117:•                                && ((PackageRule) obj).getVariableDefinition().equals(
118:                                                 this.getVariableDefinition());
119:         }
120:
121:         @Override
122:         public String toString() {
123:                 return ModelConstants.PACKAGE_RULE + this.getValue() + ScannerConstants.COMMASPACE
124:                                 + this.variableDefinition + ScannerConstants.COMMASPACE + this.getPath()
125:                                 + ScannerConstants.COMMASPACE + this.options + ScannerConstants.COMMASPACE
126:                                 + this.position;
127:         }
128: }