本文整理了Java中com.artemis.utils.Bag.safeGet()
方法的一些代码示例,展示了Bag.safeGet()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bag.safeGet()
方法的具体详情如下:
包路径:com.artemis.utils.Bag
类名称:Bag
方法名:safeGet
[英]Returns the element at the specified position in Bag. This method ensures that the bag grows if the requested index is outside the bounds of the current backing array.
[中]返回包中指定位置的元素。如果请求的索引超出当前备份数组的边界,此方法可确保行李增长。
代码示例来源:origin: junkdog/artemis-odb
public UUID getUuid(Entity e) {
UUID uuid = entityToUuid.safeGet(e.getId());
if (uuid == null) {
uuid = UUID.randomUUID();
setUuid(e, uuid);
}
return uuid;
}
代码示例来源:origin: net.onedaybeard.artemis/artemis-odb
public UUID getUuid(Entity e) {
UUID uuid = entityToUuid.safeGet(e.getId());
if (uuid == null) {
uuid = UUID.randomUUID();
setUuid(e, uuid);
}
return uuid;
}
代码示例来源:origin: net.onedaybeard.artemis/artemis-odb
private TransmuteOperation operation(int entityId, int compositionId) {
TransmuteOperation operation = operations.safeGet(compositionId);
if (operation == null) {
operation = factory.createOperation(entityId);
operations.set(compositionId, operation);
}
return operation;
}
代码示例来源:origin: junkdog/artemis-odb
private TransmuteOperation operation(int entityId, int compositionId) {
TransmuteOperation operation = operations.safeGet(compositionId);
if (operation == null) {
operation = factory.createOperation(entityId);
operations.set(compositionId, operation);
}
return operation;
}
代码示例来源:origin: junkdog/artemis-odb
public void setUuid(Entity e, UUID newUuid) {
UUID oldUuid = entityToUuid.safeGet(e.getId());
if (oldUuid != null)
uuidToEntity.remove(oldUuid);
uuidToEntity.put(newUuid, e);
entityToUuid.set(e.getId(), newUuid);
}
}
代码示例来源:origin: net.onedaybeard.artemis/artemis-odb
public void setUuid(Entity e, UUID newUuid) {
UUID oldUuid = entityToUuid.safeGet(e.getId());
if (oldUuid != null)
uuidToEntity.remove(oldUuid);
uuidToEntity.put(newUuid, e);
entityToUuid.set(e.getId(), newUuid);
}
}
代码示例来源:origin: net.onedaybeard.artemis/artemis-odb
@Override
public void deleted(Entity e) {
UUID uuid = entityToUuid.safeGet(e.getId());
if (uuid == null)
return;
Entity oldEntity = uuidToEntity.get(uuid);
if (oldEntity != null && oldEntity.equals(e))
uuidToEntity.remove(uuid);
entityToUuid.set(e.getId(), null);
}
代码示例来源:origin: junkdog/artemis-odb
@Override
public void deleted(Entity e) {
UUID uuid = entityToUuid.safeGet(e.getId());
if (uuid == null)
return;
Entity oldEntity = uuidToEntity.get(uuid);
if (oldEntity != null && oldEntity.equals(e))
uuidToEntity.remove(uuid);
entityToUuid.set(e.getId(), null);
}
代码示例来源:origin: junkdog/artemis-odb
E getE(int entityId) {
E e = (E) es.safeGet(entityId);
if ( e == null ) { e = new E().init(this,entityId); es.set(entityId, e); };
return e;
}
}
代码示例来源:origin: DaanVanYperen/libgdx-artemis-quickstart
E getE(int entityId) {
E e = (E) es.safeGet(entityId);
if ( e == null ) { e = new E().init(this,entityId); es.set(entityId, e); };
return e;
}
}
内容来源于网络,如有侵权,请联系作者删除!