You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

NotTypePattern.java 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /********************************************************************
  2. * Copyright (c) 2010 Contributors. All rights reserved.
  3. * This program and the accompanying materials are made available
  4. * under the terms of the Eclipse Public License v 2.0
  5. * which accompanies this distribution and is available at
  6. * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
  7. *
  8. * Contributors: Nieraj Singh - initial implementation
  9. *******************************************************************/
  10. package org.aspectj.org.eclipse.jdt.core.dom;
  11. import java.util.List;
  12. public class NotTypePattern extends AbstractTypePattern {
  13. private AbstractTypePattern negatedPattern;
  14. /**
  15. * The negated type pattern cannot be null
  16. *
  17. * @param ast
  18. * not null
  19. * @param negatedPattern
  20. * not null
  21. */
  22. NotTypePattern(AST ast, AbstractTypePattern negatedPattern) {
  23. super(ast, "!");
  24. this.negatedPattern = negatedPattern;
  25. }
  26. List<?> internalStructuralPropertiesForType(int apiLevel) {
  27. return null;
  28. }
  29. public AbstractTypePattern getNegatedTypePattern() {
  30. return negatedPattern;
  31. }
  32. ASTNode clone0(AST target) {
  33. ASTNode node = new NotTypePattern(target,
  34. (AbstractTypePattern) getNegatedTypePattern().clone(target));
  35. node.setSourceRange(getStartPosition(), getLength());
  36. return node;
  37. }
  38. void accept0(ASTVisitor visitor) {
  39. if (visitor instanceof AjASTVisitor) {
  40. AjASTVisitor ajVisitor = (AjASTVisitor) visitor;
  41. boolean visit = ajVisitor.visit(this);
  42. if (visit) {
  43. acceptChild(ajVisitor, getNegatedTypePattern());
  44. }
  45. ajVisitor.endVisit(this);
  46. }
  47. }
  48. boolean subtreeMatch0(ASTMatcher matcher, Object other) {
  49. if (matcher instanceof AjASTMatcher) {
  50. AjASTMatcher ajmatcher = (AjASTMatcher) matcher;
  51. return ajmatcher.match(this, other);
  52. }
  53. return false;
  54. }
  55. int memSize() {
  56. return super.memSize() + getNegatedTypePattern().memSize();
  57. }
  58. }