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

  • All Implemented Interfaces:
    java.io.Serializable

    public class AutojoinList<G extends GameObject<G,​A,​R>,​A extends MapArchObject<A>,​R extends Archetype<G,​A,​R>>
    extends java.lang.Object
    implements java.io.Serializable
    Contains a list of (typically wall-)arches which do autojoining.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int EAST  
      static int NORTH  
      static int SIZE
      The number of archetypes in an autojoin list.
      static int SOUTH  
      static int WEST  
    • Constructor Summary

      Constructors 
      Constructor Description
      AutojoinList​(@NotNull java.lang.Iterable<java.util.List<R>> archetypes)
      Creates a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getAlternativeIndex​(R archetype)
      Returns the index of an Archetype if it is an alternative archetype for any direction.
      R getArchetype​(int index)  
      @NotNull java.lang.Iterable<R> getArchetypes​(int index)
      Returns all archetypes for an index.
      int getIndex​(R archetype)
      Looks up the given node in the archetype array of this class.
      boolean isMainIndex​(R archetype)
      Returns the index of an Archetype if it is a main archetype for any direction.
      • Methods inherited from class java.lang.Object

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

      • AutojoinList

        public AutojoinList​(@NotNull
                            @NotNull java.lang.Iterable<java.util.List<R>> archetypes)
                     throws IllegalAutojoinListException
        Creates a new instance.
        Parameters:
        archetypes - the archetypes that form a set of join-able archetypes
        Throws:
        IllegalAutojoinListException - if the autojoin list cannot be created
    • Method Detail

      • getIndex

        public int getIndex​(@NotNull
                            R archetype)
        Looks up the given node in the archetype array of this class.
        Parameters:
        archetype - the node to lookup
        Returns:
        the index of the node in the array
      • isMainIndex

        public boolean isMainIndex​(@NotNull
                                   R archetype)
        Returns the index of an Archetype if it is a main archetype for any direction.
        Parameters:
        archetype - the archetype to check
        Returns:
        whether the archetype is a main archetype
      • getAlternativeIndex

        public int getAlternativeIndex​(@NotNull
                                       R archetype)
        Returns the index of an Archetype if it is an alternative archetype for any direction.
        Parameters:
        archetype - the archetype to check
        Returns:
        the direction or -1
      • getArchetype

        @NotNull
        public R getArchetype​(int index)
      • getArchetypes

        @NotNull
        public @NotNull java.lang.Iterable<R> getArchetypes​(int index)
        Returns all archetypes for an index.
        Parameters:
        index - the index
        Returns:
        the archetypes; the result contains at least one entry