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

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addModifiedFields​(G gameObject, @NotNull java.util.Map<java.lang.String,​java.lang.String> fields)
      Adds the modified fields of a GameObject to a map.
      void collectTempList​(@NotNull java.util.List<G> objects)
      Browse first through the archetype list and attach map arches to it then browse through the face list and try to find the pictures.
      G load​(@NotNull java.io.BufferedReader reader, @NotNull java.lang.String firstLine, @Nullable java.util.Collection<G> objects)
      Parse a game object from a stream.
      G load​(@NotNull java.io.BufferedReader reader, @Nullable java.util.Collection<G> objects)
      Parse a game object from a stream.
      void save​(@NotNull java.lang.Appendable appendable, G gameObject)
      Write a game object object to a stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractGameObjectParser

        protected AbstractGameObjectParser​(@NotNull
                                           @NotNull GameObjectFactory<G,​A,​R> gameObjectFactory,
                                           @NotNull
                                           @NotNull ArchetypeSet<G,​A,​R> archetypeSet)
        Creates a new instance.
        Parameters:
        gameObjectFactory - the game object factory for creating new game object instances
        archetypeSet - the archetype set for looking up archetypes
    • Method Detail

      • load

        @Nullable
        public G load​(@NotNull
                      @NotNull java.io.BufferedReader reader,
                      @Nullable
                      @Nullable java.util.Collection<G> objects)
               throws java.io.IOException
        Description copied from interface: GameObjectParser
        Parse a game object from a stream.
        Specified by:
        load in interface GameObjectParser<G extends GameObject<G,​A,​R>,​A extends MapArchObject<A>,​R extends Archetype<G,​A,​R>>
        Parameters:
        reader - the stream to read
        objects - if non-null, add the read game objects to this collection
        Returns:
        the read game object, or null if the end of the stream was reached
        Throws:
        java.io.IOException - if the stream cannot be read or if a parsing error occurs
      • load

        @Nullable
        public G load​(@NotNull
                      @NotNull java.io.BufferedReader reader,
                      @NotNull
                      @NotNull java.lang.String firstLine,
                      @Nullable
                      @Nullable java.util.Collection<G> objects)
               throws java.io.IOException
        Description copied from interface: GameObjectParser
        Parse a game object from a stream.
        Specified by:
        load in interface GameObjectParser<G extends GameObject<G,​A,​R>,​A extends MapArchObject<A>,​R extends Archetype<G,​A,​R>>
        Parameters:
        reader - the stream to read
        firstLine - the first line to parse before reading from reader
        objects - if non-null, add the read game objects to this collection
        Returns:
        the read game object, or null if the end of the stream was reached
        Throws:
        java.io.IOException - if the stream cannot be read or if a parsing error occurs
        Todo:
        Attributes not relevant during map parsing shouldn't be evaluated here, but in GameObject / ArchetypeParser instead.
      • collectTempList

        public void collectTempList​(@NotNull
                                    @NotNull java.util.List<G> objects)
        Description copied from interface: GameObjectParser
        Browse first through the archetype list and attach map arches to it then browse through the face list and try to find the pictures.
        Specified by:
        collectTempList in interface GameObjectParser<G extends GameObject<G,​A,​R>,​A extends MapArchObject<A>,​R extends Archetype<G,​A,​R>>
        Parameters:
        objects - the list of game objects to collect
      • save

        public void save​(@NotNull
                         @NotNull java.lang.Appendable appendable,
                         @NotNull
                         G gameObject)
                  throws java.io.IOException
        Description copied from interface: GameObjectParser
        Write a game object object to a stream.
        Specified by:
        save in interface GameObjectParser<G extends GameObject<G,​A,​R>,​A extends MapArchObject<A>,​R extends Archetype<G,​A,​R>>
        Parameters:
        appendable - the stream to write to
        gameObject - the game object to write
        Throws:
        java.io.IOException - if the stream cannot be written