Package 

Interface Manager

  • All Implemented Interfaces:

    
    public interface Manager<T extends Object, ID extends Object>
    
                        

    A manager for storing and retrieving T with a key type of ID.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract Set<T> get() Gets an unmodifiable Set of Ts.
      abstract Boolean contains(ID id) Gets if this manager contains an item with the given id.
      abstract Unit add(T toAdd) Adds a T to the managed Ts.
      abstract Unit addAll(Collection<T> toAdd) Adds all of the given values to the managed Ts.
      abstract Unit remove(ID id) Removes any Ts that have the given id.
      abstract T getById(ID id) Attempts to fetch a T by the given id.
      abstract Unit clear() Clears the managed items.
      abstract T random() Returns a random item from the managed items, null if unable to pick one.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • get

         abstract Set<T> get()

        Gets an unmodifiable Set of Ts.

      • contains

         abstract Boolean contains(ID id)

        Gets if this manager contains an item with the given id.

        Parameters:
        id - ID of item to look for
      • add

         abstract Unit add(T toAdd)

        Adds a T to the managed Ts. Will overwrite any other T with the same ID.

        Parameters:
        toAdd - item to add
      • addAll

         abstract Unit addAll(Collection<T> toAdd)

        Adds all of the given values to the managed Ts. Will overwrite any other Ts with the same IDs.

        Parameters:
        toAdd - items to add
      • remove

         abstract Unit remove(ID id)

        Removes any Ts that have the given id.

        Parameters:
        id - ID to remove
      • getById

         abstract T getById(ID id)

        Attempts to fetch a T by the given id. Returns null if none found.

        Parameters:
        id - ID to search by
      • clear

         abstract Unit clear()

        Clears the managed items.

      • random

         abstract T random()

        Returns a random item from the managed items, null if unable to pick one.