Skip to content

Method: create(Token)

1: package de.fhdw.wtf.common.ast;
2:
3: import de.fhdw.wtf.common.ast.visitor.AttributModifierVisitor;
4: import de.fhdw.wtf.common.ast.visitor.AttributeModifierVisitorReturn;
5: import de.fhdw.wtf.common.ast.visitor.AttributeModifierVisitorReturnException;
6: import de.fhdw.wtf.common.token.Token;
7:
8: /**
9: * A concrete {@link AttributeModifier}. An {@link Attribute} with this modifier will be generated as <code>final</code>
10: * .
11: */
12: public final class AttributeModifierPrior extends AttributeModifier {
13:         
14:         /**
15:          * generated.
16:          */
17:         private static final long serialVersionUID = 2261377073630110594L;
18:         
19:         /**
20:          * Constant to define hashCode().
21:          */
22:         private static final int HASHCODE_CONSTANT = 39023;
23:         
24:         /**
25:          * Private Constructor of {@link AttributeModifierPrior}.
26:          *
27:          * @param firstToken
28:          * firstToken
29:          * @param lastToken
30:          * lastToken
31:          */
32:         private AttributeModifierPrior(final Token firstToken, final Token lastToken) {
33:                 super(firstToken, lastToken);
34:                 
35:         }
36:         
37:         /**
38:          * Creates a {@link AttributeModifierPrior}-Object.
39:          *
40:          * @param firstToken
41:          * firstToken
42:          * @param lastToken
43:          * lastToken
44:          * @return The AttributeModifierPrior-Object.
45:          */
46:         public static AttributeModifierPrior create(final Token firstToken, final Token lastToken) {
47:                 return new AttributeModifierPrior(firstToken, lastToken);
48:         }
49:         
50:         /**
51:          * Creates a {@link AttributeModifierPrior}-Object.
52:          *
53:          * @param firstToken
54:          * firstToken
55:          * @return The AttributeModifierPrior-Object.
56:          */
57:         public static AttributeModifierPrior create(final Token firstToken) {
58:                 return new AttributeModifierPrior(firstToken, null);
59:         }
60:         
61:         @Override
62:         public boolean equals(final Object o) {
63:                 return o instanceof AttributeModifierPrior;
64:         }
65:         
66:         @Override
67:         public int hashCode() {
68:                 return HASHCODE_CONSTANT;
69:         }
70:         
71:         @Override
72:         public String toString() {
73:                 return de.fhdw.wtf.common.constants.parser.AstDescriptionConstants.MODIFIER_PRIOR;
74:         }
75:         
76:         @Override
77:         public boolean accept(final AttributModifierVisitor visitor) {
78:                 return visitor.handle(this);
79:         }
80:         
81:         @Override
82:         public <X> X accept(final AttributeModifierVisitorReturn<X> visitor) {
83:                 return visitor.handle(this);
84:         }
85:         
86:         @Override
87:         public <X, Y extends Exception> X accept(final AttributeModifierVisitorReturnException<X, Y> visitor) throws Y {
88:                 return visitor.handle(this);
89:         }
90:         
91: }