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
 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 82 of file Spells.java.

◆ getSpell()

◆ 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 74 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 64 of file Spells.java.

Referenced by net.sf.gridarta.gui.dialog.gameobjectattributes.DialogAttributeInvSpell< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getObjectText().

+ Here is the caller graph for this function:

◆ sort()

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

Sort the added spells after loading is finished.

Definition at line 56 of file Spells.java.

Referenced by net.sf.gridarta.project.ProjectModel<?, ?, ?>.loadGameObjectMatchers().

+ Here is the caller graph for this function:

Member Data Documentation

◆ SPELL_COMPARATOR

final Comparator<Spell> net.sf.gridarta.model.spells.Spells< S extends Spell >.SPELL_COMPARATOR
staticprivate
Initial value:
= new Comparator<Spell>() {
@Override
public int compare(final Spell o1, final Spell o2) {
return String.CASE_INSENSITIVE_ORDER.compare(o1.getName(), o2.getName());
}
}

A comparator to sort spells by name.

Definition at line 44 of file Spells.java.

◆ spells

final List<S> net.sf.gridarta.model.spells.Spells< S extends Spell >.spells = new ArrayList<>()
private

All defined spells.

Definition at line 39 of file Spells.java.


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