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 TypeMethodDescriptionboolean
add
(SystemBase system) Adds a system to this group if it matches the type of this group.void
clear()
Removes all systems from this group.void
Iterates over each system in this group.boolean
isEmpty()
Returns true if this group is empty.iterator()
void
Registers an entity in all systems in this group.int
size()
Returns the amount of systems in this group.void
unregister
(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, wait
Methods inherited from interface java.lang.Iterable
spliterator
-
Constructor Details
-
Method Details
-
add
Adds a system to this group if it matches the type of this group.- Specified by:
add
in 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:
isEmpty
in 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:
size
in interfaceContainer<S extends SystemBase>
- Returns:
- The amount of items in this container.
-
forEach
Iterates over each system in this group.- Specified by:
forEach
in 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:
iterator
in interfaceIterable<S extends SystemBase>
-
clear
public void clear()Removes all systems from this group.- Specified by:
clear
in interfaceContainer<S extends SystemBase>
-