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(ArchetypeFactory<G,A,R> archetypeFactory,
java.lang.String imageSet)
Create an DefaultArchetypeSet.
|
Modifier and Type | Method and Description |
---|---|
void |
addArchetype(R archetype)
Adds an Archetype to this Set.
|
void |
addArchetypeSetListener(ArchetypeSetListener<G,A,R> listener)
Register an ArchetypeSetListener.
|
void |
connectFaces() |
R |
getArchetype(java.lang.String archetypeName)
Returns an Archetype by its name.
|
int |
getArchetypeCount()
Returns the number of Archetypes available.
|
java.util.Collection<R> |
getArchetypes()
Returns a read-only collection of all
Archetypes . |
java.lang.String |
getImageSet()
Returns the image set.
|
R |
getOrCreateArchetype(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(ArchetypeSetListener<G,A,R> listener)
Removes an
ArchetypeSetListener . |
void |
setLoadedFromArchive(boolean loadedFromArchive)
Sets whether Archetypes were loaded from an archive.
|
public DefaultArchetypeSet(@NotNull ArchetypeFactory<G,A,R> archetypeFactory, @Nullable java.lang.String imageSet)
archetypeFactory
- the archetype factory to useimageSet
- the image set to use@Nullable public java.lang.String getImageSet()
getImageSet
in interface ArchetypeSet<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
null
public boolean isLoadedFromArchive()
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()
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 java.lang.String archetypeName) throws UndefinedArchetypeException
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 java.lang.String archetypeName)
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
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)
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 java.util.Collection<R> getArchetypes()
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 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 ArchetypeSetListener<G,A,R> listener)
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>>