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.

EllipsisTypePattern.java 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /* *******************************************************************
  2. * Copyright (c) 2002, 2010 Contributors
  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 EllipsisTypePattern extends TypePattern {
  20. /**
  21. * Constructor for EllipsisTypePattern.
  22. *
  23. * @param includeSubtypes
  24. */
  25. public EllipsisTypePattern() {
  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 false;
  43. }
  44. @Override
  45. protected boolean matchesExactly(ResolvedType type, ResolvedType annotatedType) {
  46. return false;
  47. }
  48. /**
  49. * @see org.aspectj.weaver.patterns.TypePattern#matchesInstanceof(IType)
  50. */
  51. @Override
  52. public FuzzyBoolean matchesInstanceof(ResolvedType type) {
  53. return FuzzyBoolean.NO;
  54. }
  55. @Override
  56. public void write(CompressingDataOutputStream s) throws IOException {
  57. s.writeByte(ELLIPSIS_KEY);
  58. }
  59. @Override
  60. public boolean isEllipsis() {
  61. return true;
  62. }
  63. @Override
  64. public String toString() {
  65. return "..";
  66. }
  67. /*
  68. * (non-Javadoc)
  69. *
  70. * @see java.lang.Object#equals(java.lang.Object)
  71. */
  72. @Override
  73. public boolean equals(Object obj) {
  74. return (obj instanceof EllipsisTypePattern);
  75. }
  76. /*
  77. * (non-Javadoc)
  78. *
  79. * @see java.lang.Object#hashCode()
  80. */
  81. @Override
  82. public int hashCode() {
  83. return 17 * 37;
  84. }
  85. @Override
  86. public Object accept(PatternNodeVisitor visitor, Object data) {
  87. return visitor.visit(this, data);
  88. }
  89. @Override
  90. public TypePattern parameterizeWith(Map typeVariableMap, World w) {
  91. return this;
  92. }
  93. }