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.
All Implemented Interfaces:
Container<S>, Iterable<S>

public class SystemGroup<S extends SystemBase> extends Object implements Container<S>
A wrapper for systems of the same type. All systems in a group are executed during the same step of the game loop.
  • Constructor Details Link icon

    • SystemGroup Link icon

      public SystemGroup(World world, Class<S> type)
      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 Link icon

    • add Link icon

      public boolean add(SystemBase system) throws IllegalStateException
      Adds a system to this group if it matches the type of this group.
      Specified by:
      add in interface Container<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 Link icon

      public boolean isEmpty()
      Returns true if this group is empty.
      Specified by:
      isEmpty in interface Container<S extends SystemBase>
      Returns:
      True if this container has no items.
    • size Link icon

      public int size()
      Returns the amount of systems in this group.
      Specified by:
      size in interface Container<S extends SystemBase>
      Returns:
      The amount of items in this container.
    • forEach Link icon

      public void forEach(Consumer<? super S> consumer)
      Iterates over each system in this group.
      Specified by:
      forEach in interface Iterable<S extends SystemBase>
    • register Link icon

      public void register(Entity entity)
      Registers an entity in all systems in this group.
    • unregister Link icon

      public void unregister(Entity entity)
      Unregisters an entity from all systems in this group.
    • iterator Link icon

      public Iterator<S> iterator()
      Specified by:
      iterator in interface Iterable<S extends SystemBase>
    • clear Link icon

      public void clear()
      Removes all systems from this group.
      Specified by:
      clear in interface Container<S extends SystemBase>