JavaParser Source Viewer

Home|JavaParser/com/github/javaparser/ast/visitor/HashCodeVisitor.java
1/*
2 * Copyright (C) 2007-2010 JĂșlio Vilmar Gesser.
3 * Copyright (C) 2011, 2013-2020 The JavaParser Team.
4 *
5 * This file is part of JavaParser.
6 *
7 * JavaParser can be used either under the terms of
8 * a) the GNU Lesser General Public License as published by
9 *     the Free Software Foundation, either version 3 of the License, or
10 *     (at your option) any later version.
11 * b) the terms of the Apache License
12 *
13 * You should have received a copy of both licenses in LICENCE.LGPL and
14 * LICENCE.APACHE. Please refer to those files for details.
15 *
16 * JavaParser is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 * GNU Lesser General Public License for more details.
20 */
21package com.github.javaparser.ast.visitor;
22
23import com.github.javaparser.ast.*;
24import com.github.javaparser.ast.body.*;
25import com.github.javaparser.ast.comments.BlockComment;
26import com.github.javaparser.ast.comments.JavadocComment;
27import com.github.javaparser.ast.comments.LineComment;
28import com.github.javaparser.ast.expr.*;
29import com.github.javaparser.ast.modules.*;
30import com.github.javaparser.ast.stmt.*;
31import com.github.javaparser.ast.type.*;
32
33/**
34 * A visitor that calculates a deep hash code for a node by using the hash codes of all its properties,
35 * and the hash codes of all its child nodes (by visiting those too.)
36 */
37public class HashCodeVisitor implements GenericVisitor<IntegerVoid> {
38
39    private static final HashCodeVisitor SINGLETON = new HashCodeVisitor();
40
41    private HashCodeVisitor() {
42    // hide constructor
43    }
44
45    public static int hashCode(final Node node) {
46        return node.accept(SINGLETONnull);
47    }
48
49    public Integer visit(final AnnotationDeclaration nfinal Void arg) {
50        return (n.getMembers().accept(this, arg)) * 31 + (n.getModifiers().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);
51    }
52
53    public Integer visit(final AnnotationMemberDeclaration nfinal Void arg) {
54        return (n.getDefaultValue().isPresent() ? n.getDefaultValue().get().accept(this, arg) : 0) * 31 + (n.getModifiers().accept(this, arg)) * 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);
55    }
56
57    public Integer visit(final ArrayAccessExpr nfinal Void arg) {
58        return (n.getIndex().accept(this, arg)) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
59    }
60
61    public Integer visit(final ArrayCreationExpr nfinal Void arg) {
62        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);
63    }
64
65    public Integer visit(final ArrayCreationLevel nfinal Void arg) {
66        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);
67    }
68
69    public Integer visit(final ArrayInitializerExpr nfinal Void arg) {
70        return (n.getValues().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
71    }
72
73    public Integer visit(final ArrayType nfinal Void arg) {
74        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);
75    }
76
77    public Integer visit(final AssertStmt nfinal Void arg) {
78        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);
79    }
80
81    public Integer visit(final AssignExpr nfinal Void arg) {
82        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);
83    }
84
85    public Integer visit(final BinaryExpr nfinal Void arg) {
86        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);
87    }
88
89    public Integer visit(final BlockComment nfinal Void arg) {
90        return (n.getContent().hashCode()) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
91    }
92
93    public Integer visit(final BlockStmt nfinal Void arg) {
94        return (n.getStatements().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
95    }
96
97    public Integer visit(final BooleanLiteralExpr nfinal Void arg) {
98        return (n.isValue() ? 1 : 0) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
99    }
100
101    public Integer visit(final BreakStmt nfinal Void arg) {
102        return (n.getLabel().isPresent() ? n.getLabel().get().accept(this, arg) : 0) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
103    }
104
105    public Integer visit(final CastExpr nfinal Void arg) {
106        return (n.getExpression().accept(this, arg)) * 31 + (n.getType().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
107    }
108
109    public Integer visit(final CatchClause nfinal Void arg) {
110        return (n.getBody().accept(this, arg)) * 31 + (n.getParameter().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
111    }
112
113    public Integer visit(final CharLiteralExpr nfinal Void arg) {
114        return (n.getValue().hashCode()) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
115    }
116
117    public Integer visit(final ClassExpr nfinal Void arg) {
118        return (n.getType().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
119    }
120
121    public Integer visit(final ClassOrInterfaceDeclaration nfinal Void arg) {
122        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().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);
123    }
124
125    public Integer visit(final ClassOrInterfaceType nfinal Void arg) {
126        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);
127    }
128
129    public Integer visit(final CompilationUnit nfinal Void arg) {
130        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);
131    }
132
133    public Integer visit(final ConditionalExpr nfinal Void arg) {
134        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);
135    }
136
137    public Integer visit(final ConstructorDeclaration nfinal Void arg) {
138        return (n.getBody().accept(this, arg)) * 31 + (n.getModifiers().accept(this, arg)) * 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);
139    }
140
141    public Integer visit(final ContinueStmt nfinal Void arg) {
142        return (n.getLabel().isPresent() ? n.getLabel().get().accept(this, arg) : 0) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
143    }
144
145    public Integer visit(final DoStmt nfinal Void arg) {
146        return (n.getBody().accept(this, arg)) * 31 + (n.getCondition().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
147    }
148
149    public Integer visit(final DoubleLiteralExpr nfinal Void arg) {
150        return (n.getValue().hashCode()) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
151    }
152
153    public Integer visit(final EmptyStmt nfinal Void arg) {
154        return (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
155    }
156
157    public Integer visit(final EnclosedExpr nfinal Void arg) {
158        return (n.getInner().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
159    }
160
161    public Integer visit(final EnumConstantDeclaration nfinal Void arg) {
162        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);
163    }
164
165    public Integer visit(final EnumDeclaration nfinal Void arg) {
166        return (n.getEntries().accept(this, arg)) * 31 + (n.getImplementedTypes().accept(this, arg)) * 31 + (n.getMembers().accept(this, arg)) * 31 + (n.getModifiers().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);
167    }
168
169    public Integer visit(final ExplicitConstructorInvocationStmt nfinal Void arg) {
170        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);
171    }
172
173    public Integer visit(final ExpressionStmt nfinal Void arg) {
174        return (n.getExpression().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
175    }
176
177    public Integer visit(final FieldAccessExpr nfinal Void arg) {
178        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);
179    }
180
181    public Integer visit(final FieldDeclaration nfinal Void arg) {
182        return (n.getModifiers().accept(this, arg)) * 31 + (n.getVariables().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
183    }
184
185    public Integer visit(final ForStmt nfinal Void arg) {
186        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);
187    }
188
189    public Integer visit(final ForEachStmt nfinal Void arg) {
190        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);
191    }
192
193    public Integer visit(final IfStmt nfinal Void arg) {
194        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);
195    }
196
197    public Integer visit(final ImportDeclaration nfinal Void arg) {
198        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);
199    }
200
201    public Integer visit(final InitializerDeclaration nfinal Void arg) {
202        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);
203    }
204
205    public Integer visit(final InstanceOfExpr nfinal Void arg) {
206        return (n.getExpression().accept(this, arg)) * 31 + (n.getType().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
207    }
208
209    public Integer visit(final IntegerLiteralExpr nfinal Void arg) {
210        return (n.getValue().hashCode()) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
211    }
212
213    public Integer visit(final IntersectionType nfinal Void arg) {
214        return (n.getElements().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
215    }
216
217    public Integer visit(final JavadocComment nfinal Void arg) {
218        return (n.getContent().hashCode()) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
219    }
220
221    public Integer visit(final LabeledStmt nfinal Void arg) {
222        return (n.getLabel().accept(this, arg)) * 31 + (n.getStatement().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
223    }
224
225    public Integer visit(final LambdaExpr nfinal Void arg) {
226        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);
227    }
228
229    public Integer visit(final LineComment nfinal Void arg) {
230        return (n.getContent().hashCode()) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
231    }
232
233    public Integer visit(final LocalClassDeclarationStmt nfinal Void arg) {
234        return (n.getClassDeclaration().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
235    }
236
237    public Integer visit(final LongLiteralExpr nfinal Void arg) {
238        return (n.getValue().hashCode()) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
239    }
240
241    public Integer visit(final MarkerAnnotationExpr nfinal Void arg) {
242        return (n.getName().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
243    }
244
245    public Integer visit(final MemberValuePair nfinal Void arg) {
246        return (n.getName().accept(this, arg)) * 31 + (n.getValue().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
247    }
248
249    public Integer visit(final MethodCallExpr nfinal Void arg) {
250        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);
251    }
252
253    public Integer visit(final MethodDeclaration nfinal Void arg) {
254        return (n.getBody().isPresent() ? n.getBody().get().accept(this, arg) : 0) * 31 + (n.getType().accept(this, arg)) * 31 + (n.getModifiers().accept(this, arg)) * 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);
255    }
256
257    public Integer visit(final MethodReferenceExpr nfinal Void arg) {
258        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);
259    }
260
261    public Integer visit(final NameExpr nfinal Void arg) {
262        return (n.getName().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
263    }
264
265    public Integer visit(final Name nfinal Void arg) {
266        return (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);
267    }
268
269    public Integer visit(NodeList nVoid arg) {
270        int result = 0;
271        for (Object node : n) {
272            result += 31 * ((Visitablenode).accept(this, arg);
273        }
274        return result;
275    }
276
277    public Integer visit(final NormalAnnotationExpr nfinal Void arg) {
278        return (n.getPairs().accept(this, arg)) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
279    }
280
281    public Integer visit(final NullLiteralExpr nfinal Void arg) {
282        return (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
283    }
284
285    public Integer visit(final ObjectCreationExpr nfinal Void arg) {
286        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);
287    }
288
289    public Integer visit(final PackageDeclaration nfinal Void arg) {
290        return (n.getAnnotations().accept(this, arg)) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
291    }
292
293    public Integer visit(final Parameter nfinal Void arg) {
294        return (n.getAnnotations().accept(this, arg)) * 31 + (n.isVarArgs() ? 1 : 0) * 31 + (n.getModifiers().accept(this, arg)) * 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);
295    }
296
297    public Integer visit(final PrimitiveType nfinal Void arg) {
298        return (n.getType().hashCode()) * 31 + (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
299    }
300
301    public Integer visit(final ReturnStmt nfinal Void arg) {
302        return (n.getExpression().isPresent() ? n.getExpression().get().accept(this, arg) : 0) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
303    }
304
305    public Integer visit(final SimpleName nfinal Void arg) {
306        return (n.getIdentifier().hashCode()) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
307    }
308
309    public Integer visit(final SingleMemberAnnotationExpr nfinal Void arg) {
310        return (n.getMemberValue().accept(this, arg)) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
311    }
312
313    public Integer visit(final StringLiteralExpr nfinal Void arg) {
314        return (n.getValue().hashCode()) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
315    }
316
317    public Integer visit(final SuperExpr nfinal Void arg) {
318        return (n.getTypeName().isPresent() ? n.getTypeName().get().accept(this, arg) : 0) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
319    }
320
321    public Integer visit(final SwitchEntry nfinal Void arg) {
322        return (n.getLabels().accept(this, arg)) * 31 + (n.getStatements().accept(this, arg)) * 31 + (n.getType().hashCode()) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
323    }
324
325    public Integer visit(final SwitchStmt nfinal Void arg) {
326        return (n.getEntries().accept(this, arg)) * 31 + (n.getSelector().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
327    }
328
329    public Integer visit(final SynchronizedStmt nfinal Void arg) {
330        return (n.getBody().accept(this, arg)) * 31 + (n.getExpression().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
331    }
332
333    public Integer visit(final ThisExpr nfinal Void arg) {
334        return (n.getTypeName().isPresent() ? n.getTypeName().get().accept(this, arg) : 0) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
335    }
336
337    public Integer visit(final ThrowStmt nfinal Void arg) {
338        return (n.getExpression().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
339    }
340
341    public Integer visit(final TryStmt nfinal Void arg) {
342        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);
343    }
344
345    public Integer visit(final TypeExpr nfinal Void arg) {
346        return (n.getType().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
347    }
348
349    public Integer visit(final TypeParameter nfinal Void arg) {
350        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);
351    }
352
353    public Integer visit(final UnaryExpr nfinal Void arg) {
354        return (n.getExpression().accept(this, arg)) * 31 + (n.getOperator().hashCode()) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
355    }
356
357    public Integer visit(final UnionType nfinal Void arg) {
358        return (n.getElements().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
359    }
360
361    public Integer visit(final UnknownType nfinal Void arg) {
362        return (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
363    }
364
365    public Integer visit(final VariableDeclarationExpr nfinal Void arg) {
366        return (n.getAnnotations().accept(this, arg)) * 31 + (n.getModifiers().accept(this, arg)) * 31 + (n.getVariables().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
367    }
368
369    public Integer visit(final VariableDeclarator nfinal Void arg) {
370        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);
371    }
372
373    public Integer visit(final VoidType nfinal Void arg) {
374        return (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
375    }
376
377    public Integer visit(final WhileStmt nfinal Void arg) {
378        return (n.getBody().accept(this, arg)) * 31 + (n.getCondition().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
379    }
380
381    public Integer visit(final WildcardType nfinal Void arg) {
382        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);
383    }
384
385    public Integer visit(final ModuleDeclaration nfinal Void arg) {
386        return (n.getAnnotations().accept(this, arg)) * 31 + (n.getDirectives().accept(this, arg)) * 31 + (n.isOpen() ? 1 : 0) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
387    }
388
389    public Integer visit(final ModuleRequiresDirective nfinal Void arg) {
390        return (n.getModifiers().accept(this, arg)) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
391    }
392
393    @Override()
394    public Integer visit(final ModuleExportsDirective nfinal Void arg) {
395        return (n.getModuleNames().accept(this, arg)) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
396    }
397
398    @Override()
399    public Integer visit(final ModuleProvidesDirective nfinal Void arg) {
400        return (n.getName().accept(this, arg)) * 31 + (n.getWith().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
401    }
402
403    @Override()
404    public Integer visit(final ModuleUsesDirective nfinal Void arg) {
405        return (n.getName().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
406    }
407
408    @Override
409    public Integer visit(final ModuleOpensDirective nfinal Void arg) {
410        return (n.getModuleNames().accept(this, arg)) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
411    }
412
413    @Override
414    public Integer visit(final UnparsableStmt nfinal Void arg) {
415        return (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
416    }
417
418    @Override
419    public Integer visit(final ReceiverParameter nfinal Void arg) {
420        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);
421    }
422
423    @Override
424    public Integer visit(final VarType nfinal Void arg) {
425        return (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
426    }
427
428    @Override
429    public Integer visit(final Modifier nfinal Void arg) {
430        return (n.getKeyword().hashCode()) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
431    }
432
433    @Override
434    public Integer visit(final SwitchExpr nfinal Void arg) {
435        return (n.getEntries().accept(this, arg)) * 31 + (n.getSelector().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
436    }
437
438    @Override
439    public Integer visit(final YieldStmt nfinal Void arg) {
440        return (n.getExpression().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
441    }
442
443    @Override
444    public Integer visit(final TextBlockLiteralExpr nfinal Void arg) {
445        return (n.getValue().hashCode()) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
446    }
447}
448
MembersX
HashCodeVisitor:HashCodeVisitor
HashCodeVisitor:SINGLETON
HashCodeVisitor:visit
HashCodeVisitor:hashCode
HashCodeVisitor:visit:Block:result
Members
X