-
-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(SameFilter): add utility class SameFilter (#3391)
- Loading branch information
Showing
2 changed files
with
29 additions
and
7 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
src/main/java/spoon/reflect/visitor/filter/SameFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* SPDX-License-Identifier: (MIT OR CECILL-C) | ||
* | ||
* Copyright (C) 2006-2019 INRIA and contributors | ||
* | ||
* Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) of the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. | ||
*/ | ||
package spoon.reflect.visitor.filter; | ||
|
||
import spoon.reflect.declaration.CtElement; | ||
import spoon.reflect.visitor.Filter; | ||
|
||
/** Finds the element given in parameter, useful for checking if an element is in an ancestor. | ||
* Here "same" refers to the Junit meaning: same object memory, equals with == | ||
*/ | ||
public class SameFilter implements Filter<CtElement> { | ||
private final CtElement argument2; | ||
|
||
public SameFilter(CtElement argument2) { | ||
this.argument2 = argument2; | ||
} | ||
|
||
@Override | ||
public boolean matches(CtElement element) { | ||
return element == argument2; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters