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.

AnyTypePattern.java 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /* *******************************************************************
  2. * Copyright (c) 2002, 2010 Palo Alto Research Center, Incorporated (PARC) and others.
  3. * All rights reserved.
  4. * This program and the accompanying materials are made available
  5. * under the terms of the Eclipse Public License v1.0
  6. * which accompanies this distribution and is available at
  7. * http://www.eclipse.org/legal/epl-v10.html
  8. *
  9. * Contributors:
  10. * PARC initial implementation
  11. * ******************************************************************/
  12. package org.aspectj.weaver.patterns;
  13. import java.io.IOException;
  14. import java.util.Map;
  15. import org.aspectj.util.FuzzyBoolean;
  16. import org.aspectj.weaver.CompressingDataOutputStream;
  17. import org.aspectj.weaver.ResolvedType;
  18. import org.aspectj.weaver.World;
  19. public class AnyTypePattern extends TypePattern {
  20. /**
  21. * Constructor for EllipsisTypePattern.
  22. *
  23. * @param includeSubtypes
  24. */
  25. public AnyTypePattern() {
  26. super(false, false, new TypePatternList());
  27. }
  28. /*
  29. * (non-Javadoc)
  30. *
  31. * @see org.aspectj.weaver.patterns.TypePattern#couldEverMatchSameTypesAs(org.aspectj.weaver.patterns.TypePattern)
  32. */
  33. @Override
  34. protected boolean couldEverMatchSameTypesAs(TypePattern other) {
  35. return true;
  36. }
  37. /**
  38. * @see org.aspectj.weaver.patterns.TypePattern#matchesExactly(IType)
  39. */
  40. @Override
  41. protected boolean matchesExactly(ResolvedType type) {
  42. return true;
  43. }
  44. @Override
  45. protected boolean matchesExactly(ResolvedType type, ResolvedType annotatedType) {
  46. return true;
  47. }
  48. /**
  49. * @see org.aspectj.weaver.patterns.TypePattern#matchesInstanceof(IType)
  50. */
  51. @Override
  52. public FuzzyBoolean matchesInstanceof(ResolvedType type) {
  53. return FuzzyBoolean.YES;
  54. }
  55. @Override
  56. public void write(CompressingDataOutputStream s) throws IOException {
  57. s.writeByte(ANY_KEY);
  58. }
  59. /**
  60. * @see org.aspectj.weaver.patterns.TypePattern#matches(IType, MatchKind)
  61. */
  62. // public FuzzyBoolean matches(IType type, MatchKind kind) {
  63. // return FuzzyBoolean.YES;
  64. // }
  65. /**
  66. * @see org.aspectj.weaver.patterns.TypePattern#matchesSubtypes(IType)
  67. */
  68. @Override
  69. protected boolean matchesSubtypes(ResolvedType type) {
  70. return true;
  71. }
  72. @Override
  73. public boolean isStar() {
  74. return true;
  75. }
  76. @Override
  77. public String toString() {
  78. return "*";
  79. }
  80. @Override
  81. public boolean equals(Object obj) {
  82. return (obj instanceof AnyTypePattern);
  83. }
  84. @Override
  85. public int hashCode() {
  86. return 37;
  87. }
  88. @Override
  89. public Object accept(PatternNodeVisitor visitor, Object data) {
  90. return visitor.visit(this, data);
  91. }
  92. @Override
  93. public TypePattern parameterizeWith(Map arg0, World w) {
  94. return this;
  95. }
  96. }