Skip to content

Method: isCommaToken()

1: package de.fhdw.wtf.common.token.symbols;
2:
3: import de.fhdw.wtf.common.token.Position;
4: import de.fhdw.wtf.common.token.Token;
5:
6: /**
7: * Represents the comma ',' symbol as a token.
8: */
9: public final class CommaToken extends SymbolToken {
10:         
11:         /**
12:          * generated.
13:          */
14:         private static final long serialVersionUID = -2882344445175813355L;
15:         
16:         /**
17:          * Defines constant for hashCodeTemplate().
18:          */
19:         private static final int HASHCODE_TEMPLATE_CONSTANT = 127612;
20:         
21:         /**
22:          * Private constructor for {@link CommaToken}. Use create(...)-Factory instead!
23:          *
24:          * @param position
25:          * represents the start position of the symbol ',' in the original input.
26:          */
27:         private CommaToken(final Position position) {
28:                 super(position, SymbolConstants.COMMA);
29:         }
30:         
31:         /**
32:          * Factory method for {@link CommaToken}.
33:          *
34:          * @param position
35:          * represents the start position of this {@link SymbolToken} in the original input.
36:          * @return a new instance of this {@link SymbolToken}.
37:          */
38:         public static CommaToken create(final Position position) {
39:                 return new CommaToken(position);
40:         }
41:         
42:         @Override
43:         protected boolean equalsTemplate(final Token t) {
44:                 return t.isCommaToken();
45:         }
46:         
47:         @Override
48:         public String stringRepresentation() {
49:                 return SymbolConstants.COMMA;
50:         }
51:         
52:         @Override
53:         public boolean isCommaToken() {
54:                 return true;
55:         }
56:         
57:         @Override
58:         protected int hashCodeTemplate() {
59:                 return HASHCODE_TEMPLATE_CONSTANT;
60:         }
61:         
62: }