Class ArchetypeTypeSet

  • All Implemented Interfaces:
    java.lang.Iterable<ArchetypeType>

    public class ArchetypeTypeSet
    extends java.lang.Object
    implements java.lang.Iterable<ArchetypeType>
    Manages ArchetypeType instances, list, and bitmask definitions.
    • Constructor Detail

      • ArchetypeTypeSet

        public ArchetypeTypeSet()
    • Method Detail

      • addArchetypeType

        public void addArchetypeType​(@NotNull
                                     @NotNull ArchetypeType archetypeType)
        Adds an ArchetypeType instance.
        Parameters:
        archetypeType - the archetype type instance
      • getArchetypeType

        @Nullable
        public @Nullable ArchetypeType getArchetypeType​(@NotNull
                                                        @NotNull java.lang.String typeName)
        Returns an ArchetypeType by type name.
        Parameters:
        typeName - the type name to look up
        Returns:
        the archetype type instance or null if the type name does not exist
      • getArchetypeTypeByName

        @NotNull
        public @NotNull ArchetypeType getArchetypeTypeByName​(@NotNull
                                                             @NotNull java.lang.String typeName)
        Finds and returns the type-structure (ArchetypeType) that matches the given 'typeName'. These type-names are "artificial" names, defined in "types.xml". They appear in the type selection box in the attribute-dialog.
        Parameters:
        typeName - the name of the type to get
        Returns:
        the ArchetypeType that matches, or the default ("Misc") type if no match is found
      • getArchetypeTypeByBaseObject

        @NotNull
        public @NotNull ArchetypeType getArchetypeTypeByBaseObject​(@NotNull
                                                                   @NotNull BaseObject<?,​?,​?,​?> baseObject)
        Returns the ArchetypeType for the given BaseObject.
        Parameters:
        baseObject - the base object to find the archetype type for
        Returns:
        the archetype type for the given base object or the default type if no match was found
      • iterator

        @NotNull
        public @NotNull java.util.Iterator<ArchetypeType> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<ArchetypeType>
      • getArchetypeTypeIndex

        public int getArchetypeTypeIndex​(@NotNull
                                         @NotNull ArchetypeType archetypeType)
        Returns the index of an ArchetypeType instance.
        Parameters:
        archetypeType - the archetype type instance
        Returns:
        the index
      • getArchetypeTypeCount

        public int getArchetypeTypeCount()
        Returns the number of ArchetypeTypes in the list. The default type is not counted.
        Returns:
        the number of archetype types in the list
      • isFallbackArchetypeType

        public boolean isFallbackArchetypeType​(@NotNull
                                               @NotNull ArchetypeType archetypeType)
        Returns whether a given ArchetypeType is the fallback archetype type used for game objects not matching any defined archetype type.
        Parameters:
        archetypeType - the archetype type to check
        Returns:
        whether the given archetype type is the fallback archetype type
      • addList

        public void addList​(@NotNull
                            @NotNull java.lang.String attribute,
                            @NotNull
                            @NotNull ArchetypeTypeList list)
        Adds a list definition.
        Parameters:
        attribute - the attribute name
        list - the list definition
      • getList

        @Nullable
        public @Nullable ArchetypeTypeList getList​(@NotNull
                                                   @NotNull java.lang.String listName)
        Returns a list type definition.
        Parameters:
        listName - the list name
        Returns:
        the list type definition or null if the list does not exist
      • addBitmask

        public void addBitmask​(@NotNull
                               @NotNull java.lang.String attribute,
                               @NotNull
                               @NotNull AttributeBitmask attributeBitmask)
        Adds a bitmask definition.
        Parameters:
        attribute - the attribute name
        attributeBitmask - the list definition
      • getBitmask

        @Nullable
        public @Nullable AttributeBitmask getBitmask​(@NotNull
                                                     @NotNull java.lang.String bitmaskName)
        Returns a bitmask type by name.
        Parameters:
        bitmaskName - the bitmask name to look up
        Returns:
        the bitmask type or null if the name does not exist
      • addAttributeOrder

        public boolean addAttributeOrder​(@NotNull
                                         @NotNull java.lang.String attributeName)
        Adds an attribute name for attribute ordering when saving. The new attribute name is placed after all previously added attribute names and before all other attribute names.
        Parameters:
        attributeName - the attribute name
        Returns:
        whether insertion failed because the attribute name was already known
      • getAttributeOrderComparator

        @NotNull
        public @NotNull java.util.Comparator<java.lang.String> getAttributeOrderComparator()
        Returns a Comparator that sorts attributes keys by the order defined by addAttributeOrder(String).
        Returns:
        the comparator
      • getDisplayName

        @NotNull
        public @NotNull java.lang.String getDisplayName​(@NotNull
                                                        @NotNull BaseObject<?,​?,​?,​?> baseObject)
        Returns a description of this type.
        Parameters:
        baseObject - the base object to describe
        Returns:
        the description
      • toString

        @NotNull
        public @NotNull java.lang.String toString()
        Overrides:
        toString in class java.lang.Object