Java 类com.badlogic.gdx.utils.Predicate 实例源码

项目:ead    文件:AbstractWidget.java   
/**
 * Finds an actor that fulfills the given predicate, starting the search in
 * the given root
 * 
 * @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;
}
项目:dice-heroes    文件:TargetVisualizer.java   
public static <T extends ITargetOwner> TargetChecker<T> withName(final String name, IVisualizer<? super T> visualizer) {
    return new TargetChecker<T>(new Predicate<Creature>() {
        @Override public boolean evaluate(Creature creature) {
            return name.equals(creature.description.name);
        }
    }, visualizer);
}
项目:dice-heroes    文件:TargetVisualizer.java   
public static <T extends ITargetOwner> TargetChecker<T> withProfession(final ProfessionDescription profession, IVisualizer<? super T> visualizer) {
    return new TargetChecker<T>(new Predicate<Creature>() {
        @Override public boolean evaluate(Creature creature) {
            return profession == creature.description.profession;
        }
    }, visualizer);
}
项目:dice-heroes    文件:Predicates.java   
public static <T> Predicate<T> eq(final T value) {
    return new Predicate<T>() {
        @Override public boolean evaluate(T arg0) {
            return arg0 == value;
        }
    };
}
项目:ModularArmour    文件:Array.java   
/**
 * Returns an iterable for the selected items in the array. Remove is
 * supported, but not between hasNext() and next(). Note that the same
 * iterable instance is returned each time this method is called. Use the
 * {@link Predicate.PredicateIterable} constructor for nested or
 * multithreaded iteration.
 */
public Iterable<T> select(Predicate<T> predicate) {
    if (predicateIterable == null)
        predicateIterable = new Predicate.PredicateIterable<T>(this, predicate);
    else
        predicateIterable.set(this, predicate);
    return predicateIterable;
}
项目:cachebox3.0    文件:CacheList.java   
public Iterable<AbstractCache> select(Predicate<AbstractCache> predicate) {
    synchronized ((Object) this.items) { //must cast to Object otherwise it gives a classcastexception at runtime
        return super.select(predicate);
    }
}
项目:dice-heroes    文件:TargetVisualizer.java   
private TargetChecker(Predicate<Creature> predicate, IVisualizer<? super T> visualizer) {
    this.predicate = predicate;
    this.visualizer = visualizer;
}
项目:dice-heroes    文件:TargetVisualizer.java   
public static <T extends ITargetOwner> TargetChecker<T> make(Predicate<Creature> predicate, IVisualizer<? super T> visualizer) {
    return new TargetChecker<T>(predicate, visualizer);
}
项目:dice-heroes    文件:AbilityVisualizer.java   
private AbilityChecker(Predicate<Ability> predicate, IVisualizer<? super T> visualizer) {
    this.predicate = predicate;
    this.visualizer = visualizer;
}
项目:dice-heroes    文件:AbilityVisualizer.java   
public static <T extends IAbilityOwner> AbilityChecker<T> make(Predicate<Ability> predicate, IVisualizer<? super T> visualizer) {
    return new AbilityChecker<T>(predicate, visualizer);
}