Interface Rules

  • All Known Implementing Classes:
    EmptyRules, GenericRules

    public interface Rules

    A class summarizing the static information about a game system (a set of rules).

    If internationalization is a concern, implementing sub-classes should ensure that the access-methods to the various collections (getXXX()) return their objects not only by their (usually language-independent) id but also by their (language-dependent) name as it may be supplied by the user.

    Iterators should enumerate items in the order in which they were inserted

    If necessary, subclasses could also provide additional access methods to distinguish between an access by id or name.

    The methods called getXXX(ID id, boolean add) adds and returns a new Object.

    • Method Detail

      • getRegionType

        RegionType getRegionType​(StringID id,
                                 boolean add)
        Returns the region type with given id. If there is no such skill type and add == true, a new skill type is added and returns. Otherwise, null is returned.
      • getRegionType

        RegionType getRegionType​(StringID id)
        Shorthand for getRegionType(id, false).
      • getRegionTypeIterator

        java.util.Iterator<RegionType> getRegionTypeIterator()
        Returns an iterator over all region types.
      • getRegionTypes

        java.util.Collection<RegionType> getRegionTypes()
        Returns a collection of all region types.
      • getRegionType

        RegionType getRegionType​(java.lang.String id,
                                 boolean add)
        get RegionType by (possibly localized) name.
      • getRegionType

        RegionType getRegionType​(java.lang.String id)
        Shorthand for getRegionType(id, false);
      • getRace

        Race getRace​(StringID id)
        Shorthand for getRace(id, false)
      • getRace

        Race getRace​(StringID id,
                     boolean add)
        Returns the race with given id. If there is no such skill type and add == true, a new skill type is added and returns. Otherwise, null is returned.
      • getRaceIterator

        java.util.Iterator<Race> getRaceIterator()
        Returns an iterator over all races.
      • getRaces

        java.util.Collection<Race> getRaces()
        Returns an iterator over all races.
      • getRace

        Race getRace​(java.lang.String id,
                     boolean add)
        get Race by (possibly localized) name
      • getRace

        Race getRace​(java.lang.String id)
        shorthand for getRace(id, false)
      • getShipType

        ShipType getShipType​(StringID id)
        Shorthand for getShipType(id, false)
      • getShipType

        ShipType getShipType​(StringID id,
                             boolean add)
        Returns the ship type with given id. If there is no such skill type and add == true, a new skill type is added and returns. Otherwise, null is returned.
      • getShipTypeIterator

        java.util.Iterator<ShipType> getShipTypeIterator()
        Returns an iterator over all ship types.
      • getShipTypes

        java.util.Collection<ShipType> getShipTypes()
        Returns an collection of all ship types.
      • getShipType

        ShipType getShipType​(java.lang.String id,
                             boolean add)
        get ShipType by (possibly localized) name
      • getShipType

        ShipType getShipType​(java.lang.String id)
        Shorthand for getShipType(id, false)
      • getBuildingType

        BuildingType getBuildingType​(StringID id)
        Shorthand for getBuildingType(id, false)
      • getBuildingType

        BuildingType getBuildingType​(StringID id,
                                     boolean add)
        Returns the building type with given id. If there is no such skill type and add == true, a new skill type is added and returns. Otherwise, null is returned.
      • getBuildingTypeIterator

        java.util.Iterator<BuildingType> getBuildingTypeIterator()
        Returns an iterator over all building types (including CastleTypes).
      • getBuildingTypes

        java.util.Collection<BuildingType> getBuildingTypes()
        Returns a collection of all building types (including CastleTypes).
      • getBuildingType

        BuildingType getBuildingType​(java.lang.String id,
                                     boolean add)
        get BuildingType by (possibly localized) name
      • getBuildingType

        BuildingType getBuildingType​(java.lang.String id)
        Shorthand for getBuildingType(id, false)
      • getCastleType

        CastleType getCastleType​(StringID id)
        Shorthand for getCastleType(id, false)
      • getCastleType

        CastleType getCastleType​(StringID id,
                                 boolean add)
        Returns the castle type with given id. If there is no such skill type and add == true, a new skill type is added and returns. Otherwise, null is returned.
      • getCastleTypeIterator

        java.util.Iterator<CastleType> getCastleTypeIterator()
        Returns an iterator of all castle types.
      • getCastleTypes

        java.util.Collection<CastleType> getCastleTypes()
        Returns a collection of all castle types.
      • getCastleType

        CastleType getCastleType​(java.lang.String id,
                                 boolean add)
        get CastleType by (possibly localized) name
      • getCastleType

        CastleType getCastleType​(java.lang.String id)
        Shorthand for getCastleType(id, false)
      • getItemType

        ItemType getItemType​(StringID id)
        Shorthand for getItemType(id, false)
      • getItemType

        ItemType getItemType​(StringID id,
                             boolean add)
        Returns the item type with given id. If there is no such skill type and add == true, a new skill type is added and returns. Otherwise, null is returned.
      • getItemTypeIterator

        java.util.Iterator<ItemType> getItemTypeIterator()
        Returns an iterator over all item types.
      • getItemTypes

        java.util.Collection<ItemType> getItemTypes()
        Returns a collection of all item types.
      • getItemType

        ItemType getItemType​(java.lang.String id,
                             boolean add)
        get ItemType by (possibly localized) name
        Parameters:
        id - An id, like "Silber".
        add - If this is true, a type will be added if it does not exist, yet.
        Returns:
        The item type corresponding to the id or null if the type is unknown or id is null or empty.
      • getItemType

        ItemType getItemType​(java.lang.String id)
        Shorthand for getItemType(id, false).
        Parameters:
        id - An id, like "Silber".
        Returns:
        The item type corresponding to the id or null if the type is unknown.
      • getSkillType

        SkillType getSkillType​(StringID id)
        Returns the skill type with the given id.
        Returns:
        the skill type with the given id or null if there is no such skill type.
      • getSkillType

        SkillType getSkillType​(StringID id,
                               boolean add)
        Returns the skill type with given id. If there is no such skill type and add == true, a new skill type is added and returns. Otherwise, null is returned.
      • getSkillTypeIterator

        java.util.Iterator<SkillType> getSkillTypeIterator()
        Returns an iterator over all skill types.
      • getSkillTypes

        java.util.Collection<SkillType> getSkillTypes()
        Returns a collection of all skill types.
      • getSkillType

        SkillType getSkillType​(java.lang.String id,
                               boolean add)
        get SkillType by (possibly localized) name
      • getSkillType

        SkillType getSkillType​(java.lang.String id)
        Shorthand for getSkillType(id, false)
      • getItemCategory

        ItemCategory getItemCategory​(StringID id)
        Shorthand for getItemCategory(id, false)
      • getItemCategory

        ItemCategory getItemCategory​(StringID id,
                                     boolean add)
        Returns the item category with given id. If there is no such skill type and add == true, a new skill type is added and returns. Otherwise, null is returned.
      • getItemCategoryIterator

        java.util.Iterator<ItemCategory> getItemCategoryIterator()
        Returns an iterator over all item categories.
      • getItemCategories

        java.util.Collection<ItemCategory> getItemCategories()
        Returns a collection of all item categories.
      • getItemCategory

        ItemCategory getItemCategory​(java.lang.String id,
                                     boolean add)
        get ItemCategory by (possibly localized) name
      • getItemCategory

        ItemCategory getItemCategory​(java.lang.String id)
        Shorthand for getItemCategory(id, false)
      • getSkillCategory

        SkillCategory getSkillCategory​(StringID id)
        Shorthand for getSkillCategory(id, false)
      • getSkillCategory

        SkillCategory getSkillCategory​(StringID id,
                                       boolean add)
        Returns the skill category with given id. If there is no such skill type and add == true, a new skill type is added and returns. Otherwise, null is returned.
      • getSkillCategoryIterator

        java.util.Iterator<SkillCategory> getSkillCategoryIterator()
        Returns an iterator over all skill categories.
      • getSkillCategories

        java.util.Collection<SkillCategory> getSkillCategories()
        Returns a collection of all skill categories.
      • getSkillCategory

        SkillCategory getSkillCategory​(java.lang.String id,
                                       boolean add)
        get SkillCategory by (possibly localized) name
      • getSkillCategory

        SkillCategory getSkillCategory​(java.lang.String id)
        Shorthand for getSkillCategory(id, false)
      • getOptionCategory

        OptionCategory getOptionCategory​(StringID id)
        Shorthand for getOptionCategory(id, false)
      • getOptionCategory

        OptionCategory getOptionCategory​(StringID id,
                                         boolean add)
        Returns the option category with given id. If there is no such skill type and add == true, a new skill type is added and returns. Otherwise, null is returned.
      • getOptionCategoryIterator

        java.util.Iterator<OptionCategory> getOptionCategoryIterator()
        Returns an iterator over all option categories.
      • getOptionCategories

        java.util.Collection<OptionCategory> getOptionCategories()
        Returns a collection of all option categories.
      • getOptionCategory

        OptionCategory getOptionCategory​(java.lang.String id,
                                         boolean add)
        get OptionCategory by (possibly localized) name
      • getOptionCategory

        OptionCategory getOptionCategory​(java.lang.String id)
        Shorthand for getOptionCategory(id, false)
      • getAllianceCategory

        AllianceCategory getAllianceCategory​(StringID id)
        Returns the alliance category with the given id.
      • getAllianceCategory

        AllianceCategory getAllianceCategory​(StringID id,
                                             boolean add)
        Returns the alliance category with the given id. If add is true and the id is not available, it will be added
      • getAllianceCategoryIterator

        java.util.Iterator<AllianceCategory> getAllianceCategoryIterator()
        Returns a list of all possible alliance categories.
      • getAllianceCategories

        java.util.Collection<AllianceCategory> getAllianceCategories()
        Returns a list of all possible alliance categories.
      • getAllianceCategory

        AllianceCategory getAllianceCategory​(java.lang.String id,
                                             boolean add)
        get AllianceCategory by (possibly localized) name
      • getAllianceCategory

        AllianceCategory getAllianceCategory​(java.lang.String id)
        get AllianceCategory by (possibly localized) name
      • changeName

        ObjectType changeName​(java.lang.String from,
                              java.lang.String to)
        Changes the name of an object identified by the given old name.
        Returns:
        the modified object type or null, if no object type is registered with the specified id.
      • setGameSpecificStuffClassName

        void setGameSpecificStuffClassName​(java.lang.String className)
                                    throws java.io.IOException
        Returns the GameSpecificStuff object for the name specified by setGameSpecificClassName.
        Throws:
        java.io.IOException - If rules are not readable
      • getGameSpecificStuff

        GameSpecificStuff getGameSpecificStuff()
        Returns the GameSpecificStuff object for the name specified by setGameSpecificClassName.
      • getOrderfileStartingString

        java.lang.String getOrderfileStartingString()
        Gets the game specific string with which order files should start.
        Returns:
        the game specific line with which order files should start, not including line break
      • setOrderfileStartingString

        void setOrderfileStartingString​(java.lang.String startingString)
        Sets the game specific string with which order files should start.
        Parameters:
        startingString -
      • getOrder

        OrderType getOrder​(StringID id)
        Returns the order type with the given id.
      • getOrder

        OrderType getOrder​(StringID id,
                           boolean add)
        Returns the order type with the given id. If add is true and the id is not available, it will be added.
      • getOrders

        java.util.Collection<OrderType> getOrders()
        Returns all orders.