mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
KeywordEnum: replace more String Keywords checks with Enums
This commit is contained in:
@@ -1,11 +1,22 @@
|
||||
package forge.util;
|
||||
|
||||
public abstract class Visitor<T> {
|
||||
/**
|
||||
* visit the object
|
||||
* the Visitor should return true it can be visit again
|
||||
* returning false means the outer function can stop
|
||||
*
|
||||
* @param object
|
||||
* @return boolean
|
||||
*/
|
||||
public abstract boolean visit(T object);
|
||||
|
||||
public void visitAll(Iterable<? extends T> objects) {
|
||||
public boolean visitAll(Iterable<? extends T> objects) {
|
||||
for (T obj : objects) {
|
||||
visit(obj);
|
||||
if (!visit(obj)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user