Skip to content

Package: IdentifierSymbol

IdentifierSymbol

nameinstructionbranchcomplexitylinemethod
IdentifierSymbol(String, Position)
M: 0 C: 7
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
equals(Object)
M: 0 C: 18
100%
M: 0 C: 6
100%
M: 0 C: 4
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
getText()
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: 7
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
toString()
M: 0 C: 13
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: package symbols;
2:
3: import model.Position;
4: import scanner.ScannerConstants;
5:
6: /**
7: *
8: * This class represents the Identifier Symbol.
9: *
10: */
11: public final class IdentifierSymbol extends AbstractSymbol {
12:         /**
13:          * This is the text of the Identifier.
14:          */
15:         private final transient String text;
16:
17:         /**
18:          * The constructor instantiate the identifier with a @param text.
19:          *
20:          * @param text
21:          * is the text of the identifier.
22:          * @param position
23:          * is the position of the data in the stream.
24:          */
25:         public IdentifierSymbol(final String text, final Position position) {
26:                 super(position);
27:                 this.text = text;
28:         }
29:
30:         /**
31:          *
32:          * @return the text of the identifier.
33:          */
34:         public String getText() {
35:                 return this.text;
36:         }
37:
38:         @Override
39:         public String toString() {
40:                 return ScannerConstants.IDENTIFIER + this.text + this.getPosition();
41:         }
42:
43:         @Override
44:         public boolean equals(final Object obj) {
45:•                return super.equals(obj) && obj instanceof IdentifierSymbol
46:•                                && ((IdentifierSymbol) obj).getText().equals(this.getText());
47:         }
48:
49:         @Override
50:         public int hashCode() {
51:                 return super.hashCode() + this.text.hashCode();
52:         }
53:
54: }