List of usage examples for com.badlogic.gdx.utils Predicate evaluate
boolean evaluate(T arg0);
From source file:es.eucm.ead.editor.view.widgets.AbstractWidget.java
License:Open Source License
/** * Finds an actor that fulfills the given predicate, starting the search in * the given root/*from www . j av a2s . c om*/ * * @return the actor found. Could be {@code null} if no actor matched the * predicate */ public static Actor findActor(Group root, Predicate<Actor> predicate) { if (predicate.evaluate(root)) { return root; } for (Actor child : root.getChildren()) { if (predicate.evaluate(child)) { return child; } else if (child instanceof Group) { Actor actor = findActor((Group) child, predicate); if (actor != null) { return actor; } } } return null; }