~ubuntu-branches/ubuntu/wily/aspectj/wily-proposed

« back to all changes in this revision

Viewing changes to org.aspectj/modules/org.aspectj.ajdt.core/src/org/aspectj/org/eclipse/jdt/core/dom/AjASTMatcher.java

  • Committer: Bazaar Package Importer
  • Author(s): Damien Raude-Morvan
  • Date: 2011-03-15 23:54:31 UTC
  • mfrom: (1.2.5 upstream)
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: james.westby@ubuntu.com-20110315235431-iq2gxbsx08kpwuiw
* New upstream release.
* Updated Standards-Version to 3.9.1 (no changes needed).
* Fix local Javadoc links:
  - d/patches/07_javadoc_links.diff: Use locally installed
   javadoc packages and hyperlink with them.
  - d/control: Add B-D on default-java-doc and libasm3-java-doc.
* d/control: Drop B-D on itself (our new bootstrap infrastructure doesn't need
  that anymore).
* Split packages into :
  - aspectj: only contains CLI tools.
  - libaspectj-java: JAR librairies for /usr/share/java.
  - libaspectj-java-doc: 4 API's Javadoc.
  - aspectj-doc: Programming Guides and SDK Documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*******************************************************************************
2
 
 * Copyright (c) 2000, 2005 IBM Corporation and others.
 
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
3
 * All rights reserved. This program and the accompanying materials
4
4
 * are made available under the terms of the Eclipse Public License v1.0
5
5
 * which accompanies this distribution, and is available at
7
7
 *
8
8
 * Contributors:
9
9
 *     IBM Corporation - initial API and implementation
 
10
 *     Nieraj Singh
10
11
 *******************************************************************************/
11
12
package org.aspectj.org.eclipse.jdt.core.dom;
12
13
 
258
259
                }
259
260
                return node.getDetail().equals(((SignaturePattern) other).getDetail());
260
261
        }
 
262
 
 
263
        public boolean match(AndTypePattern node, Object other) {
 
264
                if (node == other) {
 
265
                        return true;
 
266
                }
 
267
                if (!(other instanceof AndTypePattern)) {
 
268
                        return false;
 
269
                }
 
270
                AndTypePattern otherBoolean = (AndTypePattern) other;
 
271
                return safeSubtreeMatch(node.getLeft(), otherBoolean.getLeft())
 
272
                                && safeSubtreeMatch(node.getRight(), otherBoolean.getRight());
 
273
        }
 
274
 
 
275
        public boolean match(OrTypePattern node, Object other) {
 
276
                if (node == other) {
 
277
                        return true;
 
278
                }
 
279
                if (!(other instanceof OrTypePattern)) {
 
280
                        return false;
 
281
                }
 
282
                OrTypePattern otherBoolean = (OrTypePattern) other;
 
283
                return safeSubtreeMatch(node.getLeft(), otherBoolean.getLeft())
 
284
                                && safeSubtreeMatch(node.getRight(), otherBoolean.getRight());
 
285
        }
 
286
 
 
287
        public boolean match(AnyTypePattern node, Object other) {
 
288
                // AnyTypePattern nodes don't hold state aside from the AST, so just do a reference check
 
289
                if (node == other) {
 
290
                        return true;
 
291
                }
 
292
                return false;
 
293
        }
 
294
 
 
295
        public boolean match(AnyWithAnnotationTypePattern node, Object other) {
 
296
                if (node == other) {
 
297
                        return true;
 
298
                }
 
299
                if (!(other instanceof AnyWithAnnotationTypePattern)) {
 
300
                        return false;
 
301
                }
 
302
                // For now only do an expression matching. In future versions, when
 
303
                // the node supports AnnotationTypes, this may have to be changed
 
304
                return node.getTypePatternExpression().equals(
 
305
                                ((AnyWithAnnotationTypePattern) other)
 
306
                                                .getTypePatternExpression());
 
307
        }
 
308
 
 
309
        public boolean match(EllipsisTypePattern node, Object other) {
 
310
                // Ellipsis nodes don't hold state aside from the AST, so just do a reference check
 
311
                if (node == other) {
 
312
                        return true;
 
313
                }
 
314
                return false;
 
315
        }
 
316
 
 
317
        public boolean match(NotTypePattern node, Object other) {
 
318
                if (node == other) {
 
319
                        return true;
 
320
                }
 
321
                if (!(other instanceof NotTypePattern)) {
 
322
                        return false;
 
323
                }
 
324
                return safeSubtreeMatch(node.getNegatedTypePattern(),
 
325
                                ((NotTypePattern) other).getNegatedTypePattern());
 
326
        }
 
327
 
 
328
        public boolean match(NoTypePattern node, Object other) {
 
329
                // NoTypePattern nodes don't hold state aside from the AST, so just do a reference check
 
330
                if (node == other) {
 
331
                        return true;
 
332
                }
 
333
                return false;
 
334
        }
 
335
 
 
336
        public boolean match(HasMemberTypePattern node, Object other) {
 
337
                if (node == other) {
 
338
                        return true;
 
339
                }
 
340
                if (!(other instanceof HasMemberTypePattern)) {
 
341
                        return false;
 
342
                }
 
343
                return safeSubtreeMatch(node.getSignaturePattern(),
 
344
                                ((HasMemberTypePattern) other).getSignaturePattern());
 
345
        }
 
346
 
 
347
        public boolean match(IdentifierTypePattern node, Object other) {
 
348
                if (node == other) {
 
349
                        return true;
 
350
                }
 
351
                if (!(other instanceof IdentifierTypePattern)) {
 
352
                        return false;
 
353
                }
 
354
                return safeSubtreeMatch(node.getType(),
 
355
                                ((IdentifierTypePattern) other).getType());
 
356
        }
 
357
 
 
358
        public boolean match(TypeCategoryTypePattern node, Object other) {
 
359
                if (node == other) {
 
360
                        return true;
 
361
                }
 
362
                if (!(other instanceof TypeCategoryTypePattern)) {
 
363
                        return false;
 
364
                }
 
365
                return node.getTypeCategory() == ((TypeCategoryTypePattern) other)
 
366
                                .getTypeCategory();
 
367
        }
 
368
 
 
369
        public boolean match(Type type, Object other) {
 
370
                if (type == other) {
 
371
                        return true;
 
372
                }
 
373
                // For now only support simple type/simple name matching. Support for
 
374
                // other types
 
375
                // may have to be added here
 
376
                if (type instanceof SimpleType && other instanceof SimpleType) {
 
377
                        Name name = ((SimpleType) type).getName();
 
378
                        Name otherName = ((SimpleType) other).getName();
 
379
                        if (name instanceof SimpleName && otherName instanceof SimpleName) {
 
380
                                return ((SimpleName) name).getIdentifier().equals(
 
381
                                                ((SimpleName) otherName).getIdentifier());
 
382
                        }
 
383
                }
 
384
                return false;
 
385
        }
261
386
}