Package net.sf.gridarta.model.resource
Class AbstractResources<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
- java.lang.Object
-
- net.sf.gridarta.model.resource.AbstractResources<G,A,R>
-
- Direct Known Subclasses:
DefaultResources,DefaultResources,DefaultResources
public abstract class AbstractResources<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> extends java.lang.ObjectMaintains resources.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractResources(@NotNull GameObjectParser<G,A,R> gameObjectParser, @NotNull ArchetypeSet<G,A,R> archetypeSet)Creates a new instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleancanWriteCollected()Whether the resources can be written in collected form.voidreadCollected(@NotNull ProjectSettings projectSettings, @NotNull ErrorView errorView)Reads the resources from a collection.protected abstract @NotNull java.util.List<G>readCollectedInt(@NotNull ProjectSettings projectSettings, @NotNull ErrorView errorView)Reads the resources from a collection.voidreadFiles(@NotNull ProjectSettings projectSettings, @NotNull ErrorView errorView)Reads the resources from individual files.protected abstract voidreadFilesInt(@NotNull ProjectSettings projectSettings, @NotNull ErrorView errorView, @NotNull java.util.List<G> invObjects)Reads the resources from individual files.voidwriteCollected(@NotNull net.sf.japi.swing.misc.Progress progress, @NotNull java.io.File collectedDirectory)Writes the resources in collected form.protected abstract voidwriteCollectedInt(@NotNull net.sf.japi.swing.misc.Progress progress, @NotNull java.io.File collectedDirectory)Writes the resources in collected form.
-
-
-
Constructor Detail
-
AbstractResources
protected AbstractResources(@NotNull @NotNull GameObjectParser<G,A,R> gameObjectParser, @NotNull @NotNull ArchetypeSet<G,A,R> archetypeSet)Creates a new instance.- Parameters:
gameObjectParser- the game object parser to usearchetypeSet- the archetype set to update
-
-
Method Detail
-
readFiles
public void readFiles(@NotNull @NotNull ProjectSettings projectSettings, @NotNull @NotNull ErrorView errorView)Reads the resources from individual files.- Parameters:
projectSettings- the project settings to read fromerrorView- the error view for reporting problems
-
readCollected
public void readCollected(@NotNull @NotNull ProjectSettings projectSettings, @NotNull @NotNull ErrorView errorView)Reads the resources from a collection.- Parameters:
projectSettings- the project settings to read fromerrorView- the error view for reporting problems
-
canWriteCollected
public boolean canWriteCollected()
Whether the resources can be written in collected form.- Returns:
- returns
truewhen loaded withreadFiles;falsewhen loaded withreadCollected()
-
writeCollected
public void writeCollected(@NotNull @NotNull net.sf.japi.swing.misc.Progress progress, @NotNull @NotNull java.io.File collectedDirectory) throws java.io.IOExceptionWrites the resources in collected form.- Parameters:
progress- the progress to usecollectedDirectory- the collected directory to write to- Throws:
java.io.IOException- if collection failsjava.lang.IllegalStateException- ifcanWriteCollected()returnsfalse
-
readFilesInt
protected abstract void readFilesInt(@NotNull @NotNull ProjectSettings projectSettings, @NotNull @NotNull ErrorView errorView, @NotNull @NotNull java.util.List<G> invObjects)Reads the resources from individual files.- Parameters:
projectSettings- the project settings to read fromerrorView- the error view for reporting problemsinvObjects- all read archetypes
-
readCollectedInt
@NotNull protected abstract @NotNull java.util.List<G> readCollectedInt(@NotNull @NotNull ProjectSettings projectSettings, @NotNull @NotNull ErrorView errorView)
Reads the resources from a collection.- Parameters:
projectSettings- the project settings to read fromerrorView- the error view for reporting problems- Returns:
- all read archetypes
-
writeCollectedInt
protected abstract void writeCollectedInt(@NotNull @NotNull net.sf.japi.swing.misc.Progress progress, @NotNull @NotNull java.io.File collectedDirectory) throws java.io.IOExceptionWrites the resources in collected form.- Parameters:
progress- the progress to usecollectedDirectory- the collected directory to write to- Throws:
java.io.IOException- if collection fails
-
-