aboutsummaryrefslogtreecommitdiff
path: root/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/HashCodeVisitor.java
blob: 2a12b7f69f96c13733aac890b60391f4f13be601 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
/*
 * Copyright (C) 2007-2010 Júlio Vilmar Gesser.
 * Copyright (C) 2011, 2013-2016 The JavaParser Team.
 *
 * This file is part of JavaParser.
 *
 * JavaParser can be used either under the terms of
 * a) the GNU Lesser General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 * b) the terms of the Apache License
 *
 * You should have received a copy of both licenses in LICENCE.LGPL and
 * LICENCE.APACHE. Please refer to those files for details.
 *
 * JavaParser is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 */
package com.github.javaparser.ast.visitor;

import com.github.javaparser.ast.*;
import com.github.javaparser.ast.body.*;
import com.github.javaparser.ast.comments.BlockComment;
import com.github.javaparser.ast.comments.JavadocComment;
import com.github.javaparser.ast.comments.LineComment;
import com.github.javaparser.ast.expr.*;
import com.github.javaparser.ast.modules.*;
import com.github.javaparser.ast.stmt.*;
import com.github.javaparser.ast.type.*;
import javax.annotation.Generated;

/**
 * A visitor that calculates a deep hash code for a node by using the hash codes of all its properties,
 * and the hash codes of all its child nodes (by visiting those too.)
 */
public class HashCodeVisitor implements GenericVisitor<Integer, Void> {

    private static final HashCodeVisitor SINGLETON = new HashCodeVisitor();

    private HashCodeVisitor() {
    // hide constructor
    }

    public static int hashCode(final Node node) {
        return node.accept(SINGLETON, null);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final AnnotationDeclaration n, final Void arg) {
        return (n.getMembers().accept(this, arg)) * 31 + (n.getModifiers().hashCode()) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final AnnotationMemberDeclaration n, final Void arg) {
        return (n.getDefaultValue().isPresent() ? n.getDefaultValue().get().accept(this, arg) : 0) * 31 + (n.getModifiers().hashCode()) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getType().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final ArrayAccessExpr n, final Void arg) {
        return (n.getIndex().accept(this, arg)) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final ArrayCreationExpr n, final Void arg) {
        return (n.getElementType().accept(this, arg)) * 31 + (n.getInitializer().isPresent() ? n.getInitializer().get().accept(this, arg) : 0) * 31 + (n.getLevels().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final ArrayCreationLevel n, final Void arg) {
        return (n.getAnnotations().accept(this, arg)) * 31 + (n.getDimension().isPresent() ? n.getDimension().get().accept(this, arg) : 0) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final ArrayInitializerExpr n, final Void arg) {
        return (n.getValues().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final ArrayType n, final Void arg) {
        return (n.getComponentType().accept(this, arg)) * 31 + (n.getOrigin().hashCode()) * 31 + (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final AssertStmt n, final Void arg) {
        return (n.getCheck().accept(this, arg)) * 31 + (n.getMessage().isPresent() ? n.getMessage().get().accept(this, arg) : 0) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final AssignExpr n, final Void arg) {
        return (n.getOperator().hashCode()) * 31 + (n.getTarget().accept(this, arg)) * 31 + (n.getValue().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final BinaryExpr n, final Void arg) {
        return (n.getLeft().accept(this, arg)) * 31 + (n.getOperator().hashCode()) * 31 + (n.getRight().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final BlockComment n, final Void arg) {
        return (n.getContent().hashCode()) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final BlockStmt n, final Void arg) {
        return (n.getStatements().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final BooleanLiteralExpr n, final Void arg) {
        return (n.getValue() ? 1 : 0) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final BreakStmt n, final Void arg) {
        return (n.getLabel().isPresent() ? n.getLabel().get().accept(this, arg) : 0) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final CastExpr n, final Void arg) {
        return (n.getExpression().accept(this, arg)) * 31 + (n.getType().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final CatchClause n, final Void arg) {
        return (n.getBody().accept(this, arg)) * 31 + (n.getParameter().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final CharLiteralExpr n, final Void arg) {
        return (n.getValue().hashCode()) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final ClassExpr n, final Void arg) {
        return (n.getType().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final ClassOrInterfaceDeclaration n, final Void arg) {
        return (n.getExtendedTypes().accept(this, arg)) * 31 + (n.getImplementedTypes().accept(this, arg)) * 31 + (n.isInterface() ? 1 : 0) * 31 + (n.getTypeParameters().accept(this, arg)) * 31 + (n.getMembers().accept(this, arg)) * 31 + (n.getModifiers().hashCode()) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final ClassOrInterfaceType n, final Void arg) {
        return (n.getName().accept(this, arg)) * 31 + (n.getScope().isPresent() ? n.getScope().get().accept(this, arg) : 0) * 31 + (n.getTypeArguments().isPresent() ? n.getTypeArguments().get().accept(this, arg) : 0) * 31 + (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final CompilationUnit n, final Void arg) {
        return (n.getImports().accept(this, arg)) * 31 + (n.getModule().isPresent() ? n.getModule().get().accept(this, arg) : 0) * 31 + (n.getPackageDeclaration().isPresent() ? n.getPackageDeclaration().get().accept(this, arg) : 0) * 31 + (n.getTypes().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final ConditionalExpr n, final Void arg) {
        return (n.getCondition().accept(this, arg)) * 31 + (n.getElseExpr().accept(this, arg)) * 31 + (n.getThenExpr().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final ConstructorDeclaration n, final Void arg) {
        return (n.getBody().accept(this, arg)) * 31 + (n.getModifiers().hashCode()) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getParameters().accept(this, arg)) * 31 + (n.getReceiverParameter().isPresent() ? n.getReceiverParameter().get().accept(this, arg) : 0) * 31 + (n.getThrownExceptions().accept(this, arg)) * 31 + (n.getTypeParameters().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final ContinueStmt n, final Void arg) {
        return (n.getLabel().isPresent() ? n.getLabel().get().accept(this, arg) : 0) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final DoStmt n, final Void arg) {
        return (n.getBody().accept(this, arg)) * 31 + (n.getCondition().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final DoubleLiteralExpr n, final Void arg) {
        return (n.getValue().hashCode()) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final EmptyStmt n, final Void arg) {
        return (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final EnclosedExpr n, final Void arg) {
        return (n.getInner().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final EnumConstantDeclaration n, final Void arg) {
        return (n.getArguments().accept(this, arg)) * 31 + (n.getClassBody().accept(this, arg)) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final EnumDeclaration n, final Void arg) {
        return (n.getEntries().accept(this, arg)) * 31 + (n.getImplementedTypes().accept(this, arg)) * 31 + (n.getMembers().accept(this, arg)) * 31 + (n.getModifiers().hashCode()) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final ExplicitConstructorInvocationStmt n, final Void arg) {
        return (n.getArguments().accept(this, arg)) * 31 + (n.getExpression().isPresent() ? n.getExpression().get().accept(this, arg) : 0) * 31 + (n.isThis() ? 1 : 0) * 31 + (n.getTypeArguments().isPresent() ? n.getTypeArguments().get().accept(this, arg) : 0) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final ExpressionStmt n, final Void arg) {
        return (n.getExpression().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final FieldAccessExpr n, final Void arg) {
        return (n.getName().accept(this, arg)) * 31 + (n.getScope().accept(this, arg)) * 31 + (n.getTypeArguments().isPresent() ? n.getTypeArguments().get().accept(this, arg) : 0) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final FieldDeclaration n, final Void arg) {
        return (n.getModifiers().hashCode()) * 31 + (n.getVariables().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final ForStmt n, final Void arg) {
        return (n.getBody().accept(this, arg)) * 31 + (n.getCompare().isPresent() ? n.getCompare().get().accept(this, arg) : 0) * 31 + (n.getInitialization().accept(this, arg)) * 31 + (n.getUpdate().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final ForeachStmt n, final Void arg) {
        return (n.getBody().accept(this, arg)) * 31 + (n.getIterable().accept(this, arg)) * 31 + (n.getVariable().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final IfStmt n, final Void arg) {
        return (n.getCondition().accept(this, arg)) * 31 + (n.getElseStmt().isPresent() ? n.getElseStmt().get().accept(this, arg) : 0) * 31 + (n.getThenStmt().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final ImportDeclaration n, final Void arg) {
        return (n.isAsterisk() ? 1 : 0) * 31 + (n.isStatic() ? 1 : 0) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final InitializerDeclaration n, final Void arg) {
        return (n.getBody().accept(this, arg)) * 31 + (n.isStatic() ? 1 : 0) * 31 + (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final InstanceOfExpr n, final Void arg) {
        return (n.getExpression().accept(this, arg)) * 31 + (n.getType().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final IntegerLiteralExpr n, final Void arg) {
        return (n.getValue().hashCode()) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final IntersectionType n, final Void arg) {
        return (n.getElements().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final JavadocComment n, final Void arg) {
        return (n.getContent().hashCode()) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final LabeledStmt n, final Void arg) {
        return (n.getLabel().accept(this, arg)) * 31 + (n.getStatement().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final LambdaExpr n, final Void arg) {
        return (n.getBody().accept(this, arg)) * 31 + (n.isEnclosingParameters() ? 1 : 0) * 31 + (n.getParameters().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final LineComment n, final Void arg) {
        return (n.getContent().hashCode()) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final LocalClassDeclarationStmt n, final Void arg) {
        return (n.getClassDeclaration().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final LongLiteralExpr n, final Void arg) {
        return (n.getValue().hashCode()) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final MarkerAnnotationExpr n, final Void arg) {
        return (n.getName().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final MemberValuePair n, final Void arg) {
        return (n.getName().accept(this, arg)) * 31 + (n.getValue().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final MethodCallExpr n, final Void arg) {
        return (n.getArguments().accept(this, arg)) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getScope().isPresent() ? n.getScope().get().accept(this, arg) : 0) * 31 + (n.getTypeArguments().isPresent() ? n.getTypeArguments().get().accept(this, arg) : 0) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final MethodDeclaration n, final Void arg) {
        return (n.getBody().isPresent() ? n.getBody().get().accept(this, arg) : 0) * 31 + (n.getType().accept(this, arg)) * 31 + (n.getModifiers().hashCode()) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getParameters().accept(this, arg)) * 31 + (n.getReceiverParameter().isPresent() ? n.getReceiverParameter().get().accept(this, arg) : 0) * 31 + (n.getThrownExceptions().accept(this, arg)) * 31 + (n.getTypeParameters().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final MethodReferenceExpr n, final Void arg) {
        return (n.getIdentifier().hashCode()) * 31 + (n.getScope().accept(this, arg)) * 31 + (n.getTypeArguments().isPresent() ? n.getTypeArguments().get().accept(this, arg) : 0) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final NameExpr n, final Void arg) {
        return (n.getName().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final Name n, final Void arg) {
        return (n.getAnnotations().accept(this, arg)) * 31 + (n.getIdentifier().hashCode()) * 31 + (n.getQualifier().isPresent() ? n.getQualifier().get().accept(this, arg) : 0) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    public Integer visit(NodeList n, Void arg) {
        int result = 0;
        for (Object node : n) {
            result += 31 * ((Visitable) node).accept(this, arg);
        }
        return result;
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final NormalAnnotationExpr n, final Void arg) {
        return (n.getPairs().accept(this, arg)) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final NullLiteralExpr n, final Void arg) {
        return (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final ObjectCreationExpr n, final Void arg) {
        return (n.getAnonymousClassBody().isPresent() ? n.getAnonymousClassBody().get().accept(this, arg) : 0) * 31 + (n.getArguments().accept(this, arg)) * 31 + (n.getScope().isPresent() ? n.getScope().get().accept(this, arg) : 0) * 31 + (n.getType().accept(this, arg)) * 31 + (n.getTypeArguments().isPresent() ? n.getTypeArguments().get().accept(this, arg) : 0) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final PackageDeclaration n, final Void arg) {
        return (n.getAnnotations().accept(this, arg)) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final Parameter n, final Void arg) {
        return (n.getAnnotations().accept(this, arg)) * 31 + (n.isVarArgs() ? 1 : 0) * 31 + (n.getModifiers().hashCode()) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getType().accept(this, arg)) * 31 + (n.getVarArgsAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final PrimitiveType n, final Void arg) {
        return (n.getType().hashCode()) * 31 + (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final ReturnStmt n, final Void arg) {
        return (n.getExpression().isPresent() ? n.getExpression().get().accept(this, arg) : 0) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final SimpleName n, final Void arg) {
        return (n.getIdentifier().hashCode()) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final SingleMemberAnnotationExpr n, final Void arg) {
        return (n.getMemberValue().accept(this, arg)) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final StringLiteralExpr n, final Void arg) {
        return (n.getValue().hashCode()) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final SuperExpr n, final Void arg) {
        return (n.getClassExpr().isPresent() ? n.getClassExpr().get().accept(this, arg) : 0) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final SwitchEntryStmt n, final Void arg) {
        return (n.getLabel().isPresent() ? n.getLabel().get().accept(this, arg) : 0) * 31 + (n.getStatements().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final SwitchStmt n, final Void arg) {
        return (n.getEntries().accept(this, arg)) * 31 + (n.getSelector().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final SynchronizedStmt n, final Void arg) {
        return (n.getBody().accept(this, arg)) * 31 + (n.getExpression().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final ThisExpr n, final Void arg) {
        return (n.getClassExpr().isPresent() ? n.getClassExpr().get().accept(this, arg) : 0) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final ThrowStmt n, final Void arg) {
        return (n.getExpression().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final TryStmt n, final Void arg) {
        return (n.getCatchClauses().accept(this, arg)) * 31 + (n.getFinallyBlock().isPresent() ? n.getFinallyBlock().get().accept(this, arg) : 0) * 31 + (n.getResources().accept(this, arg)) * 31 + (n.getTryBlock().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final TypeExpr n, final Void arg) {
        return (n.getType().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final TypeParameter n, final Void arg) {
        return (n.getName().accept(this, arg)) * 31 + (n.getTypeBound().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final UnaryExpr n, final Void arg) {
        return (n.getExpression().accept(this, arg)) * 31 + (n.getOperator().hashCode()) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final UnionType n, final Void arg) {
        return (n.getElements().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final UnknownType n, final Void arg) {
        return (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final VariableDeclarationExpr n, final Void arg) {
        return (n.getAnnotations().accept(this, arg)) * 31 + (n.getModifiers().hashCode()) * 31 + (n.getVariables().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final VariableDeclarator n, final Void arg) {
        return (n.getInitializer().isPresent() ? n.getInitializer().get().accept(this, arg) : 0) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getType().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final VoidType n, final Void arg) {
        return (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final WhileStmt n, final Void arg) {
        return (n.getBody().accept(this, arg)) * 31 + (n.getCondition().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final WildcardType n, final Void arg) {
        return (n.getExtendedType().isPresent() ? n.getExtendedType().get().accept(this, arg) : 0) * 31 + (n.getSuperType().isPresent() ? n.getSuperType().get().accept(this, arg) : 0) * 31 + (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final ModuleDeclaration n, final Void arg) {
        return (n.getAnnotations().accept(this, arg)) * 31 + (n.isOpen() ? 1 : 0) * 31 + (n.getModuleStmts().accept(this, arg)) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final ModuleRequiresStmt n, final Void arg) {
        return (n.getModifiers().hashCode()) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Override()
    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final ModuleExportsStmt n, final Void arg) {
        return (n.getModuleNames().accept(this, arg)) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Override()
    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final ModuleProvidesStmt n, final Void arg) {
        return (n.getType().accept(this, arg)) * 31 + (n.getWithTypes().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Override()
    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final ModuleUsesStmt n, final Void arg) {
        return (n.getType().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Override
    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final ModuleOpensStmt n, final Void arg) {
        return (n.getModuleNames().accept(this, arg)) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Override
    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final UnparsableStmt n, final Void arg) {
        return (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }

    @Override
    @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
    public Integer visit(final ReceiverParameter n, final Void arg) {
        return (n.getAnnotations().accept(this, arg)) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getType().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
    }
}