当前位置: 首页>>代码示例>>Java>>正文


Java Bag.size方法代码示例

本文整理汇总了Java中com.artemis.utils.Bag.size方法的典型用法代码示例。如果您正苦于以下问题:Java Bag.size方法的具体用法?Java Bag.size怎么用?Java Bag.size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.artemis.utils.Bag的用法示例。


在下文中一共展示了Bag.size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: dispatch

import com.artemis.utils.Bag; //导入方法依赖的package包/类
/**
 * Dispatch event to registered listeners.
 * Events are called on the call stack, avoid deeply nested or circular event calls.
 */
@Override
public void dispatch(Event event) {
	if ( event == null ) throw new NullPointerException("Event required.");

	final Bag<EventListener> listeners = getListenersForHierarchical(event.getClass());

	/** Fetch hierarchical list of listeners. */
	Object[] data = listeners.getData();
	for (int i = 0, s = listeners.size(); i < s; i++) {
		final EventListener listener = (EventListener) data[i];
		if (listener != null) {
			listener.handle(event);
		}
	}
}
 
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:20,代码来源:FastEventDispatcher.java

示例2: createEntity

import com.artemis.utils.Bag; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private final void createEntity() {
	Entity e = world.createEntity();
	Bag<Class<? extends Component>> components = permutations[cmp[cmpIndex++]];
	if (cmpIndex == cmp.length) cmpIndex = 0;
	
	Object[] data = components.getData();
	for (int i = 0, s = components.size(); s > i; i++) {
		e.addComponent(newInstance(data[i]));
	}
	e.addToWorld();
}
 
开发者ID:junkdog,项目名称:entity-system-benchmarks,代码行数:13,代码来源:EntityManglerSystem.java

示例3: 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();
    }
}
 
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:9,代码来源:EntityUtil.java

示例4: findPoint

import com.artemis.utils.Bag; //导入方法依赖的package包/类
static IntBag findPoint (TestData data, IntBag fill, Bag<TestData> testData) {
	for (int i = 0; i < testData.size(); i++) {
		TestData test = testData.get(i);
		if (test.contains(data.x, data.y)) {
			fill.add(test.id);
		}
	}
	fill.clear();
	return fill;
}
 
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:11,代码来源:QuadTreeBenchmark.java

示例5: find

import com.artemis.utils.Bag; //导入方法依赖的package包/类
static IntBag find (TestData data, IntBag fill, Bag<TestData> testData) {
	for (int i = 0; i < testData.size(); i++) {
		TestData test = testData.get(i);
		if (test.overlaps(data.x, data.y, data.width, data.height)) {
			fill.add(test.id);
		}
	}
	fill.clear();
	return fill;
}
 
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:11,代码来源:QuadTreeBenchmark.java

示例6: processProfileSystems

import com.artemis.utils.Bag; //导入方法依赖的package包/类
private void processProfileSystems(Bag<BaseSystem> systems) {
    final Object[] systemsData = systems.getData();
    for (int i = 0, s = systems.size(); s > i; i++) {
        if (disabled.get(i))
            continue;

        updateEntityStates();
        processProfileSystem(profilers[i], (BaseSystem) systemsData[i]);
    }

    updateEntityStates();
}
 
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:13,代码来源:ProfilerInvocationStrategy.java

示例7: getProxy

import com.artemis.utils.Bag; //导入方法依赖的package包/类
private EntityProxy getProxy (Entity entity) {
	EntityProxy proxy = getInternalProxyFor(entity);

	if (proxy == null) {
		for (EditorEntitySupport support : projectExtensionStorage.getEntitySupports()) {
			proxy = support.resolveProxy(entity);
			if (proxy != null)
				return proxy;
		}
	}

	if (proxy == null) {
		proxy = new MissingProxy(entity);
		Log.error(TAG, String.format("Missing proxy for: %s. Entity structure:", entity));
		Log.error(TAG, String.format("=-%s", entity));

		Bag<Component> components = entity.getComponents(new Bag<>());
		for (int i = 0; i < components.size(); i++) {
			String formatString;
			if (i == components.size() - 1)
				formatString = " \\-- %s";
			else
				formatString = " |-- %s";

			Log.error(TAG, String.format(formatString, components.get(i)));
		}
	}

	return proxy;
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:31,代码来源:EntityProxyCache.java

示例8: cloneObject

import com.artemis.utils.Bag; //导入方法依赖的package包/类
@Override
protected Bag cloneObject (Bag original, IDeepCloner cloner, Map<Object, Object> clones) {
	Bag bag = new Bag(original.size());

	for (Object obj : original) {
		bag.add(cloner.deepClone(obj, clones));
	}

	return bag;
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:11,代码来源:BagCloner.java

示例9: removeFromAllGroups

import com.artemis.utils.Bag; //导入方法依赖的package包/类
public void removeFromAllGroups(Entity e) {
	Bag<String> groups = groupsByEntity.get(e);
	if(groups != null) {
		for(int i = 0; groups.size() > i; i++) {
			Bag<Entity> entities = entitiesByGroup.get(groups.get(i));
			if(entities != null) {
				entities.remove(e);
			}
		}
		groups.clear();
	}
}
 
开发者ID:lanen,项目名称:mint4j,代码行数:13,代码来源:GroupManager.java

示例10: check

import com.artemis.utils.Bag; //导入方法依赖的package包/类
/**
 * Performs an action on each entity.
 * @param entities
 * @param performer
 */
private void check(Bag<Entity> entities, Performer performer) {
	if (!entities.isEmpty()) {
		for (int i = 0; entities.size() > i; i++) {
			Entity e = entities.get(i);
			notifyManagers(performer, e);
			notifySystems(performer, e);
		}
		entities.clear();
	}
}
 
开发者ID:lanen,项目名称:mint4j,代码行数:16,代码来源:World.java

示例11: disposeSystems

import com.artemis.utils.Bag; //导入方法依赖的package包/类
private void disposeSystems(World world) {
		// Delete entities with Effects
		ImmutableBag<Entity> entities = world.getManager(GroupManager.class).getEntities(Constants.EFFECTS);
		for (int i = 0; i < entities.size(); ++i) {
			Bag<Component> components = new Bag<Component>();
			world.getComponentManager().getComponentsFor(entities.get(i), components);
			for (int j = 0; j < components.size(); ++j) {
//				System.out.print("C: ");
				Component c = components.get(j);
//				System.out.println(c.getClass());
				if (c instanceof Effect) {
//					System.out.println("REMOVE");
					((Effect) c).dispose();
				}
			}
		}
		// Delete systems
		ImmutableBag<EntitySystem> entitySystems = world.getSystems();
		for (int i = 0; i < entitySystems.size(); ++i) {
			EntitySystem e = entitySystems.get(i);
			if (e instanceof EffectSystem) {
				((EffectSystem) e).dispose();
			} else if (e instanceof SpriteRenderSystem) {
				((SpriteRenderSystem) e).dispose();
			}
		}
	}
 
开发者ID:matachi,项目名称:slashat-the-game,代码行数:28,代码来源:Game.java

示例12: removeFromAllGroups

import com.artemis.utils.Bag; //导入方法依赖的package包/类
public void removeFromAllGroups(Entity e) {
	if (groupsByEntity.containsKey(e)){
		Bag<String> groups = groupsByEntity.get(e);
		for(int i = 0; groups.size() > i; i++) {
			Bag<Entity> entities = entitiesByGroup.get(groups.get(i));
			if(entities != null) {
				entities.remove(e);
			}
		}
		groupsByEntity.remove(e);
	}
}
 
开发者ID:nhydock,项目名称:gdx-artemis,代码行数:13,代码来源:GroupManager.java

示例13: interpolate

import com.artemis.utils.Bag; //导入方法依赖的package包/类
protected void interpolate(Bag<InterpolatingSystem> systemsBag) {
	Object[] systems = systemsBag.getData();
	for (int i = 0, s = systemsBag.size(); s > i; i++) {
		InterpolatingSystem system = (InterpolatingSystem) systems[i];
		system.interpolateSystem();
	}
}
 
开发者ID:mini2Dx,项目名称:mini2Dx,代码行数:8,代码来源:MdxInvocationStrategy.java

示例14: render

import com.artemis.utils.Bag; //导入方法依赖的package包/类
protected void render(Bag<RenderingSystem> systemsBag, Graphics g) {
	Object[] systems = systemsBag.getData();
	for (int i = 0, s = systemsBag.size(); s > i; i++) {
		RenderingSystem system = (RenderingSystem) systems[i];
		system.renderSystem(g);
	}
}
 
开发者ID:mini2Dx,项目名称:mini2Dx,代码行数:8,代码来源:MdxInvocationStrategy.java

示例15: freeEntity

import com.artemis.utils.Bag; //导入方法依赖的package包/类
public static void freeEntity(Entity entity) {
  Bag<Component> fillBag = new Bag<Component>();
  fillBag = entity.getComponents(fillBag);
  for (int i = 0; i < fillBag.size(); i++) {
    ComponentFactory.freeComponent(fillBag.get(i));
  }
}
 
开发者ID:jamiltron,项目名称:entity-shmup,代码行数:8,代码来源:EntityFactory.java


注:本文中的com.artemis.utils.Bag.size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。