public class DefaultArchetypeSet<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> extends java.lang.Object implements ArchetypeSet<G,A,R>
Constructor and Description |
---|
DefaultArchetypeSet(@NotNull ArchetypeFactory<G,A,R> archetypeFactory,
@Nullable java.lang.String imageSet)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addArchetype(R archetype)
Adds an Archetype to this Set.
|
void |
addArchetypeSetListener(@NotNull ArchetypeSetListener<G,A,R> listener)
Registers an ArchetypeSetListener.
|
void |
connectFaces() |
R |
getArchetype(@NotNull java.lang.String archetypeName)
Returns an Archetype by its name.
|
int |
getArchetypeCount()
Returns the number of Archetypes available.
|
@NotNull java.util.Collection<R> |
getArchetypes()
Returns a read-only collection of all
Archetypes . |
@Nullable java.lang.String |
getImageSet()
Returns the image set.
|
R |
getOrCreateArchetype(@NotNull java.lang.String archetypeName)
Returns an archetype by its name.
|
boolean |
isLoadedFromArchive()
Returns whether the Archetypes in this ArchetypeSet were loaded from an
archive.
|
void |
removeArchetypeSetListener(@NotNull ArchetypeSetListener<G,A,R> listener)
Removes an
ArchetypeSetListener . |
void |
setLoadedFromArchive(boolean loadedFromArchive)
Sets whether Archetypes were loaded from an archive.
|
public DefaultArchetypeSet(@NotNull @NotNull ArchetypeFactory<G,A,R> archetypeFactory, @Nullable @Nullable java.lang.String imageSet)
archetypeFactory
- the archetype factory to useimageSet
- the image set to use@Nullable public @Nullable java.lang.String getImageSet()
ArchetypeSet
getImageSet
in interface ArchetypeSet<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
null
public boolean isLoadedFromArchive()
ArchetypeSet
isLoadedFromArchive
in interface ArchetypeSet<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
true
if loaded from an archive, otherwise false
public int getArchetypeCount()
ArchetypeSet
getArchetypeCount
in interface ArchetypeSet<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
@NotNull public R getArchetype(@NotNull @NotNull java.lang.String archetypeName) throws UndefinedArchetypeException
ArchetypeSet
getArchetype
in interface ArchetypeSet<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
archetypeName
- the name of the Archetype to getUndefinedArchetypeException
- if the no such archetype existsfor a similar method that creates
undefined archetypes
@NotNull public R getOrCreateArchetype(@NotNull @NotNull java.lang.String archetypeName)
ArchetypeSet
Archetype
which has Archetype.isUndefinedArchetype()
set.getOrCreateArchetype
in interface ArchetypeSet<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
archetypeName
- the archetype nameArchetypeSet.getArchetype(String)
public void addArchetype(@NotNull R archetype) throws DuplicateArchetypeException
ArchetypeSet
addArchetype
in interface ArchetypeSet<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
archetype
- the archetype to addDuplicateArchetypeException
- if the archetype name is not uniquepublic void setLoadedFromArchive(boolean loadedFromArchive)
ArchetypeSet
setLoadedFromArchive
in interface ArchetypeSet<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
loadedFromArchive
- true
when loaded from archive, otherwise
false
ArchetypeSet.isLoadedFromArchive()
@NotNull public @NotNull java.util.Collection<R> getArchetypes()
ArchetypeSet
Archetypes
.getArchetypes
in interface ArchetypeSet<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
public void addArchetypeSetListener(@NotNull @NotNull ArchetypeSetListener<G,A,R> listener)
addArchetypeSetListener
in interface ArchetypeSet<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
listener
- ArchetypeSetListener to registerpublic void removeArchetypeSetListener(@NotNull @NotNull ArchetypeSetListener<G,A,R> listener)
ArchetypeSet
ArchetypeSetListener
.removeArchetypeSetListener
in interface ArchetypeSet<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
listener
- the listener to removepublic void connectFaces()
connectFaces
in interface ArchetypeSet<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>