com.artemis.systems.EntityProcessingSystem Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of artemis-odb Show documentation
Show all versions of artemis-odb Show documentation
Fork of Artemis Entity System Framework.
package com.artemis.systems;
import com.artemis.Aspect;
import com.artemis.Entity;
import com.artemis.EntitySubscription;
import com.artemis.EntitySystem;
import com.artemis.utils.Bag;
/**
* Entity reference iterating system.
*
* System that iterates over {@link EntitySubscription} member entities by
* entity reference.
*
* Use this when you need to process entities matching an {@link Aspect},
* and you prefer to work with {@link Entity}.
*
* This is a convenience system. We suggest to use {@link IteratingSystem}
* instead, it sits closer to the metal and enjoys better long term support.
*
* @author Arni Arent
* @author Adrian Papari
*/
public abstract class EntityProcessingSystem extends EntitySystem {
/**
* Creates a new EntityProcessingSystem.
* @param aspect
* the aspect to match entities
*/
public EntityProcessingSystem(Aspect.Builder aspect) {
super(aspect);
}
/**
* Process a entity this system is interested in.
* @param e
* the entity to process
*/
protected abstract void process(Entity e);
/** @inheritDoc */
@Override
protected final void processSystem() {
Bag entities = getEntities();
Object[] array = entities.getData();
for (int i = 0, s = entities.size(); s > i; i++) {
process((Entity) array[i]);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy