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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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.UnresolvedType;
  19. import org.aspectj.weaver.World;
  20. public class AnyTypePattern extends TypePattern {
  21. /**
  22. * Constructor for AnyTypePattern.
  23. */
  24. public AnyTypePattern() {
  25. super(false, false, new TypePatternList());
  26. }
  27. /*
  28. * (non-Javadoc)
  29. *
  30. * @see org.aspectj.weaver.patterns.TypePattern#couldEverMatchSameTypesAs(org.aspectj.weaver.patterns.TypePattern)
  31. */
  32. @Override
  33. protected boolean couldEverMatchSameTypesAs(TypePattern other) {
  34. return true;
  35. }
  36. /**
  37. * @see org.aspectj.weaver.patterns.TypePattern#matchesExactly(ResolvedType)
  38. */
  39. @Override
  40. protected boolean matchesExactly(ResolvedType type) {
  41. return true;
  42. }
  43. @Override
  44. protected boolean matchesExactly(ResolvedType type, ResolvedType annotatedType) {
  45. return true;
  46. }
  47. /**
  48. * @see org.aspectj.weaver.patterns.TypePattern#matchesInstanceof(ResolvedType)
  49. */
  50. @Override
  51. public FuzzyBoolean matchesInstanceof(ResolvedType type) {
  52. return FuzzyBoolean.YES;
  53. }
  54. @Override
  55. public void write(CompressingDataOutputStream s) throws IOException {
  56. s.writeByte(ANY_KEY);
  57. }
  58. /**
  59. * @see org.aspectj.weaver.patterns.TypePattern#matches(IType, MatchKind)
  60. */
  61. // public FuzzyBoolean matches(IType type, MatchKind kind) {
  62. // return FuzzyBoolean.YES;
  63. // }
  64. /**
  65. * @see org.aspectj.weaver.patterns.TypePattern#matchesSubtypes(ResolvedType)
  66. */
  67. @Override
  68. protected boolean matchesSubtypes(ResolvedType type) {
  69. return true;
  70. }
  71. @Override
  72. public boolean isStar() {
  73. return true;
  74. }
  75. @Override
  76. public String toString() {
  77. return "*";
  78. }
  79. @Override
  80. public boolean equals(Object obj) {
  81. return (obj instanceof AnyTypePattern);
  82. }
  83. @Override
  84. public int hashCode() {
  85. return 37;
  86. }
  87. @Override
  88. public Object accept(PatternNodeVisitor visitor, Object data) {
  89. return visitor.visit(this, data);
  90. }
  91. @Override
  92. public TypePattern parameterizeWith(Map<String,UnresolvedType> arg0, World w) {
  93. return this;
  94. }
  95. }