本文整理汇总了Java中com.artemis.utils.Bag.addAll方法的典型用法代码示例。如果您正苦于以下问题:Java Bag.addAll方法的具体用法?Java Bag.addAll怎么用?Java Bag.addAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.artemis.utils.Bag
的用法示例。
在下文中一共展示了Bag.addAll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getListenersForHierarchicalUncached
import com.artemis.utils.Bag; //导入方法依赖的package包/类
/**
* Get listeners for class, including all superclasses,
* sorted by priority.
*
* Not backed by cache.
*
* @param aClass Class to fetch listeners for.
* @return Bag of listeners, empty if none found.
*/
private Bag<EventListener> getListenersForHierarchicalUncached(Class<?> aClass) {
// get hierarchy for event.
final Class<?>[] classes = classHierarchy.of(aClass);
// step through hierarchy back to front, fetching the listeners for each step.
final Bag<EventListener> hierarchicalListeners = new Bag<>(4);
for (Class<?> c : classes) {
final Bag<EventListener> listeners = getListenersFor(c, false);
if (listeners != null) {
hierarchicalListeners.addAll(listeners);
}
}
// sort by priority.
BagUtils.sort(hierarchicalListeners);
return hierarchicalListeners;
}
示例2: safeDeleteAll
import com.artemis.utils.Bag; //导入方法依赖的package包/类
/** Safely delete all entities from bag, regardless if the bag changes. */
public static void safeDeleteAll(final ImmutableBag<Entity> entities1) {
final Bag<Entity> entities = new Bag<>();
entities.addAll(entities1);
for (int i = 0, s = entities.size(); i < s; i++) {
entities.get(i).deleteFromWorld();
}
}