Class StorableEntityList<T extends Entity>

java.lang.Object
games.stendhal.server.entity.mapstuff.office.StorableEntityList<T>
Type Parameters:
T - type of the storable entities to be managed by this list
All Implemented Interfaces:
TurnListener
Direct Known Subclasses:
ArrestWarrantList, RentedSignList

public abstract class StorableEntityList<T extends Entity> extends Object implements TurnListener
a list of storable entities that can be accessed by a unique identifier like a name.
Author:
hendrik
  • Constructor Details

  • Method Details

    • add

      public boolean add(T entity)
      Adds a storable entity.
      Parameters:
      entity - storable entity
      Returns:
      true in case the entity was added successfully; false in case no free spot for it was found
    • getByName

      public T getByName(String identifier)
      Returns the storable entity for the specified identifier.
      Parameters:
      identifier - name of entity
      Returns:
      storable entity or null in case there is none
    • removeByName

      public boolean removeByName(String identifier)
      Removes all storable entities for this identifier.
      Parameters:
      identifier - name of entity
      Returns:
      if removed successfully
    • getList

      protected List<T> getList()
      gets a list of storable entities from the zone storage. Note: This is only a temporary snapshot, do not save it outside the scope of a method.
      Returns:
      List of storable entities.
    • setupTurnNotifier

      protected void setupTurnNotifier(int notifyDelta)
    • onTurnReached

      public void onTurnReached(int currentTurn)
      Description copied from interface: TurnListener
      This method is called when the turn number is reached.
      Specified by:
      onTurnReached in interface TurnListener
      Parameters:
      currentTurn - current turn number
    • getName

      protected abstract String getName(T entity)
    • shouldExpire

      protected boolean shouldExpire(T entity)