public abstract class SimpleTask extends Object implements Task
public class ExampleTask extends SimpleTask { // c1 and c2 are required types // c3 is an optional component type protected void processEntities(TypeA c1, TypeB c2, @Optional TypeC c3) { // perform operations on c1 and c2 if (c3 != null) { // perform additional operations on c3 } } public Task process(EntitySystem system, Job job) { // this will invoke processEntities() for each entity in the system // that has a TypeA and TypeB component. If the entity also has // a TypeC component, it is passed in too, otherwise it's null processEntities(system); return null; } }In the task's
process(EntitySystem, Job)
method, it can then invoke processEntities(EntitySystem)
to perform the automated iteration over matching
entities within the system. SimpleTask will call the identified 'processEntity' method
for each matched entity.Modifier and Type | Class and Description |
---|---|
static interface |
SimpleTask.Optional |
Constructor and Description |
---|
SimpleTask() |
Modifier and Type | Method and Description |
---|---|
Task |
process(EntitySystem system,
Job job)
The default implementation of process() just invokes
processEntities(com.lhkbob.entreri.EntitySystem) immediately and returns no
future task. |
protected void |
processEntities(EntitySystem system)
Process all entities that fit the component profile mandated by the defined
'processEntity()' method in the subclass.
|
public Task process(EntitySystem system, Job job)
processEntities(com.lhkbob.entreri.EntitySystem)
immediately and returns no
future task.protected void processEntities(EntitySystem system)
system
- The system to processCopyright © 2013. All Rights Reserved.