Class Spells<S extends Spell>

  • All Implemented Interfaces:
    java.lang.Iterable<S>

    public class Spells<S extends Spell>
    extends java.lang.Object
    implements java.lang.Iterable<S>
    Common base class for spells and spell lists.
    • Constructor Summary

      Constructors 
      Constructor Description
      Spells()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(S spell)
      Add a spell.
      S getSpell​(int index)
      Return one spell object by index.
      @NotNull java.util.Iterator<S> iterator()
      Return all known spell objects.
      int size()
      Return the number of existing spell objects.
      void sort()
      Sort the added spells after loading is finished.
      • 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

        forEach, spliterator
    • Constructor Detail

      • Spells

        public Spells()
    • Method Detail

      • sort

        public void sort()
        Sort the added spells after loading is finished.
      • size

        public int size()
        Return the number of existing spell objects.
        Returns:
        the number of existing spell objects
      • iterator

        @NotNull
        public @NotNull java.util.Iterator<S> iterator()
        Return all known spell objects.
        Specified by:
        iterator in interface java.lang.Iterable<S extends Spell>
        Returns:
        the spell objects
      • add

        public void add​(@NotNull
                        S spell)
        Add a spell.
        Parameters:
        spell - the spell to add
      • getSpell

        public S getSpell​(int index)
        Return one spell object by index.
        Parameters:
        index - the spell index
        Returns:
        the spell object