Gridarta Editor
net.sf.gridarta.model.spells.Spells< S extends Spell > Class Template Reference

Common base class for spells and spell lists. More...

+ Inheritance diagram for net.sf.gridarta.model.spells.Spells< S extends Spell >:
+ Collaboration diagram for net.sf.gridarta.model.spells.Spells< S extends Spell >:

Public Member Functions

void add (@NotNull final S spell)
 Add a spell. More...
 
getSpell (final int index)
 Return one spell object by index. More...
 
Iterator< S > iterator ()
 Return all known spell objects. More...
 
int size ()
 Return the number of existing spell objects. More...
 
void sort ()
 Sort the added spells after loading is finished. More...
 

Private Attributes

final List< S > spells = new ArrayList<>()
 All defined spells. More...
 

Static Private Attributes

static final Comparator< SpellSPELL_COMPARATOR = (o1, o2) -> String.CASE_INSENSITIVE_ORDER.compare(o1.getName(), o2.getName())
 A comparator to sort spells by name. More...
 

Detailed Description

Common base class for spells and spell lists.

Author
Christian Hujer

Definition at line 33 of file Spells.java.

Member Function Documentation

◆ add()

void net.sf.gridarta.model.spells.Spells< S extends Spell >.add ( @NotNull final S  spell)

Add a spell.

Parameters
spellthe spell to add

Definition at line 75 of file Spells.java.

◆ getSpell()

S net.sf.gridarta.model.spells.Spells< S extends Spell >.getSpell ( final int  index)

Return one spell object by index.

Parameters
indexthe spell index
Returns
the spell object

Definition at line 84 of file Spells.java.

◆ iterator()

Iterator<S> net.sf.gridarta.model.spells.Spells< S extends Spell >.iterator ( )

Return all known spell objects.

Returns
the spell objects

Definition at line 67 of file Spells.java.

◆ size()

int net.sf.gridarta.model.spells.Spells< S extends Spell >.size ( )

Return the number of existing spell objects.

Returns
the number of existing spell objects

Definition at line 57 of file Spells.java.

◆ sort()

void net.sf.gridarta.model.spells.Spells< S extends Spell >.sort ( )

Sort the added spells after loading is finished.

Definition at line 49 of file Spells.java.

Member Data Documentation

◆ SPELL_COMPARATOR

final Comparator<Spell> net.sf.gridarta.model.spells.Spells< S extends Spell >.SPELL_COMPARATOR = (o1, o2) -> String.CASE_INSENSITIVE_ORDER.compare(o1.getName(), o2.getName())
staticprivate

A comparator to sort spells by name.

Definition at line 44 of file Spells.java.

Referenced by net.sf.gridarta.model.spells.Spells< net.sf.gridarta.model.spells.GameObjectSpell< G, A, R > >.sort().

◆ spells


The documentation for this class was generated from the following file: