Skip to content

Method: createAlreadyAddedConstant(String)

1: package de.fhdw.wtf.common.constants.parser;
2:
3: /**
4: * Contains exception messages for parser.
5: */
6: public final class ExceptionConstants {
7:         
8:         /**
9:          * The provided token does not match the GroupElement definition.
10:          */
11:         public static final String NO_GROUP_ELEMENT_EXCEPTION_MESSAGE = createNotMatchConstant("GroupElement");
12:         
13:         /**
14:          * The provided token does not match the Group definition.
15:          */
16:         public static final String NO_GROUP_EXCEPTION_MESSAGE = createNotMatchConstant("Group");
17:         
18:         /**
19:          * The provided token does not match the Identifier definition.
20:          */
21:         public static final String NO_IDENTIFIER_EXCEPTION_MESSAGE = createNotMatchConstant("Identifier");
22:         
23:         /**
24:          * The provided token is an invalid token.
25:          */
26:         public static final String INVALID_TOKEN_EXCEPTION_MESSAGE = "The provided token is an invalid token: ";
27:         
28:         /**
29:          * The given ClassModifier already added.
30:          */
31:         public static final String CLASS_MODIFIER_ALREADY_ADDED_EXCEPTION = createAlreadyAddedConstant("ClassModifier");
32:         
33:         /**
34:          * The given AttributeModifier already added.
35:          */
36:         public static final String ATTRIBUTE_MODIFIER_ALREADY_ADDED_EXCEPTION =
37:                         createAlreadyAddedConstant("AttributeModifier");
38:         
39:         /**
40:          * The given OperationModifier already added.
41:          */
42:         public static final String OPERATION_MODIFIER_ALREADY_ADDED_EXCEPTION =
43:                         createAlreadyAddedConstant("OperationModifier");
44:         
45:         /**
46:          * Expected '-', found.
47:          */
48:         public static final String NO_HYPHEN_EXCEPTION_MESSAGE = "Expected '-', found: ";
49:         
50:         /**
51:          * Expected '->', found.
52:          */
53:         public static final String NO_ARROW_EXCEPTION_MESSAGE = "Expected '->', found: ";
54:         
55:         /**
56:          * Expected '{', found.
57:          */
58:         public static final String NO_BRACELEFT_EXCEPTION_MESSAGE = "Expected '{', found: ";
59:         
60:         /**
61:          * Expected '}', found.
62:          */
63:         public static final String NO_BRACERIGHT_EXCEPTION_MESSAGE = "Expected '}', found: ";
64:         
65:         /**
66:          * Expected '*', found.
67:          */
68:         public static final String NO_ASTERISK_EXCEPTION_MESSAGE = "Expected '*', found: ";
69:         
70:         /**
71:          * Expected ';', found.
72:          */
73:         public static final String NO_SEMICOLON_EXCEPTION_MESSAGE = "Expected ';', found: ";
74:         
75:         /**
76:          * Expected '+', found.
77:          */
78:         public static final String NO_PLUS_SYMBOL_EXCEPTION_MESSAGE = "Expected '+', found: ";
79:         
80:         /**
81:          * Expected ':', found.
82:          */
83:         public static final String NO_COLON_EXCEPTION_MESSAGE = "Expected ':', found: ";
84:         
85:         /**
86:          * Expected '=', found.
87:          */
88:         public static final String NO_EQUAL_EXCEPTION_MESSAGE = "Expected '=', found: ";
89:         
90:         /**
91:          * Expected '[', found.
92:          */
93:         public static final String NO_SQUARE_BRACKET_OPEN_EXCEPTION_MESSAGE = "Expected '[', found: ";
94:         
95:         /**
96:          * Expected ']', found.
97:          */
98:         public static final String NO_SQUARE_BRACKET_CLOSE_EXCEPTION_MESSAGE = "Expected ']', found: ";
99:         
100:         /**
101:          * Expected ']]', found.
102:          */
103:         public static final String NO_DOUBLE_SQUARE_BRACKET_CLOSE_EXCEPTION_MESSAGE = "Expected ']]', found: ";
104:         
105:         /**
106:          * The provided token does not match the class modifier definition.
107:          */
108:         public static final String NO_CLASS_MODIFIER_EXCEPTION_MESSAGE = createNotMatchConstant("class modifier");
109:         
110:         /**
111:          * The provided token does not match the attribute modifier definition.
112:          */
113:         public static final String NO_ATTRIBUTE_MODIFIER_EXCEPTION_MESSAGE = createNotMatchConstant("attribute modifier");
114:         
115:         /**
116:          * Reached unexpected the end of the stream.
117:          */
118:         public static final String SKIP_REACHED_END_TOKEN_EXCEPTION_MESSAGE = "Reached unexpected the end of the stream.";
119:         
120:         /**
121:          * Expected '(', found.
122:          */
123:         public static final String NO_BRACKET_OPEN_EXCEPTION_MESSAGE = "Expected '(', found: ";
124:         
125:         /**
126:          * Expected ')', found.
127:          */
128:         public static final String NO_BRACKET_CLOSE_EXCEPTION_MESSAGE = "Expected ')', found: ";
129:         
130:         /**
131:          * Expected '|', found.
132:          */
133:         public static final String NO_PIPE_SYMBOL_EXCEPTION_MESSAGE = "Expected '|', found: ";
134:         
135:         /**
136:          * Expected TypeOccurrence, found nothing.
137:          */
138:         public static final String NO_PRODUCT_OR_SUM_EXCEPTION_MESSAGE = "Expected TypeOccurrence, found nothing.";
139:         
140:         /**
141:          * Expected '|' or '+', found.
142:          */
143:         public static final String NO_PLUS_OR_PIPE_EXCEPTION_MESSAGE = "Expected '|' or '+', found: ";
144:         
145:         /**
146:          * Expected ',', found.
147:          */
148:         public static final String NO_COMMA_TOKEN_EXCEPTION_MESSAGE = "Expected ',', found: ";
149:         
150:         /**
151:          * Expected '?', found.
152:          */
153:         public static final String NO_QUESTIONMARK_TOKEN_EXCEPTION = "Expected '?', found: ";
154:         
155:         /**
156:          * The provided token does not match the operation modifier definition.
157:          */
158:         public static final String NO_OPERATION_MODIFIER_EXCEPTION_MESSAGE = createNotMatchConstant("operation modifier");
159:         
160:         /**
161:          * Expected Type, found.
162:          */
163:         public static final String NO_TYPE_EXCEPTION_MESSAGE = "Expected Type, found: ";
164:         
165:         /**
166:          * The parser found exceptions in the given token stream.
167:          */
168:         public static final String NO_VALID_TOKEN_STREAM_EXCEPTION_MESSAGE = "The parser found exceptions"
169:                         + " in the given token stream.";
170:         
171:         /**
172:          * The Sum contains Anything, so it is standardized Anything.
173:          *
174:          */
175:         public static final String SUM_IS_ANYTHING_MESSAGE = "The Sum contains Anything, so it is standardized Anything.";
176:         
177:         /**
178:          * Contains exception messages for parser.
179:          */
180:         private ExceptionConstants() {
181:         }
182:         
183:         /**
184:          * The provided token does not match the x definition: .
185:          *
186:          * @param x
187:          * Fill the gap
188:          * @return Constant
189:          */
190:         private static String createNotMatchConstant(final String x) {
191:                 return "The provided token does not match the " + x + " definition: ";
192:         }
193:         
194:         /**
195:          * The given x already added: .
196:          *
197:          * @param x
198:          * Fill the gap
199:          * @return Constant
200:          */
201:         private static String createAlreadyAddedConstant(final String x) {
202:                 return "The given " + x + " already added: ";
203:         }
204:         
205: }