本文整理了Java中com.artemis.utils.Bag.get()
方法的一些代码示例,展示了Bag.get()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bag.get()
方法的具体详情如下:
包路径:com.artemis.utils.Bag
类名称:Bag
方法名:get
[英]Returns the element at the specified position in Bag.
[中]返回包中指定位置的元素。
代码示例来源:origin: junkdog/artemis-odb
/** Get component composition of entity. */
private Bag<ComponentMapper> componentMappers(int entityId) {
int identityIndex = entityToIdentity.get(entityId);
return identityResolver.compositionMappers.get(identityIndex);
}
代码示例来源:origin: junkdog/artemis-odb
/** Get component composition of entity. */
private Bag<ComponentMapper> componentMappers(int entityId) {
int identityIndex = entityToIdentity.get(entityId);
return identityResolver.compositionMappers.get(identityIndex);
}
代码示例来源:origin: net.onedaybeard.artemis/artemis-odb
/**
* Get all components from all entities for a given type.
*
* @param type
* the type of components to get
* @return a bag containing all components of the given type
*/
protected Bag<Component> getComponentsByType(ComponentType type) {
return mappers.get(type.getIndex()).components;
}
代码示例来源:origin: junkdog/artemis-odb
/**
* Get all components from all entities for a given type.
*
* @param type
* the type of components to get
* @return a bag containing all components of the given type
*/
protected Bag<Component> getComponentsByType(ComponentType type) {
return mappers.get(type.getIndex()).components;
}
代码示例来源:origin: junkdog/artemis-odb
/** Get component composition of entity. */
BitVector componentBits(int entityId) {
int identityIndex = entityToIdentity.get(entityId);
return identityResolver.compositionBits.get(identityIndex);
}
代码示例来源:origin: junkdog/artemis-odb
EntityReference find(Class<?> componentType, String fieldName) {
for (int i = 0, s = referenced.size(); s > i; i++) {
EntityReference ref = referenced.get(i);
if (ref.componentType.equals(componentType) && ref.field.getName().equals(fieldName))
return ref;
}
throw new RuntimeException(
componentType.getSimpleName() + "." + fieldName);
}
代码示例来源:origin: net.onedaybeard.artemis/artemis-odb-serializer
EntityReference find(Class<?> componentType, String fieldName) {
for (int i = 0, s = referenced.size(); s > i; i++) {
EntityReference ref = referenced.get(i);
if (ref.componentType.equals(componentType) && ref.field.getName().equals(fieldName))
return ref;
}
throw new RuntimeException(
componentType.getSimpleName() + "." + fieldName);
}
代码示例来源:origin: net.onedaybeard.artemis/artemis-odb
private void initializeSystems(Injector injector) {
for (int i = 0, s = systems.size(); i < s; i++) {
BaseSystem system = systems.get(i);
injector.inject(system);
}
for (int i = 0, s = systems.size(); i < s; i++) {
BaseSystem system = systems.get(i);
system.initialize();
}
}
代码示例来源:origin: net.onedaybeard.artemis/artemis-odb
void processComponentIdentity(int id, BitVector componentBits) {
for (int i = 0, s = subscriptions.size(); s > i; i++) {
subscriptions.get(i).processComponentIdentity(id, componentBits);
}
}
代码示例来源:origin: junkdog/artemis-odb
void processComponentIdentity(int id, BitVector componentBits) {
for (int i = 0, s = subscriptions.size(); s > i; i++) {
subscriptions.get(i).processComponentIdentity(id, componentBits);
}
}
代码示例来源:origin: junkdog/artemis-odb
private int getComponentCount(SaveFileFormat.ComponentIdentifiers identifiers) {
int count = 0;
for (int i = 0, s = components.size(); s > i; i++) {
Component c = components.get(i);
if (identifiers.isTransient(c.getClass()))
continue;
if (defaultValues.hasDefaultValues(c))
continue;
count++;
}
return count;
}
代码示例来源:origin: junkdog/artemis-odb
void translate(Component c, Field field, Bag<Entity> translatedIds) {
try {
Entity e = (Entity) field.get(c);
if (e != null) {
int oldId = e.getId();
field.set(c, translatedIds.get(oldId));
}
} catch (ReflectionException e) {
throw new RuntimeException(e);
}
}
},
代码示例来源:origin: junkdog/artemis-odb
private Entity obtain() {
if (limbo.isEmpty()) {
return createEntity(nextId++);
} else {
int id = limbo.popFirst();
recycled.unsafeClear(id);
return entities.get(id);
}
}
代码示例来源:origin: junkdog/artemis-odb
private void removeComponents(int entityId) {
Bag<ComponentMapper> mappers = componentMappers(entityId);
for (int i = 0, s = mappers.size(); s > i; i++) {
mappers.get(i).internalRemove(entityId);
}
setIdentity(entityId, 0);
}
代码示例来源:origin: junkdog/artemis-odb
@Override
public void onCreated(ComponentType type) {
Bag<LinkSite> links = linkFactory.create(type);
if (links.isEmpty())
return;
for (int i = 0, s = links.size(); s > i; i++) {
elm.linkSites.add(links.get(i));
}
}
}
代码示例来源:origin: net.onedaybeard.artemis/artemis-odb
private Entity obtain() {
if (limbo.isEmpty()) {
return createEntity(nextId++);
} else {
int id = limbo.popFirst();
recycled.unsafeClear(id);
return entities.get(id);
}
}
代码示例来源:origin: net.mostlyoriginal.artemis-odb/contrib-core
/** Fetch mapper, or create if missing. */
@SuppressWarnings("unchecked")
private <T extends Component> M<T> getCreateMapper(ComponentType type) {
final int index = type.getIndex();
mappers.ensureCapacity(index);
M m = mappers.get(index);
if (m == null) {
m = setMapper(index, type.getType());
}
return m;
}
代码示例来源:origin: junkdog/artemis-odb
/** Converts java classes to component types. */
private ComponentType[] resolveTypes(World world) {
ComponentTypeFactory tf = world.getComponentManager().typeFactory;
ComponentType[] types = new ComponentType[classes.size()];
for (int i = 0, s = classes.size(); s > i; i++)
types[i] = tf.getTypeFor(classes.get(i));
return types;
}
}
代码示例来源:origin: junkdog/artemis-odb
private void informListeners() {
for (int i = 0, s = listeners.size(); s > i; i++) {
SubscriptionListener listener = listeners.get(i);
if (removed.size() > 0)
listener.removed(removed);
if (inserted.size() > 0)
listener.inserted(inserted);
}
}
}
代码示例来源:origin: junkdog/artemis-odb
@Override
public void validate(int sourceId, Bag<Entity> entities, LinkListener listener) {
for (int i = 0; entities.size() > i; i++) {
Entity e = entities.get(i);
if (!all.getActiveEntityIds().unsafeGet(e.getId())) {
entities.remove(i--);
if (listener != null)
listener.onTargetDead(sourceId, e.getId());
}
}
}
内容来源于网络,如有侵权,请联系作者删除!