259
260
return node.getDetail().equals(((SignaturePattern) other).getDetail());
263
public boolean match(AndTypePattern node, Object other) {
267
if (!(other instanceof AndTypePattern)) {
270
AndTypePattern otherBoolean = (AndTypePattern) other;
271
return safeSubtreeMatch(node.getLeft(), otherBoolean.getLeft())
272
&& safeSubtreeMatch(node.getRight(), otherBoolean.getRight());
275
public boolean match(OrTypePattern node, Object other) {
279
if (!(other instanceof OrTypePattern)) {
282
OrTypePattern otherBoolean = (OrTypePattern) other;
283
return safeSubtreeMatch(node.getLeft(), otherBoolean.getLeft())
284
&& safeSubtreeMatch(node.getRight(), otherBoolean.getRight());
287
public boolean match(AnyTypePattern node, Object other) {
288
// AnyTypePattern nodes don't hold state aside from the AST, so just do a reference check
295
public boolean match(AnyWithAnnotationTypePattern node, Object other) {
299
if (!(other instanceof AnyWithAnnotationTypePattern)) {
302
// For now only do an expression matching. In future versions, when
303
// the node supports AnnotationTypes, this may have to be changed
304
return node.getTypePatternExpression().equals(
305
((AnyWithAnnotationTypePattern) other)
306
.getTypePatternExpression());
309
public boolean match(EllipsisTypePattern node, Object other) {
310
// Ellipsis nodes don't hold state aside from the AST, so just do a reference check
317
public boolean match(NotTypePattern node, Object other) {
321
if (!(other instanceof NotTypePattern)) {
324
return safeSubtreeMatch(node.getNegatedTypePattern(),
325
((NotTypePattern) other).getNegatedTypePattern());
328
public boolean match(NoTypePattern node, Object other) {
329
// NoTypePattern nodes don't hold state aside from the AST, so just do a reference check
336
public boolean match(HasMemberTypePattern node, Object other) {
340
if (!(other instanceof HasMemberTypePattern)) {
343
return safeSubtreeMatch(node.getSignaturePattern(),
344
((HasMemberTypePattern) other).getSignaturePattern());
347
public boolean match(IdentifierTypePattern node, Object other) {
351
if (!(other instanceof IdentifierTypePattern)) {
354
return safeSubtreeMatch(node.getType(),
355
((IdentifierTypePattern) other).getType());
358
public boolean match(TypeCategoryTypePattern node, Object other) {
362
if (!(other instanceof TypeCategoryTypePattern)) {
365
return node.getTypeCategory() == ((TypeCategoryTypePattern) other)
369
public boolean match(Type type, Object other) {
373
// For now only support simple type/simple name matching. Support for
375
// may have to be added here
376
if (type instanceof SimpleType && other instanceof SimpleType) {
377
Name name = ((SimpleType) type).getName();
378
Name otherName = ((SimpleType) other).getName();
379
if (name instanceof SimpleName && otherName instanceof SimpleName) {
380
return ((SimpleName) name).getIdentifier().equals(
381
((SimpleName) otherName).getIdentifier());