本文整理了Java中com.artemis.utils.Bag.remove()
方法的一些代码示例,展示了Bag.remove()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bag.remove()
方法的具体详情如下:
包路径:com.artemis.utils.Bag
类名称:Bag
方法名:remove
[英]Removes the element at the specified position in this Bag.
It does this by overwriting it was last element then removing last element
[中]
代码示例来源:origin: stackoverflow.com
Bag myBag = new HashBag();
myBag.add("Orange");
myBag.add("Apple", 4);
myBag.add("Apple");
myBag.remove("Apple", 2);
int apples = myBag.getCount("Apple"); // Should be 3.
int kumquats = myBag.getCount("Kumquat"); // Should be 0.
代码示例来源:origin: net.onedaybeard.artemis/artemis-odb
/**
* Remove the specified component from this builder, if it is present (optional operation).
*
* @param type
* @return This instance for chaining.
*/
public ArchetypeBuilder remove(Class<? extends Component> type) {
classes.remove(type);
return this;
}
代码示例来源:origin: junkdog/artemis-odb
/**
* Remove previously registered listener.
*
* @param listener listener to remove.
*/
public void removeSubscriptionListener(SubscriptionListener listener) {
extra.listeners.remove(listener);
}
代码示例来源:origin: junkdog/artemis-odb
/**
* Remove the specified component from this builder, if it is present (optional operation).
*
* @param types
* @return This instance for chaining.
*/
public ArchetypeBuilder remove(Class<? extends Component>... types) {
for (int i = 0; types.length > i; i++) {
classes.remove(types[i]);
}
return this;
}
代码示例来源:origin: junkdog/artemis-odb
/**
* Remove the specified component from this builder, if it is present (optional operation).
*
* @param type
* @return This instance for chaining.
*/
public ArchetypeBuilder remove(Class<? extends Component> type) {
classes.remove(type);
return this;
}
代码示例来源:origin: net.onedaybeard.artemis/artemis-odb
/**
* Remove the specified component from this builder, if it is present (optional operation).
*
* @param types
* @return This instance for chaining.
*/
public ArchetypeBuilder remove(Class<? extends Component>... types) {
for (int i = 0; types.length > i; i++) {
classes.remove(types[i]);
}
return this;
}
代码示例来源:origin: net.onedaybeard.artemis/artemis-odb
/**
* Remove previously registered listener.
*
* @param listener listener to remove.
*/
public void removeSubscriptionListener(SubscriptionListener listener) {
extra.listeners.remove(listener);
}
代码示例来源:origin: junkdog/artemis-odb
/**
* Remove the association of an entity with a player.
*
* @param e
* the entity to remove
*/
public void removeFromPlayer(Entity e) {
String player = playerByEntity.get(e);
if(player != null) {
Bag<Entity> entities = entitiesByPlayer.get(player);
if(entities != null) {
entities.remove(e);
}
}
}
代码示例来源:origin: junkdog/artemis-odb
/**
* Remove a player from his team.
*
* @param player
* the player to remove
*/
public void removeFromTeam(String player) {
String team = teamByPlayer.remove(player);
if(team != null) {
Bag<String> players = playersByTeam.get(team);
if(players != null) {
players.remove(player);
}
}
}
代码示例来源:origin: net.mostlyoriginal.artemis-odb/contrib-core
/**
* Remove this id from the tree
*/
public void remove (int id) {
Container c = idToContainer.get(id);
if (c == null)
return;
if (c.parent != null) {
c.parent.containers.remove(c);
}
cPool.free(c);
}
代码示例来源:origin: DaanVanYperen/artemis-odb-contrib
/**
* Remove this id from the tree
*/
public void remove (int id) {
Container c = idToContainer.get(id);
if (c == null)
return;
if (c.parent != null) {
c.parent.containers.remove(c);
}
cPool.free(c);
}
代码示例来源:origin: net.mostlyoriginal.artemis-odb/contrib-core
/**
* Gets free object from pool or creates a new one if there are no free objects.
*
* @see #free(Object)
*/
public T obtain() {
T obj = !pool.isEmpty()
? pool.remove(pool.size() - 1)
: instantiateObject();
return obj;
}
代码示例来源:origin: DaanVanYperen/artemis-odb-contrib
/**
* Gets free object from pool or creates a new one if there are no free objects.
*
* @see #free(Object)
*/
public T obtain() {
T obj = !pool.isEmpty()
? pool.remove(pool.size() - 1)
: instantiateObject();
return obj;
}
代码示例来源:origin: DaanVanYperen/artemis-odb-contrib
/**
* Reset the QuadTree by removing all nodes and stored ids
*/
@Override public void reset () {
for (int i = containers.size() - 1; i >= 0; i--) {
cPool.free(containers.remove(i));
}
for (int i = 0; i < nodes.length; i++) {
if (nodes[i] != null) {
qtPool.free(nodes[i]);
nodes[i] = null;
}
}
}
代码示例来源:origin: net.mostlyoriginal.artemis-odb/contrib-core
/**
* Update position for this id with new one
*/
public void update (int id, float x, float y, float width, float height) {
Container c = idToContainer.get(id);
c.set(id, x, y, width, height);
QuadTree qTree = c.parent;
qTree.containers.remove(c);
while (qTree.parent != null && !qTree.bounds.contains(c)) {
qTree = qTree.parent;
}
qTree.insert(c);
}
代码示例来源:origin: DaanVanYperen/artemis-odb-contrib
/**
* Update position for this id with new one
*/
public void update (int id, float x, float y, float width, float height) {
Container c = idToContainer.get(id);
c.set(id, x, y, width, height);
QuadTree qTree = c.parent;
qTree.containers.remove(c);
while (qTree.parent != null && !qTree.bounds.contains(c)) {
qTree = qTree.parent;
}
qTree.insert(c);
}
代码示例来源: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());
}
}
}
代码示例来源: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());
}
}
}
代码示例来源:origin: net.onedaybeard.artemis/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());
}
}
}
代码示例来源:origin: net.onedaybeard.artemis/artemis-odb-weaver
@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());
}
}
}
内容来源于网络,如有侵权,请联系作者删除!