| 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 | */ |
| 21 | package com.github.javaparser.ast.visitor; |
| 22 | |
| 23 | import com.github.javaparser.ast.*; |
| 24 | import com.github.javaparser.ast.body.*; |
| 25 | import com.github.javaparser.ast.comments.BlockComment; |
| 26 | import com.github.javaparser.ast.comments.JavadocComment; |
| 27 | import com.github.javaparser.ast.comments.LineComment; |
| 28 | import com.github.javaparser.ast.expr.*; |
| 29 | import com.github.javaparser.ast.modules.*; |
| 30 | import com.github.javaparser.ast.stmt.*; |
| 31 | import com.github.javaparser.ast.type.*; |
| 32 | import java.util.List; |
| 33 | import java.util.Optional; |
| 34 | |
| 35 | /** |
| 36 | * A visitor that calculates deep node equality by comparing all properties and child nodes of the node. |
| 37 | * |
| 38 | * @author Julio Vilmar Gesser |
| 39 | */ |
| 40 | public class EqualsVisitor implements GenericVisitor<Boolean, Visitable> { |
| 41 | |
| 42 | private static final EqualsVisitor SINGLETON = new EqualsVisitor(); |
| 43 | |
| 44 | public static boolean equals(final Node n, final Node n2) { |
| 45 | return SINGLETON.nodeEquals(n, n2); |
| 46 | } |
| 47 | |
| 48 | private EqualsVisitor() { |
| 49 | // hide constructor |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Check for equality that can be applied to each kind of node, |
| 54 | * to not repeat it in every method we store that here. |
| 55 | */ |
| 56 | private boolean commonNodeEquality(Node n, Node n2) { |
| 57 | if (!nodeEquals(n.getComment(), n2.getComment())) { |
| 58 | return false; |
| 59 | } |
| 60 | return nodesEquals(n.getOrphanComments(), n2.getOrphanComments()); |
| 61 | } |
| 62 | |
| 63 | private <T extends Node> boolean nodesEquals(final List<T> nodes1, final List<T> nodes2) { |
| 64 | if (nodes1 == null) { |
| 65 | return nodes2 == null; |
| 66 | } else if (nodes2 == null) { |
| 67 | return false; |
| 68 | } |
| 69 | if (nodes1.size() != nodes2.size()) { |
| 70 | return false; |
| 71 | } |
| 72 | for (int i = 0; i < nodes1.size(); i++) { |
| 73 | if (!nodeEquals(nodes1.get(i), nodes2.get(i))) { |
| 74 | return false; |
| 75 | } |
| 76 | } |
| 77 | return true; |
| 78 | } |
| 79 | |
| 80 | private <N extends Node> boolean nodesEquals(NodeList<N> n, NodeList<N> n2) { |
| 81 | if (n == n2) { |
| 82 | return true; |
| 83 | } |
| 84 | if (n == null || n2 == null) { |
| 85 | return false; |
| 86 | } |
| 87 | if (n.size() != n2.size()) { |
| 88 | return false; |
| 89 | } |
| 90 | for (int i = 0; i < n.size(); i++) { |
| 91 | if (!nodeEquals(n.get(i), n2.get(i))) { |
| 92 | return false; |
| 93 | } |
| 94 | } |
| 95 | return true; |
| 96 | } |
| 97 | |
| 98 | private <T extends Node> boolean nodeEquals(final T n, final T n2) { |
| 99 | if (n == n2) { |
| 100 | return true; |
| 101 | } |
| 102 | if (n == null || n2 == null) { |
| 103 | return false; |
| 104 | } |
| 105 | if (n.getClass() != n2.getClass()) { |
| 106 | return false; |
| 107 | } |
| 108 | if (!commonNodeEquality(n, n2)) { |
| 109 | return false; |
| 110 | } |
| 111 | return n.accept(this, n2); |
| 112 | } |
| 113 | |
| 114 | private <T extends Node> boolean nodeEquals(final Optional<T> n, final Optional<T> n2) { |
| 115 | return nodeEquals(n.orElse(null), n2.orElse(null)); |
| 116 | } |
| 117 | |
| 118 | private <T extends Node> boolean nodesEquals(final Optional<NodeList<T>> n, final Optional<NodeList<T>> n2) { |
| 119 | return nodesEquals(n.orElse(null), n2.orElse(null)); |
| 120 | } |
| 121 | |
| 122 | private boolean objEquals(final Object n, final Object n2) { |
| 123 | if (n == n2) { |
| 124 | return true; |
| 125 | } |
| 126 | if (n == null || n2 == null) { |
| 127 | return false; |
| 128 | } |
| 129 | return n.equals(n2); |
| 130 | } |
| 131 | |
| 132 | @Override |
| 133 | public Boolean visit(final CompilationUnit n, final Visitable arg) { |
| 134 | final CompilationUnit n2 = (CompilationUnit) arg; |
| 135 | if (!nodesEquals(n.getImports(), n2.getImports())) |
| 136 | return false; |
| 137 | if (!nodeEquals(n.getModule(), n2.getModule())) |
| 138 | return false; |
| 139 | if (!nodeEquals(n.getPackageDeclaration(), n2.getPackageDeclaration())) |
| 140 | return false; |
| 141 | if (!nodesEquals(n.getTypes(), n2.getTypes())) |
| 142 | return false; |
| 143 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 144 | return false; |
| 145 | return true; |
| 146 | } |
| 147 | |
| 148 | @Override |
| 149 | public Boolean visit(final PackageDeclaration n, final Visitable arg) { |
| 150 | final PackageDeclaration n2 = (PackageDeclaration) arg; |
| 151 | if (!nodesEquals(n.getAnnotations(), n2.getAnnotations())) |
| 152 | return false; |
| 153 | if (!nodeEquals(n.getName(), n2.getName())) |
| 154 | return false; |
| 155 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 156 | return false; |
| 157 | return true; |
| 158 | } |
| 159 | |
| 160 | @Override |
| 161 | public Boolean visit(final TypeParameter n, final Visitable arg) { |
| 162 | final TypeParameter n2 = (TypeParameter) arg; |
| 163 | if (!nodeEquals(n.getName(), n2.getName())) |
| 164 | return false; |
| 165 | if (!nodesEquals(n.getTypeBound(), n2.getTypeBound())) |
| 166 | return false; |
| 167 | if (!nodesEquals(n.getAnnotations(), n2.getAnnotations())) |
| 168 | return false; |
| 169 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 170 | return false; |
| 171 | return true; |
| 172 | } |
| 173 | |
| 174 | @Override |
| 175 | public Boolean visit(final LineComment n, final Visitable arg) { |
| 176 | final LineComment n2 = (LineComment) arg; |
| 177 | if (!objEquals(n.getContent(), n2.getContent())) |
| 178 | return false; |
| 179 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 180 | return false; |
| 181 | return true; |
| 182 | } |
| 183 | |
| 184 | @Override |
| 185 | public Boolean visit(final BlockComment n, final Visitable arg) { |
| 186 | final BlockComment n2 = (BlockComment) arg; |
| 187 | if (!objEquals(n.getContent(), n2.getContent())) |
| 188 | return false; |
| 189 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 190 | return false; |
| 191 | return true; |
| 192 | } |
| 193 | |
| 194 | @Override |
| 195 | public Boolean visit(final ClassOrInterfaceDeclaration n, final Visitable arg) { |
| 196 | final ClassOrInterfaceDeclaration n2 = (ClassOrInterfaceDeclaration) arg; |
| 197 | if (!nodesEquals(n.getExtendedTypes(), n2.getExtendedTypes())) |
| 198 | return false; |
| 199 | if (!nodesEquals(n.getImplementedTypes(), n2.getImplementedTypes())) |
| 200 | return false; |
| 201 | if (!objEquals(n.isInterface(), n2.isInterface())) |
| 202 | return false; |
| 203 | if (!nodesEquals(n.getTypeParameters(), n2.getTypeParameters())) |
| 204 | return false; |
| 205 | if (!nodesEquals(n.getMembers(), n2.getMembers())) |
| 206 | return false; |
| 207 | if (!nodesEquals(n.getModifiers(), n2.getModifiers())) |
| 208 | return false; |
| 209 | if (!nodeEquals(n.getName(), n2.getName())) |
| 210 | return false; |
| 211 | if (!nodesEquals(n.getAnnotations(), n2.getAnnotations())) |
| 212 | return false; |
| 213 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 214 | return false; |
| 215 | return true; |
| 216 | } |
| 217 | |
| 218 | @Override |
| 219 | public Boolean visit(final EnumDeclaration n, final Visitable arg) { |
| 220 | final EnumDeclaration n2 = (EnumDeclaration) arg; |
| 221 | if (!nodesEquals(n.getEntries(), n2.getEntries())) |
| 222 | return false; |
| 223 | if (!nodesEquals(n.getImplementedTypes(), n2.getImplementedTypes())) |
| 224 | return false; |
| 225 | if (!nodesEquals(n.getMembers(), n2.getMembers())) |
| 226 | return false; |
| 227 | if (!nodesEquals(n.getModifiers(), n2.getModifiers())) |
| 228 | return false; |
| 229 | if (!nodeEquals(n.getName(), n2.getName())) |
| 230 | return false; |
| 231 | if (!nodesEquals(n.getAnnotations(), n2.getAnnotations())) |
| 232 | return false; |
| 233 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 234 | return false; |
| 235 | return true; |
| 236 | } |
| 237 | |
| 238 | @Override |
| 239 | public Boolean visit(final EnumConstantDeclaration n, final Visitable arg) { |
| 240 | final EnumConstantDeclaration n2 = (EnumConstantDeclaration) arg; |
| 241 | if (!nodesEquals(n.getArguments(), n2.getArguments())) |
| 242 | return false; |
| 243 | if (!nodesEquals(n.getClassBody(), n2.getClassBody())) |
| 244 | return false; |
| 245 | if (!nodeEquals(n.getName(), n2.getName())) |
| 246 | return false; |
| 247 | if (!nodesEquals(n.getAnnotations(), n2.getAnnotations())) |
| 248 | return false; |
| 249 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 250 | return false; |
| 251 | return true; |
| 252 | } |
| 253 | |
| 254 | @Override |
| 255 | public Boolean visit(final AnnotationDeclaration n, final Visitable arg) { |
| 256 | final AnnotationDeclaration n2 = (AnnotationDeclaration) arg; |
| 257 | if (!nodesEquals(n.getMembers(), n2.getMembers())) |
| 258 | return false; |
| 259 | if (!nodesEquals(n.getModifiers(), n2.getModifiers())) |
| 260 | return false; |
| 261 | if (!nodeEquals(n.getName(), n2.getName())) |
| 262 | return false; |
| 263 | if (!nodesEquals(n.getAnnotations(), n2.getAnnotations())) |
| 264 | return false; |
| 265 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 266 | return false; |
| 267 | return true; |
| 268 | } |
| 269 | |
| 270 | @Override |
| 271 | public Boolean visit(final AnnotationMemberDeclaration n, final Visitable arg) { |
| 272 | final AnnotationMemberDeclaration n2 = (AnnotationMemberDeclaration) arg; |
| 273 | if (!nodeEquals(n.getDefaultValue(), n2.getDefaultValue())) |
| 274 | return false; |
| 275 | if (!nodesEquals(n.getModifiers(), n2.getModifiers())) |
| 276 | return false; |
| 277 | if (!nodeEquals(n.getName(), n2.getName())) |
| 278 | return false; |
| 279 | if (!nodeEquals(n.getType(), n2.getType())) |
| 280 | return false; |
| 281 | if (!nodesEquals(n.getAnnotations(), n2.getAnnotations())) |
| 282 | return false; |
| 283 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 284 | return false; |
| 285 | return true; |
| 286 | } |
| 287 | |
| 288 | @Override |
| 289 | public Boolean visit(final FieldDeclaration n, final Visitable arg) { |
| 290 | final FieldDeclaration n2 = (FieldDeclaration) arg; |
| 291 | if (!nodesEquals(n.getModifiers(), n2.getModifiers())) |
| 292 | return false; |
| 293 | if (!nodesEquals(n.getVariables(), n2.getVariables())) |
| 294 | return false; |
| 295 | if (!nodesEquals(n.getAnnotations(), n2.getAnnotations())) |
| 296 | return false; |
| 297 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 298 | return false; |
| 299 | return true; |
| 300 | } |
| 301 | |
| 302 | @Override |
| 303 | public Boolean visit(final VariableDeclarator n, final Visitable arg) { |
| 304 | final VariableDeclarator n2 = (VariableDeclarator) arg; |
| 305 | if (!nodeEquals(n.getInitializer(), n2.getInitializer())) |
| 306 | return false; |
| 307 | if (!nodeEquals(n.getName(), n2.getName())) |
| 308 | return false; |
| 309 | if (!nodeEquals(n.getType(), n2.getType())) |
| 310 | return false; |
| 311 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 312 | return false; |
| 313 | return true; |
| 314 | } |
| 315 | |
| 316 | @Override |
| 317 | public Boolean visit(final ConstructorDeclaration n, final Visitable arg) { |
| 318 | final ConstructorDeclaration n2 = (ConstructorDeclaration) arg; |
| 319 | if (!nodeEquals(n.getBody(), n2.getBody())) |
| 320 | return false; |
| 321 | if (!nodesEquals(n.getModifiers(), n2.getModifiers())) |
| 322 | return false; |
| 323 | if (!nodeEquals(n.getName(), n2.getName())) |
| 324 | return false; |
| 325 | if (!nodesEquals(n.getParameters(), n2.getParameters())) |
| 326 | return false; |
| 327 | if (!nodeEquals(n.getReceiverParameter(), n2.getReceiverParameter())) |
| 328 | return false; |
| 329 | if (!nodesEquals(n.getThrownExceptions(), n2.getThrownExceptions())) |
| 330 | return false; |
| 331 | if (!nodesEquals(n.getTypeParameters(), n2.getTypeParameters())) |
| 332 | return false; |
| 333 | if (!nodesEquals(n.getAnnotations(), n2.getAnnotations())) |
| 334 | return false; |
| 335 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 336 | return false; |
| 337 | return true; |
| 338 | } |
| 339 | |
| 340 | @Override |
| 341 | public Boolean visit(final MethodDeclaration n, final Visitable arg) { |
| 342 | final MethodDeclaration n2 = (MethodDeclaration) arg; |
| 343 | if (!nodeEquals(n.getBody(), n2.getBody())) |
| 344 | return false; |
| 345 | if (!nodeEquals(n.getType(), n2.getType())) |
| 346 | return false; |
| 347 | if (!nodesEquals(n.getModifiers(), n2.getModifiers())) |
| 348 | return false; |
| 349 | if (!nodeEquals(n.getName(), n2.getName())) |
| 350 | return false; |
| 351 | if (!nodesEquals(n.getParameters(), n2.getParameters())) |
| 352 | return false; |
| 353 | if (!nodeEquals(n.getReceiverParameter(), n2.getReceiverParameter())) |
| 354 | return false; |
| 355 | if (!nodesEquals(n.getThrownExceptions(), n2.getThrownExceptions())) |
| 356 | return false; |
| 357 | if (!nodesEquals(n.getTypeParameters(), n2.getTypeParameters())) |
| 358 | return false; |
| 359 | if (!nodesEquals(n.getAnnotations(), n2.getAnnotations())) |
| 360 | return false; |
| 361 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 362 | return false; |
| 363 | return true; |
| 364 | } |
| 365 | |
| 366 | @Override |
| 367 | public Boolean visit(final Parameter n, final Visitable arg) { |
| 368 | final Parameter n2 = (Parameter) arg; |
| 369 | if (!nodesEquals(n.getAnnotations(), n2.getAnnotations())) |
| 370 | return false; |
| 371 | if (!objEquals(n.isVarArgs(), n2.isVarArgs())) |
| 372 | return false; |
| 373 | if (!nodesEquals(n.getModifiers(), n2.getModifiers())) |
| 374 | return false; |
| 375 | if (!nodeEquals(n.getName(), n2.getName())) |
| 376 | return false; |
| 377 | if (!nodeEquals(n.getType(), n2.getType())) |
| 378 | return false; |
| 379 | if (!nodesEquals(n.getVarArgsAnnotations(), n2.getVarArgsAnnotations())) |
| 380 | return false; |
| 381 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 382 | return false; |
| 383 | return true; |
| 384 | } |
| 385 | |
| 386 | @Override |
| 387 | public Boolean visit(final InitializerDeclaration n, final Visitable arg) { |
| 388 | final InitializerDeclaration n2 = (InitializerDeclaration) arg; |
| 389 | if (!nodeEquals(n.getBody(), n2.getBody())) |
| 390 | return false; |
| 391 | if (!objEquals(n.isStatic(), n2.isStatic())) |
| 392 | return false; |
| 393 | if (!nodesEquals(n.getAnnotations(), n2.getAnnotations())) |
| 394 | return false; |
| 395 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 396 | return false; |
| 397 | return true; |
| 398 | } |
| 399 | |
| 400 | @Override |
| 401 | public Boolean visit(final JavadocComment n, final Visitable arg) { |
| 402 | final JavadocComment n2 = (JavadocComment) arg; |
| 403 | if (!objEquals(n.getContent(), n2.getContent())) |
| 404 | return false; |
| 405 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 406 | return false; |
| 407 | return true; |
| 408 | } |
| 409 | |
| 410 | @Override |
| 411 | public Boolean visit(final ClassOrInterfaceType n, final Visitable arg) { |
| 412 | final ClassOrInterfaceType n2 = (ClassOrInterfaceType) arg; |
| 413 | if (!nodeEquals(n.getName(), n2.getName())) |
| 414 | return false; |
| 415 | if (!nodeEquals(n.getScope(), n2.getScope())) |
| 416 | return false; |
| 417 | if (!nodesEquals(n.getTypeArguments(), n2.getTypeArguments())) |
| 418 | return false; |
| 419 | if (!nodesEquals(n.getAnnotations(), n2.getAnnotations())) |
| 420 | return false; |
| 421 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 422 | return false; |
| 423 | return true; |
| 424 | } |
| 425 | |
| 426 | @Override |
| 427 | public Boolean visit(final PrimitiveType n, final Visitable arg) { |
| 428 | final PrimitiveType n2 = (PrimitiveType) arg; |
| 429 | if (!objEquals(n.getType(), n2.getType())) |
| 430 | return false; |
| 431 | if (!nodesEquals(n.getAnnotations(), n2.getAnnotations())) |
| 432 | return false; |
| 433 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 434 | return false; |
| 435 | return true; |
| 436 | } |
| 437 | |
| 438 | @Override |
| 439 | public Boolean visit(final ArrayType n, final Visitable arg) { |
| 440 | final ArrayType n2 = (ArrayType) arg; |
| 441 | if (!nodeEquals(n.getComponentType(), n2.getComponentType())) |
| 442 | return false; |
| 443 | if (!objEquals(n.getOrigin(), n2.getOrigin())) |
| 444 | return false; |
| 445 | if (!nodesEquals(n.getAnnotations(), n2.getAnnotations())) |
| 446 | return false; |
| 447 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 448 | return false; |
| 449 | return true; |
| 450 | } |
| 451 | |
| 452 | @Override |
| 453 | public Boolean visit(final ArrayCreationLevel n, final Visitable arg) { |
| 454 | final ArrayCreationLevel n2 = (ArrayCreationLevel) arg; |
| 455 | if (!nodesEquals(n.getAnnotations(), n2.getAnnotations())) |
| 456 | return false; |
| 457 | if (!nodeEquals(n.getDimension(), n2.getDimension())) |
| 458 | return false; |
| 459 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 460 | return false; |
| 461 | return true; |
| 462 | } |
| 463 | |
| 464 | @Override |
| 465 | public Boolean visit(final IntersectionType n, final Visitable arg) { |
| 466 | final IntersectionType n2 = (IntersectionType) arg; |
| 467 | if (!nodesEquals(n.getElements(), n2.getElements())) |
| 468 | return false; |
| 469 | if (!nodesEquals(n.getAnnotations(), n2.getAnnotations())) |
| 470 | return false; |
| 471 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 472 | return false; |
| 473 | return true; |
| 474 | } |
| 475 | |
| 476 | @Override |
| 477 | public Boolean visit(final UnionType n, final Visitable arg) { |
| 478 | final UnionType n2 = (UnionType) arg; |
| 479 | if (!nodesEquals(n.getElements(), n2.getElements())) |
| 480 | return false; |
| 481 | if (!nodesEquals(n.getAnnotations(), n2.getAnnotations())) |
| 482 | return false; |
| 483 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 484 | return false; |
| 485 | return true; |
| 486 | } |
| 487 | |
| 488 | @Override |
| 489 | public Boolean visit(final VoidType n, final Visitable arg) { |
| 490 | final VoidType n2 = (VoidType) arg; |
| 491 | if (!nodesEquals(n.getAnnotations(), n2.getAnnotations())) |
| 492 | return false; |
| 493 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 494 | return false; |
| 495 | return true; |
| 496 | } |
| 497 | |
| 498 | @Override |
| 499 | public Boolean visit(final WildcardType n, final Visitable arg) { |
| 500 | final WildcardType n2 = (WildcardType) arg; |
| 501 | if (!nodeEquals(n.getExtendedType(), n2.getExtendedType())) |
| 502 | return false; |
| 503 | if (!nodeEquals(n.getSuperType(), n2.getSuperType())) |
| 504 | return false; |
| 505 | if (!nodesEquals(n.getAnnotations(), n2.getAnnotations())) |
| 506 | return false; |
| 507 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 508 | return false; |
| 509 | return true; |
| 510 | } |
| 511 | |
| 512 | @Override |
| 513 | public Boolean visit(final UnknownType n, final Visitable arg) { |
| 514 | final UnknownType n2 = (UnknownType) arg; |
| 515 | if (!nodesEquals(n.getAnnotations(), n2.getAnnotations())) |
| 516 | return false; |
| 517 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 518 | return false; |
| 519 | return true; |
| 520 | } |
| 521 | |
| 522 | @Override |
| 523 | public Boolean visit(final ArrayAccessExpr n, final Visitable arg) { |
| 524 | final ArrayAccessExpr n2 = (ArrayAccessExpr) arg; |
| 525 | if (!nodeEquals(n.getIndex(), n2.getIndex())) |
| 526 | return false; |
| 527 | if (!nodeEquals(n.getName(), n2.getName())) |
| 528 | return false; |
| 529 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 530 | return false; |
| 531 | return true; |
| 532 | } |
| 533 | |
| 534 | @Override |
| 535 | public Boolean visit(final ArrayCreationExpr n, final Visitable arg) { |
| 536 | final ArrayCreationExpr n2 = (ArrayCreationExpr) arg; |
| 537 | if (!nodeEquals(n.getElementType(), n2.getElementType())) |
| 538 | return false; |
| 539 | if (!nodeEquals(n.getInitializer(), n2.getInitializer())) |
| 540 | return false; |
| 541 | if (!nodesEquals(n.getLevels(), n2.getLevels())) |
| 542 | return false; |
| 543 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 544 | return false; |
| 545 | return true; |
| 546 | } |
| 547 | |
| 548 | @Override |
| 549 | public Boolean visit(final ArrayInitializerExpr n, final Visitable arg) { |
| 550 | final ArrayInitializerExpr n2 = (ArrayInitializerExpr) arg; |
| 551 | if (!nodesEquals(n.getValues(), n2.getValues())) |
| 552 | return false; |
| 553 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 554 | return false; |
| 555 | return true; |
| 556 | } |
| 557 | |
| 558 | @Override |
| 559 | public Boolean visit(final AssignExpr n, final Visitable arg) { |
| 560 | final AssignExpr n2 = (AssignExpr) arg; |
| 561 | if (!objEquals(n.getOperator(), n2.getOperator())) |
| 562 | return false; |
| 563 | if (!nodeEquals(n.getTarget(), n2.getTarget())) |
| 564 | return false; |
| 565 | if (!nodeEquals(n.getValue(), n2.getValue())) |
| 566 | return false; |
| 567 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 568 | return false; |
| 569 | return true; |
| 570 | } |
| 571 | |
| 572 | @Override |
| 573 | public Boolean visit(final BinaryExpr n, final Visitable arg) { |
| 574 | final BinaryExpr n2 = (BinaryExpr) arg; |
| 575 | if (!nodeEquals(n.getLeft(), n2.getLeft())) |
| 576 | return false; |
| 577 | if (!objEquals(n.getOperator(), n2.getOperator())) |
| 578 | return false; |
| 579 | if (!nodeEquals(n.getRight(), n2.getRight())) |
| 580 | return false; |
| 581 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 582 | return false; |
| 583 | return true; |
| 584 | } |
| 585 | |
| 586 | @Override |
| 587 | public Boolean visit(final CastExpr n, final Visitable arg) { |
| 588 | final CastExpr n2 = (CastExpr) arg; |
| 589 | if (!nodeEquals(n.getExpression(), n2.getExpression())) |
| 590 | return false; |
| 591 | if (!nodeEquals(n.getType(), n2.getType())) |
| 592 | return false; |
| 593 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 594 | return false; |
| 595 | return true; |
| 596 | } |
| 597 | |
| 598 | @Override |
| 599 | public Boolean visit(final ClassExpr n, final Visitable arg) { |
| 600 | final ClassExpr n2 = (ClassExpr) arg; |
| 601 | if (!nodeEquals(n.getType(), n2.getType())) |
| 602 | return false; |
| 603 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 604 | return false; |
| 605 | return true; |
| 606 | } |
| 607 | |
| 608 | @Override |
| 609 | public Boolean visit(final ConditionalExpr n, final Visitable arg) { |
| 610 | final ConditionalExpr n2 = (ConditionalExpr) arg; |
| 611 | if (!nodeEquals(n.getCondition(), n2.getCondition())) |
| 612 | return false; |
| 613 | if (!nodeEquals(n.getElseExpr(), n2.getElseExpr())) |
| 614 | return false; |
| 615 | if (!nodeEquals(n.getThenExpr(), n2.getThenExpr())) |
| 616 | return false; |
| 617 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 618 | return false; |
| 619 | return true; |
| 620 | } |
| 621 | |
| 622 | @Override |
| 623 | public Boolean visit(final EnclosedExpr n, final Visitable arg) { |
| 624 | final EnclosedExpr n2 = (EnclosedExpr) arg; |
| 625 | if (!nodeEquals(n.getInner(), n2.getInner())) |
| 626 | return false; |
| 627 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 628 | return false; |
| 629 | return true; |
| 630 | } |
| 631 | |
| 632 | @Override |
| 633 | public Boolean visit(final FieldAccessExpr n, final Visitable arg) { |
| 634 | final FieldAccessExpr n2 = (FieldAccessExpr) arg; |
| 635 | if (!nodeEquals(n.getName(), n2.getName())) |
| 636 | return false; |
| 637 | if (!nodeEquals(n.getScope(), n2.getScope())) |
| 638 | return false; |
| 639 | if (!nodesEquals(n.getTypeArguments(), n2.getTypeArguments())) |
| 640 | return false; |
| 641 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 642 | return false; |
| 643 | return true; |
| 644 | } |
| 645 | |
| 646 | @Override |
| 647 | public Boolean visit(final InstanceOfExpr n, final Visitable arg) { |
| 648 | final InstanceOfExpr n2 = (InstanceOfExpr) arg; |
| 649 | if (!nodeEquals(n.getExpression(), n2.getExpression())) |
| 650 | return false; |
| 651 | if (!nodeEquals(n.getType(), n2.getType())) |
| 652 | return false; |
| 653 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 654 | return false; |
| 655 | return true; |
| 656 | } |
| 657 | |
| 658 | @Override |
| 659 | public Boolean visit(final StringLiteralExpr n, final Visitable arg) { |
| 660 | final StringLiteralExpr n2 = (StringLiteralExpr) arg; |
| 661 | if (!objEquals(n.getValue(), n2.getValue())) |
| 662 | return false; |
| 663 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 664 | return false; |
| 665 | return true; |
| 666 | } |
| 667 | |
| 668 | @Override |
| 669 | public Boolean visit(final IntegerLiteralExpr n, final Visitable arg) { |
| 670 | final IntegerLiteralExpr n2 = (IntegerLiteralExpr) arg; |
| 671 | if (!objEquals(n.getValue(), n2.getValue())) |
| 672 | return false; |
| 673 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 674 | return false; |
| 675 | return true; |
| 676 | } |
| 677 | |
| 678 | @Override |
| 679 | public Boolean visit(final LongLiteralExpr n, final Visitable arg) { |
| 680 | final LongLiteralExpr n2 = (LongLiteralExpr) arg; |
| 681 | if (!objEquals(n.getValue(), n2.getValue())) |
| 682 | return false; |
| 683 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 684 | return false; |
| 685 | return true; |
| 686 | } |
| 687 | |
| 688 | @Override |
| 689 | public Boolean visit(final CharLiteralExpr n, final Visitable arg) { |
| 690 | final CharLiteralExpr n2 = (CharLiteralExpr) arg; |
| 691 | if (!objEquals(n.getValue(), n2.getValue())) |
| 692 | return false; |
| 693 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 694 | return false; |
| 695 | return true; |
| 696 | } |
| 697 | |
| 698 | @Override |
| 699 | public Boolean visit(final DoubleLiteralExpr n, final Visitable arg) { |
| 700 | final DoubleLiteralExpr n2 = (DoubleLiteralExpr) arg; |
| 701 | if (!objEquals(n.getValue(), n2.getValue())) |
| 702 | return false; |
| 703 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 704 | return false; |
| 705 | return true; |
| 706 | } |
| 707 | |
| 708 | @Override |
| 709 | public Boolean visit(final BooleanLiteralExpr n, final Visitable arg) { |
| 710 | final BooleanLiteralExpr n2 = (BooleanLiteralExpr) arg; |
| 711 | if (!objEquals(n.isValue(), n2.isValue())) |
| 712 | return false; |
| 713 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 714 | return false; |
| 715 | return true; |
| 716 | } |
| 717 | |
| 718 | @Override |
| 719 | public Boolean visit(final NullLiteralExpr n, final Visitable arg) { |
| 720 | final NullLiteralExpr n2 = (NullLiteralExpr) arg; |
| 721 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 722 | return false; |
| 723 | return true; |
| 724 | } |
| 725 | |
| 726 | @Override |
| 727 | public Boolean visit(final MethodCallExpr n, final Visitable arg) { |
| 728 | final MethodCallExpr n2 = (MethodCallExpr) arg; |
| 729 | if (!nodesEquals(n.getArguments(), n2.getArguments())) |
| 730 | return false; |
| 731 | if (!nodeEquals(n.getName(), n2.getName())) |
| 732 | return false; |
| 733 | if (!nodeEquals(n.getScope(), n2.getScope())) |
| 734 | return false; |
| 735 | if (!nodesEquals(n.getTypeArguments(), n2.getTypeArguments())) |
| 736 | return false; |
| 737 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 738 | return false; |
| 739 | return true; |
| 740 | } |
| 741 | |
| 742 | @Override |
| 743 | public Boolean visit(final NameExpr n, final Visitable arg) { |
| 744 | final NameExpr n2 = (NameExpr) arg; |
| 745 | if (!nodeEquals(n.getName(), n2.getName())) |
| 746 | return false; |
| 747 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 748 | return false; |
| 749 | return true; |
| 750 | } |
| 751 | |
| 752 | @Override |
| 753 | public Boolean visit(final ObjectCreationExpr n, final Visitable arg) { |
| 754 | final ObjectCreationExpr n2 = (ObjectCreationExpr) arg; |
| 755 | if (!nodesEquals(n.getAnonymousClassBody(), n2.getAnonymousClassBody())) |
| 756 | return false; |
| 757 | if (!nodesEquals(n.getArguments(), n2.getArguments())) |
| 758 | return false; |
| 759 | if (!nodeEquals(n.getScope(), n2.getScope())) |
| 760 | return false; |
| 761 | if (!nodeEquals(n.getType(), n2.getType())) |
| 762 | return false; |
| 763 | if (!nodesEquals(n.getTypeArguments(), n2.getTypeArguments())) |
| 764 | return false; |
| 765 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 766 | return false; |
| 767 | return true; |
| 768 | } |
| 769 | |
| 770 | @Override |
| 771 | public Boolean visit(final Name n, final Visitable arg) { |
| 772 | final Name n2 = (Name) arg; |
| 773 | if (!objEquals(n.getIdentifier(), n2.getIdentifier())) |
| 774 | return false; |
| 775 | if (!nodeEquals(n.getQualifier(), n2.getQualifier())) |
| 776 | return false; |
| 777 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 778 | return false; |
| 779 | return true; |
| 780 | } |
| 781 | |
| 782 | @Override |
| 783 | public Boolean visit(final SimpleName n, final Visitable arg) { |
| 784 | final SimpleName n2 = (SimpleName) arg; |
| 785 | if (!objEquals(n.getIdentifier(), n2.getIdentifier())) |
| 786 | return false; |
| 787 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 788 | return false; |
| 789 | return true; |
| 790 | } |
| 791 | |
| 792 | @Override |
| 793 | public Boolean visit(final ThisExpr n, final Visitable arg) { |
| 794 | final ThisExpr n2 = (ThisExpr) arg; |
| 795 | if (!nodeEquals(n.getTypeName(), n2.getTypeName())) |
| 796 | return false; |
| 797 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 798 | return false; |
| 799 | return true; |
| 800 | } |
| 801 | |
| 802 | @Override |
| 803 | public Boolean visit(final SuperExpr n, final Visitable arg) { |
| 804 | final SuperExpr n2 = (SuperExpr) arg; |
| 805 | if (!nodeEquals(n.getTypeName(), n2.getTypeName())) |
| 806 | return false; |
| 807 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 808 | return false; |
| 809 | return true; |
| 810 | } |
| 811 | |
| 812 | @Override |
| 813 | public Boolean visit(final UnaryExpr n, final Visitable arg) { |
| 814 | final UnaryExpr n2 = (UnaryExpr) arg; |
| 815 | if (!nodeEquals(n.getExpression(), n2.getExpression())) |
| 816 | return false; |
| 817 | if (!objEquals(n.getOperator(), n2.getOperator())) |
| 818 | return false; |
| 819 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 820 | return false; |
| 821 | return true; |
| 822 | } |
| 823 | |
| 824 | @Override |
| 825 | public Boolean visit(final VariableDeclarationExpr n, final Visitable arg) { |
| 826 | final VariableDeclarationExpr n2 = (VariableDeclarationExpr) arg; |
| 827 | if (!nodesEquals(n.getAnnotations(), n2.getAnnotations())) |
| 828 | return false; |
| 829 | if (!nodesEquals(n.getModifiers(), n2.getModifiers())) |
| 830 | return false; |
| 831 | if (!nodesEquals(n.getVariables(), n2.getVariables())) |
| 832 | return false; |
| 833 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 834 | return false; |
| 835 | return true; |
| 836 | } |
| 837 | |
| 838 | @Override |
| 839 | public Boolean visit(final MarkerAnnotationExpr n, final Visitable arg) { |
| 840 | final MarkerAnnotationExpr n2 = (MarkerAnnotationExpr) arg; |
| 841 | if (!nodeEquals(n.getName(), n2.getName())) |
| 842 | return false; |
| 843 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 844 | return false; |
| 845 | return true; |
| 846 | } |
| 847 | |
| 848 | @Override |
| 849 | public Boolean visit(final SingleMemberAnnotationExpr n, final Visitable arg) { |
| 850 | final SingleMemberAnnotationExpr n2 = (SingleMemberAnnotationExpr) arg; |
| 851 | if (!nodeEquals(n.getMemberValue(), n2.getMemberValue())) |
| 852 | return false; |
| 853 | if (!nodeEquals(n.getName(), n2.getName())) |
| 854 | return false; |
| 855 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 856 | return false; |
| 857 | return true; |
| 858 | } |
| 859 | |
| 860 | @Override |
| 861 | public Boolean visit(final NormalAnnotationExpr n, final Visitable arg) { |
| 862 | final NormalAnnotationExpr n2 = (NormalAnnotationExpr) arg; |
| 863 | if (!nodesEquals(n.getPairs(), n2.getPairs())) |
| 864 | return false; |
| 865 | if (!nodeEquals(n.getName(), n2.getName())) |
| 866 | return false; |
| 867 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 868 | return false; |
| 869 | return true; |
| 870 | } |
| 871 | |
| 872 | @Override |
| 873 | public Boolean visit(final MemberValuePair n, final Visitable arg) { |
| 874 | final MemberValuePair n2 = (MemberValuePair) arg; |
| 875 | if (!nodeEquals(n.getName(), n2.getName())) |
| 876 | return false; |
| 877 | if (!nodeEquals(n.getValue(), n2.getValue())) |
| 878 | return false; |
| 879 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 880 | return false; |
| 881 | return true; |
| 882 | } |
| 883 | |
| 884 | @Override |
| 885 | public Boolean visit(final ExplicitConstructorInvocationStmt n, final Visitable arg) { |
| 886 | final ExplicitConstructorInvocationStmt n2 = (ExplicitConstructorInvocationStmt) arg; |
| 887 | if (!nodesEquals(n.getArguments(), n2.getArguments())) |
| 888 | return false; |
| 889 | if (!nodeEquals(n.getExpression(), n2.getExpression())) |
| 890 | return false; |
| 891 | if (!objEquals(n.isThis(), n2.isThis())) |
| 892 | return false; |
| 893 | if (!nodesEquals(n.getTypeArguments(), n2.getTypeArguments())) |
| 894 | return false; |
| 895 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 896 | return false; |
| 897 | return true; |
| 898 | } |
| 899 | |
| 900 | @Override |
| 901 | public Boolean visit(final LocalClassDeclarationStmt n, final Visitable arg) { |
| 902 | final LocalClassDeclarationStmt n2 = (LocalClassDeclarationStmt) arg; |
| 903 | if (!nodeEquals(n.getClassDeclaration(), n2.getClassDeclaration())) |
| 904 | return false; |
| 905 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 906 | return false; |
| 907 | return true; |
| 908 | } |
| 909 | |
| 910 | @Override |
| 911 | public Boolean visit(final AssertStmt n, final Visitable arg) { |
| 912 | final AssertStmt n2 = (AssertStmt) arg; |
| 913 | if (!nodeEquals(n.getCheck(), n2.getCheck())) |
| 914 | return false; |
| 915 | if (!nodeEquals(n.getMessage(), n2.getMessage())) |
| 916 | return false; |
| 917 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 918 | return false; |
| 919 | return true; |
| 920 | } |
| 921 | |
| 922 | @Override |
| 923 | public Boolean visit(final BlockStmt n, final Visitable arg) { |
| 924 | final BlockStmt n2 = (BlockStmt) arg; |
| 925 | if (!nodesEquals(n.getStatements(), n2.getStatements())) |
| 926 | return false; |
| 927 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 928 | return false; |
| 929 | return true; |
| 930 | } |
| 931 | |
| 932 | @Override |
| 933 | public Boolean visit(final LabeledStmt n, final Visitable arg) { |
| 934 | final LabeledStmt n2 = (LabeledStmt) arg; |
| 935 | if (!nodeEquals(n.getLabel(), n2.getLabel())) |
| 936 | return false; |
| 937 | if (!nodeEquals(n.getStatement(), n2.getStatement())) |
| 938 | return false; |
| 939 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 940 | return false; |
| 941 | return true; |
| 942 | } |
| 943 | |
| 944 | @Override |
| 945 | public Boolean visit(final EmptyStmt n, final Visitable arg) { |
| 946 | final EmptyStmt n2 = (EmptyStmt) arg; |
| 947 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 948 | return false; |
| 949 | return true; |
| 950 | } |
| 951 | |
| 952 | @Override |
| 953 | public Boolean visit(final ExpressionStmt n, final Visitable arg) { |
| 954 | final ExpressionStmt n2 = (ExpressionStmt) arg; |
| 955 | if (!nodeEquals(n.getExpression(), n2.getExpression())) |
| 956 | return false; |
| 957 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 958 | return false; |
| 959 | return true; |
| 960 | } |
| 961 | |
| 962 | @Override |
| 963 | public Boolean visit(final SwitchStmt n, final Visitable arg) { |
| 964 | final SwitchStmt n2 = (SwitchStmt) arg; |
| 965 | if (!nodesEquals(n.getEntries(), n2.getEntries())) |
| 966 | return false; |
| 967 | if (!nodeEquals(n.getSelector(), n2.getSelector())) |
| 968 | return false; |
| 969 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 970 | return false; |
| 971 | return true; |
| 972 | } |
| 973 | |
| 974 | @Override |
| 975 | public Boolean visit(final SwitchEntry n, final Visitable arg) { |
| 976 | final SwitchEntry n2 = (SwitchEntry) arg; |
| 977 | if (!nodesEquals(n.getLabels(), n2.getLabels())) |
| 978 | return false; |
| 979 | if (!nodesEquals(n.getStatements(), n2.getStatements())) |
| 980 | return false; |
| 981 | if (!objEquals(n.getType(), n2.getType())) |
| 982 | return false; |
| 983 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 984 | return false; |
| 985 | return true; |
| 986 | } |
| 987 | |
| 988 | @Override |
| 989 | public Boolean visit(final BreakStmt n, final Visitable arg) { |
| 990 | final BreakStmt n2 = (BreakStmt) arg; |
| 991 | if (!nodeEquals(n.getLabel(), n2.getLabel())) |
| 992 | return false; |
| 993 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 994 | return false; |
| 995 | return true; |
| 996 | } |
| 997 | |
| 998 | @Override |
| 999 | public Boolean visit(final ReturnStmt n, final Visitable arg) { |
| 1000 | final ReturnStmt n2 = (ReturnStmt) arg; |
| 1001 | if (!nodeEquals(n.getExpression(), n2.getExpression())) |
| 1002 | return false; |
| 1003 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1004 | return false; |
| 1005 | return true; |
| 1006 | } |
| 1007 | |
| 1008 | @Override |
| 1009 | public Boolean visit(final IfStmt n, final Visitable arg) { |
| 1010 | final IfStmt n2 = (IfStmt) arg; |
| 1011 | if (!nodeEquals(n.getCondition(), n2.getCondition())) |
| 1012 | return false; |
| 1013 | if (!nodeEquals(n.getElseStmt(), n2.getElseStmt())) |
| 1014 | return false; |
| 1015 | if (!nodeEquals(n.getThenStmt(), n2.getThenStmt())) |
| 1016 | return false; |
| 1017 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1018 | return false; |
| 1019 | return true; |
| 1020 | } |
| 1021 | |
| 1022 | @Override |
| 1023 | public Boolean visit(final WhileStmt n, final Visitable arg) { |
| 1024 | final WhileStmt n2 = (WhileStmt) arg; |
| 1025 | if (!nodeEquals(n.getBody(), n2.getBody())) |
| 1026 | return false; |
| 1027 | if (!nodeEquals(n.getCondition(), n2.getCondition())) |
| 1028 | return false; |
| 1029 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1030 | return false; |
| 1031 | return true; |
| 1032 | } |
| 1033 | |
| 1034 | @Override |
| 1035 | public Boolean visit(final ContinueStmt n, final Visitable arg) { |
| 1036 | final ContinueStmt n2 = (ContinueStmt) arg; |
| 1037 | if (!nodeEquals(n.getLabel(), n2.getLabel())) |
| 1038 | return false; |
| 1039 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1040 | return false; |
| 1041 | return true; |
| 1042 | } |
| 1043 | |
| 1044 | @Override |
| 1045 | public Boolean visit(final DoStmt n, final Visitable arg) { |
| 1046 | final DoStmt n2 = (DoStmt) arg; |
| 1047 | if (!nodeEquals(n.getBody(), n2.getBody())) |
| 1048 | return false; |
| 1049 | if (!nodeEquals(n.getCondition(), n2.getCondition())) |
| 1050 | return false; |
| 1051 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1052 | return false; |
| 1053 | return true; |
| 1054 | } |
| 1055 | |
| 1056 | @Override |
| 1057 | public Boolean visit(final ForEachStmt n, final Visitable arg) { |
| 1058 | final ForEachStmt n2 = (ForEachStmt) arg; |
| 1059 | if (!nodeEquals(n.getBody(), n2.getBody())) |
| 1060 | return false; |
| 1061 | if (!nodeEquals(n.getIterable(), n2.getIterable())) |
| 1062 | return false; |
| 1063 | if (!nodeEquals(n.getVariable(), n2.getVariable())) |
| 1064 | return false; |
| 1065 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1066 | return false; |
| 1067 | return true; |
| 1068 | } |
| 1069 | |
| 1070 | @Override |
| 1071 | public Boolean visit(final ForStmt n, final Visitable arg) { |
| 1072 | final ForStmt n2 = (ForStmt) arg; |
| 1073 | if (!nodeEquals(n.getBody(), n2.getBody())) |
| 1074 | return false; |
| 1075 | if (!nodeEquals(n.getCompare(), n2.getCompare())) |
| 1076 | return false; |
| 1077 | if (!nodesEquals(n.getInitialization(), n2.getInitialization())) |
| 1078 | return false; |
| 1079 | if (!nodesEquals(n.getUpdate(), n2.getUpdate())) |
| 1080 | return false; |
| 1081 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1082 | return false; |
| 1083 | return true; |
| 1084 | } |
| 1085 | |
| 1086 | @Override |
| 1087 | public Boolean visit(final ThrowStmt n, final Visitable arg) { |
| 1088 | final ThrowStmt n2 = (ThrowStmt) arg; |
| 1089 | if (!nodeEquals(n.getExpression(), n2.getExpression())) |
| 1090 | return false; |
| 1091 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1092 | return false; |
| 1093 | return true; |
| 1094 | } |
| 1095 | |
| 1096 | @Override |
| 1097 | public Boolean visit(final SynchronizedStmt n, final Visitable arg) { |
| 1098 | final SynchronizedStmt n2 = (SynchronizedStmt) arg; |
| 1099 | if (!nodeEquals(n.getBody(), n2.getBody())) |
| 1100 | return false; |
| 1101 | if (!nodeEquals(n.getExpression(), n2.getExpression())) |
| 1102 | return false; |
| 1103 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1104 | return false; |
| 1105 | return true; |
| 1106 | } |
| 1107 | |
| 1108 | @Override |
| 1109 | public Boolean visit(final TryStmt n, final Visitable arg) { |
| 1110 | final TryStmt n2 = (TryStmt) arg; |
| 1111 | if (!nodesEquals(n.getCatchClauses(), n2.getCatchClauses())) |
| 1112 | return false; |
| 1113 | if (!nodeEquals(n.getFinallyBlock(), n2.getFinallyBlock())) |
| 1114 | return false; |
| 1115 | if (!nodesEquals(n.getResources(), n2.getResources())) |
| 1116 | return false; |
| 1117 | if (!nodeEquals(n.getTryBlock(), n2.getTryBlock())) |
| 1118 | return false; |
| 1119 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1120 | return false; |
| 1121 | return true; |
| 1122 | } |
| 1123 | |
| 1124 | @Override |
| 1125 | public Boolean visit(final CatchClause n, final Visitable arg) { |
| 1126 | final CatchClause n2 = (CatchClause) arg; |
| 1127 | if (!nodeEquals(n.getBody(), n2.getBody())) |
| 1128 | return false; |
| 1129 | if (!nodeEquals(n.getParameter(), n2.getParameter())) |
| 1130 | return false; |
| 1131 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1132 | return false; |
| 1133 | return true; |
| 1134 | } |
| 1135 | |
| 1136 | @Override |
| 1137 | public Boolean visit(final LambdaExpr n, final Visitable arg) { |
| 1138 | final LambdaExpr n2 = (LambdaExpr) arg; |
| 1139 | if (!nodeEquals(n.getBody(), n2.getBody())) |
| 1140 | return false; |
| 1141 | if (!objEquals(n.isEnclosingParameters(), n2.isEnclosingParameters())) |
| 1142 | return false; |
| 1143 | if (!nodesEquals(n.getParameters(), n2.getParameters())) |
| 1144 | return false; |
| 1145 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1146 | return false; |
| 1147 | return true; |
| 1148 | } |
| 1149 | |
| 1150 | @Override |
| 1151 | public Boolean visit(final MethodReferenceExpr n, final Visitable arg) { |
| 1152 | final MethodReferenceExpr n2 = (MethodReferenceExpr) arg; |
| 1153 | if (!objEquals(n.getIdentifier(), n2.getIdentifier())) |
| 1154 | return false; |
| 1155 | if (!nodeEquals(n.getScope(), n2.getScope())) |
| 1156 | return false; |
| 1157 | if (!nodesEquals(n.getTypeArguments(), n2.getTypeArguments())) |
| 1158 | return false; |
| 1159 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1160 | return false; |
| 1161 | return true; |
| 1162 | } |
| 1163 | |
| 1164 | @Override |
| 1165 | public Boolean visit(final TypeExpr n, final Visitable arg) { |
| 1166 | final TypeExpr n2 = (TypeExpr) arg; |
| 1167 | if (!nodeEquals(n.getType(), n2.getType())) |
| 1168 | return false; |
| 1169 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1170 | return false; |
| 1171 | return true; |
| 1172 | } |
| 1173 | |
| 1174 | @Override |
| 1175 | public Boolean visit(final ImportDeclaration n, final Visitable arg) { |
| 1176 | final ImportDeclaration n2 = (ImportDeclaration) arg; |
| 1177 | if (!objEquals(n.isAsterisk(), n2.isAsterisk())) |
| 1178 | return false; |
| 1179 | if (!objEquals(n.isStatic(), n2.isStatic())) |
| 1180 | return false; |
| 1181 | if (!nodeEquals(n.getName(), n2.getName())) |
| 1182 | return false; |
| 1183 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1184 | return false; |
| 1185 | return true; |
| 1186 | } |
| 1187 | |
| 1188 | @Override |
| 1189 | public Boolean visit(NodeList n, Visitable arg) { |
| 1190 | return nodesEquals((NodeList<Node>) n, (NodeList<Node>) arg); |
| 1191 | } |
| 1192 | |
| 1193 | @Override |
| 1194 | public Boolean visit(final ModuleDeclaration n, final Visitable arg) { |
| 1195 | final ModuleDeclaration n2 = (ModuleDeclaration) arg; |
| 1196 | if (!nodesEquals(n.getAnnotations(), n2.getAnnotations())) |
| 1197 | return false; |
| 1198 | if (!nodesEquals(n.getDirectives(), n2.getDirectives())) |
| 1199 | return false; |
| 1200 | if (!objEquals(n.isOpen(), n2.isOpen())) |
| 1201 | return false; |
| 1202 | if (!nodeEquals(n.getName(), n2.getName())) |
| 1203 | return false; |
| 1204 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1205 | return false; |
| 1206 | return true; |
| 1207 | } |
| 1208 | |
| 1209 | @Override |
| 1210 | public Boolean visit(final ModuleRequiresDirective n, final Visitable arg) { |
| 1211 | final ModuleRequiresDirective n2 = (ModuleRequiresDirective) arg; |
| 1212 | if (!nodesEquals(n.getModifiers(), n2.getModifiers())) |
| 1213 | return false; |
| 1214 | if (!nodeEquals(n.getName(), n2.getName())) |
| 1215 | return false; |
| 1216 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1217 | return false; |
| 1218 | return true; |
| 1219 | } |
| 1220 | |
| 1221 | @Override() |
| 1222 | public Boolean visit(final ModuleExportsDirective n, final Visitable arg) { |
| 1223 | final ModuleExportsDirective n2 = (ModuleExportsDirective) arg; |
| 1224 | if (!nodesEquals(n.getModuleNames(), n2.getModuleNames())) |
| 1225 | return false; |
| 1226 | if (!nodeEquals(n.getName(), n2.getName())) |
| 1227 | return false; |
| 1228 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1229 | return false; |
| 1230 | return true; |
| 1231 | } |
| 1232 | |
| 1233 | @Override() |
| 1234 | public Boolean visit(final ModuleProvidesDirective n, final Visitable arg) { |
| 1235 | final ModuleProvidesDirective n2 = (ModuleProvidesDirective) arg; |
| 1236 | if (!nodeEquals(n.getName(), n2.getName())) |
| 1237 | return false; |
| 1238 | if (!nodesEquals(n.getWith(), n2.getWith())) |
| 1239 | return false; |
| 1240 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1241 | return false; |
| 1242 | return true; |
| 1243 | } |
| 1244 | |
| 1245 | @Override() |
| 1246 | public Boolean visit(final ModuleUsesDirective n, final Visitable arg) { |
| 1247 | final ModuleUsesDirective n2 = (ModuleUsesDirective) arg; |
| 1248 | if (!nodeEquals(n.getName(), n2.getName())) |
| 1249 | return false; |
| 1250 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1251 | return false; |
| 1252 | return true; |
| 1253 | } |
| 1254 | |
| 1255 | @Override |
| 1256 | public Boolean visit(final ModuleOpensDirective n, final Visitable arg) { |
| 1257 | final ModuleOpensDirective n2 = (ModuleOpensDirective) arg; |
| 1258 | if (!nodesEquals(n.getModuleNames(), n2.getModuleNames())) |
| 1259 | return false; |
| 1260 | if (!nodeEquals(n.getName(), n2.getName())) |
| 1261 | return false; |
| 1262 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1263 | return false; |
| 1264 | return true; |
| 1265 | } |
| 1266 | |
| 1267 | @Override |
| 1268 | public Boolean visit(final UnparsableStmt n, final Visitable arg) { |
| 1269 | final UnparsableStmt n2 = (UnparsableStmt) arg; |
| 1270 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1271 | return false; |
| 1272 | return true; |
| 1273 | } |
| 1274 | |
| 1275 | @Override |
| 1276 | public Boolean visit(final ReceiverParameter n, final Visitable arg) { |
| 1277 | final ReceiverParameter n2 = (ReceiverParameter) arg; |
| 1278 | if (!nodesEquals(n.getAnnotations(), n2.getAnnotations())) |
| 1279 | return false; |
| 1280 | if (!nodeEquals(n.getName(), n2.getName())) |
| 1281 | return false; |
| 1282 | if (!nodeEquals(n.getType(), n2.getType())) |
| 1283 | return false; |
| 1284 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1285 | return false; |
| 1286 | return true; |
| 1287 | } |
| 1288 | |
| 1289 | @Override |
| 1290 | public Boolean visit(final VarType n, final Visitable arg) { |
| 1291 | final VarType n2 = (VarType) arg; |
| 1292 | if (!nodesEquals(n.getAnnotations(), n2.getAnnotations())) |
| 1293 | return false; |
| 1294 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1295 | return false; |
| 1296 | return true; |
| 1297 | } |
| 1298 | |
| 1299 | @Override |
| 1300 | public Boolean visit(final Modifier n, final Visitable arg) { |
| 1301 | final Modifier n2 = (Modifier) arg; |
| 1302 | if (!objEquals(n.getKeyword(), n2.getKeyword())) |
| 1303 | return false; |
| 1304 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1305 | return false; |
| 1306 | return true; |
| 1307 | } |
| 1308 | |
| 1309 | @Override |
| 1310 | public Boolean visit(final SwitchExpr n, final Visitable arg) { |
| 1311 | final SwitchExpr n2 = (SwitchExpr) arg; |
| 1312 | if (!nodesEquals(n.getEntries(), n2.getEntries())) |
| 1313 | return false; |
| 1314 | if (!nodeEquals(n.getSelector(), n2.getSelector())) |
| 1315 | return false; |
| 1316 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1317 | return false; |
| 1318 | return true; |
| 1319 | } |
| 1320 | |
| 1321 | @Override |
| 1322 | public Boolean visit(final YieldStmt n, final Visitable arg) { |
| 1323 | final YieldStmt n2 = (YieldStmt) arg; |
| 1324 | if (!nodeEquals(n.getExpression(), n2.getExpression())) |
| 1325 | return false; |
| 1326 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1327 | return false; |
| 1328 | return true; |
| 1329 | } |
| 1330 | |
| 1331 | @Override |
| 1332 | public Boolean visit(final TextBlockLiteralExpr n, final Visitable arg) { |
| 1333 | final TextBlockLiteralExpr n2 = (TextBlockLiteralExpr) arg; |
| 1334 | if (!objEquals(n.getValue(), n2.getValue())) |
| 1335 | return false; |
| 1336 | if (!nodeEquals(n.getComment(), n2.getComment())) |
| 1337 | return false; |
| 1338 | return true; |
| 1339 | } |
| 1340 | } |
| 1341 |
Members