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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. public EllipsisTypePattern() {
  24. super(false, false, new TypePatternList());
  25. }
  26. /*
  27. * (non-Javadoc)
  28. *
  29. * @see org.aspectj.weaver.patterns.TypePattern#couldEverMatchSameTypesAs(org.aspectj.weaver.patterns.TypePattern)
  30. */
  31. @Override
  32. protected boolean couldEverMatchSameTypesAs(TypePattern other) {
  33. return true;
  34. }
  35. /**
  36. * @see org.aspectj.weaver.patterns.TypePattern#matchesExactly(ResolvedType)
  37. */
  38. @Override
  39. protected boolean matchesExactly(ResolvedType type) {
  40. return false;
  41. }
  42. @Override
  43. protected boolean matchesExactly(ResolvedType type, ResolvedType annotatedType) {
  44. return false;
  45. }
  46. /**
  47. * @see org.aspectj.weaver.patterns.TypePattern#matchesInstanceof(ResolvedType)
  48. */
  49. @Override
  50. public FuzzyBoolean matchesInstanceof(ResolvedType type) {
  51. return FuzzyBoolean.NO;
  52. }
  53. @Override
  54. public void write(CompressingDataOutputStream s) throws IOException {
  55. s.writeByte(ELLIPSIS_KEY);
  56. }
  57. @Override
  58. public boolean isEllipsis() {
  59. return true;
  60. }
  61. @Override
  62. public String toString() {
  63. return "..";
  64. }
  65. /*
  66. * (non-Javadoc)
  67. *
  68. * @see java.lang.Object#equals(java.lang.Object)
  69. */
  70. @Override
  71. public boolean equals(Object obj) {
  72. return (obj instanceof EllipsisTypePattern);
  73. }
  74. /*
  75. * (non-Javadoc)
  76. *
  77. * @see java.lang.Object#hashCode()
  78. */
  79. @Override
  80. public int hashCode() {
  81. return 17 * 37;
  82. }
  83. @Override
  84. public Object accept(PatternNodeVisitor visitor, Object data) {
  85. return visitor.visit(this, data);
  86. }
  87. @Override
  88. public TypePattern parameterizeWith(Map typeVariableMap, World w) {
  89. return this;
  90. }
  91. }