Class AbstractResources<G extends GameObject<G,​A,​R>,​A extends MapArchObject<A>,​R extends Archetype<G,​A,​R>>

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canWriteCollected()
      Whether the resources can be written in collected form.
      void readCollected​(@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.
      void readFiles​(@NotNull ProjectSettings projectSettings, @NotNull ErrorView errorView)
      Reads the resources from individual files.
      protected abstract void readFilesInt​(@NotNull ProjectSettings projectSettings, @NotNull ErrorView errorView, @NotNull java.util.List<G> invObjects)
      Reads the resources from individual files.
      void writeCollected​(@NotNull net.sf.japi.swing.misc.Progress progress, @NotNull java.io.File collectedDirectory)
      Writes the resources in collected form.
      protected abstract void writeCollectedInt​(@NotNull net.sf.japi.swing.misc.Progress progress, @NotNull java.io.File collectedDirectory)
      Writes the resources in collected form.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 use
        archetypeSet - 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 from
        errorView - 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 from
        errorView - the error view for reporting problems
      • canWriteCollected

        public boolean canWriteCollected()
        Whether the resources can be written in collected form.
        Returns:
        returns true when loaded with readFiles; false when loaded with readCollected()
      • writeCollected

        public void writeCollected​(@NotNull
                                   @NotNull net.sf.japi.swing.misc.Progress progress,
                                   @NotNull
                                   @NotNull java.io.File collectedDirectory)
                            throws java.io.IOException
        Writes the resources in collected form.
        Parameters:
        progress - the progress to use
        collectedDirectory - the collected directory to write to
        Throws:
        java.io.IOException - if collection fails
        java.lang.IllegalStateException - if canWriteCollected() returns false
      • 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 from
        errorView - the error view for reporting problems
        invObjects - 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 from
        errorView - 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.IOException
        Writes the resources in collected form.
        Parameters:
        progress - the progress to use
        collectedDirectory - the collected directory to write to
        Throws:
        java.io.IOException - if collection fails