Package dev.prozilla.pine.core.system
Class SystemGroup<S extends SystemBase>
java.lang.Object
dev.prozilla.pine.core.system.SystemGroup<S>
- Type Parameters:
S- Type of the systems in this group.
A wrapper for systems of the same type.
All systems in a group are executed during the same step of the game loop.
-
Constructor Summary
ConstructorsConstructorDescriptionSystemGroup(World world, Class<S> type) Creates a new system group in a world with systems of a given type. -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(SystemBase system) Adds a system to this group if it matches the type of this group.voidclear()Removes all systems from this group.voidIterates over each system in this group.booleanisEmpty()Returns true if this group is empty.iterator()voidRegisters an entity in all systems in this group.intsize()Returns the amount of systems in this group.voidunregister(Entity entity) Unregisters an entity from all systems in this group.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
spliterator
-
Constructor Details
-
SystemGroup
Creates a new system group in a world with systems of a given type.- Parameters:
type- Type of the systems in this group
-
-
Method Details
-
add
Adds a system to this group if it matches the type of this group.- Specified by:
addin interfaceContainer<S extends SystemBase>- Parameters:
system- Item to add to this container- Returns:
- True if the system matched the type of this group.
- Throws:
IllegalStateException
-
isEmpty
public boolean isEmpty()Returns true if this group is empty.- Specified by:
isEmptyin interfaceContainer<S extends SystemBase>- Returns:
- True if this container has no items.
-
size
public int size()Returns the amount of systems in this group.- Specified by:
sizein interfaceContainer<S extends SystemBase>- Returns:
- The amount of items in this container.
-
forEach
Iterates over each system in this group.- Specified by:
forEachin interfaceIterable<S extends SystemBase>
-
register
Registers an entity in all systems in this group. -
unregister
Unregisters an entity from all systems in this group. -
iterator
- Specified by:
iteratorin interfaceIterable<S extends SystemBase>
-
clear
public void clear()Removes all systems from this group.- Specified by:
clearin interfaceContainer<S extends SystemBase>
-