Interface Region

    • Method Detail

      • fogOfWar

        boolean fogOfWar()
        Returns true if this region has fog of war.
      • setFogOfWar

        void setFogOfWar​(int fog)
        Sets the fog of war property. 1 means fog of war "on", 0 means "off" and -1 will re-compute the fog from privileged units in the region.
      • getZeroUnit

        Unit getZeroUnit()
        Returns the zero unit ("the peasants") of this region.
      • getModifiedPeasants

        int getModifiedPeasants()
        Returns the number of modified peasants after a GIVE 0 or recruiting.
        Returns:
        the number of modified persons after "give 0", recruit
      • modifiedRecruit

        int modifiedRecruit()
        Returns the number of possible recruits.
      • setIsland

        void setIsland​(Island i)
        Sets the island this region belongs to.
      • getIsland

        Island getIsland()
        Returns the island this region belongs to.
      • getVisibilityString

        java.lang.String getVisibilityString()
        A string constant indicating why this region is visible. This should only be used when writing/reading a CR. Otherwise use getVisibility().
        Returns:
        the string object or null, if the visibility is unspecified.
      • setVisibilityString

        void setVisibilityString​(java.lang.String vis)
        Sets a string constant indicating why this region is visible. This should only be used when writing/reading a CR. Otherwise use setVisibility(Visibility).
        Parameters:
        vis - a String object or null to indicate that the visibility cannot be determined.
      • getVisibility

        Region.Visibility getVisibility()
        Represents the quality of the visibility as an int value. 0..very poor - no info (->visibility=null)
        1..neighbour
        2..lighthouse
        3..travel
        4..qualified unit in region (->visibility=null)
      • setVisibility

        void setVisibility​(Region.Visibility v)
        0..very poor - no info (->visibility=null)
        1..neighbour
        2..lighthouse
        3..travel
        4..qualified unit in region (->visibility=null)
        Parameters:
        v -
      • resources

        java.util.Collection<RegionResource> resources()
        Returns all resources of this region.
      • addResource

        RegionResource addResource​(RegionResource resource)
        Adds a resource to this region.
        Throws:
        java.lang.NullPointerException
      • removeResource

        RegionResource removeResource​(RegionResource r)
        Removes the resource with the specified numerical id or the id of its item type from this region.
        Returns:
        the removed resource or null if no resource with the specified id exists in this region.
      • removeResource

        RegionResource removeResource​(ItemType type)
        Removes any reference to the Resource with ItemType type.
        Parameters:
        type -
        Returns:
        The resource that was removed if any, null otherwise
      • clearRegionResources

        void clearRegionResources()
        Removes all resources from this region.
      • getResource

        RegionResource getResource​(ItemType type)
        Returns the resource with the ID of its item type.
        Parameters:
        type - may be null in which case null will be returned
        Returns:
        the resource object or null if no resource with the specified ID exists in this region.
      • schemes

        java.util.Collection<Scheme> schemes()
        Returns all schemes of this region.
      • addScheme

        Scheme addScheme​(Scheme scheme)
        Adds a scheme to this region.
        Throws:
        java.lang.NullPointerException
      • clearSchemes

        void clearSchemes()
        Removes all schemes from this region.
      • getScheme

        Scheme getScheme​(ID id)
        Returns the scheme with the specified corodinate.
        Returns:
        the scheme object or null if no scheme with the specified ID exists in this region.
      • borders

        java.util.Collection<Border> borders()
        Returns all borders of this region.
      • addBorder

        Border addBorder​(Border border)
        Adds a border to this region.
        Throws:
        java.lang.NullPointerException - if border is null
      • clearBorders

        void clearBorders()
        Removes all borders from this region.
      • getBorder

        Border getBorder​(ID key)
        Returns the border with the specified id.
        Returns:
        the border object or null if no border with the specified id exists in this region.
      • ships

        java.util.Collection<Ship> ships()
        Returns an unmodifiable collection of all the ships in this container.
      • getShip

        Ship getShip​(ID key)
        Retrieve a ship in this container by id.
      • addShip

        void addShip​(Ship s)
        Adds a ship to this container. This method should only be invoked by Ship.setXXX() methods.
      • removeShip

        Ship removeShip​(Ship s)
        Removes a ship from this container. This method should only be invoked by Ship.setXXX() methods.
      • buildings

        java.util.Collection<Building> buildings()
        Returns an unmodifiable collection of all the buildings in this container.
      • getBuilding

        Building getBuilding​(ID key)
        Retrieve a building in this container by id.
      • addBuilding

        void addBuilding​(Building u)
        Adds a building to this container. This method should only be invoked by Building.setXXX() methods.
      • removeBuilding

        Building removeBuilding​(Building b)
        Removes a building from this container. This method should only be invoked by Building.setXXX() methods.
      • items

        @Deprecated
        java.util.Collection<Item> items()
        Returns the items of all units that are stationed in this region and belonging to a faction that has at least a privileged trust level.
        Fiete 20061224: ...and the factions with "GIVE" alliances too.
        The amount of the items of a particular item type are added up, so two units with 5 pieces of silver yield one silver item of amount 10 here.
      • allItems

        @Deprecated
        java.util.Collection<Item> allItems()
        Returns the items of all units that are stationed in this region The amount of the items of a particular item type are added up, so two units with 5 pieces of silver yield one silver item of amount 10 here.
      • maxRecruit

        int maxRecruit()
        Returns the maximum number of persons that can be recruited in this region.
      • maxOldRecruit

        int maxOldRecruit()
        Returns the maximum number of persons that can be recruited in this region.
      • maxEntertain

        int maxEntertain()
        Returns the silver that can be earned through entertainment in this region. Returns Integer.MIN_VALUE if this is not applicable.
      • maxOldEntertain

        int maxOldEntertain()
        Returns the silver that could be earned through entertainment in this region.
      • maxLuxuries

        int maxLuxuries()
        Returns the maximum number of luxury items that can be bought in this region without a price penalty.
      • maxOldLuxuries

        int maxOldLuxuries()
        Returns the maximum number of luxury items that could be bought in this region without a price penalty.
      • setOldLuxuries

        void setOldLuxuries​(int amount)
        Sets the number of luxury items that could be bought last round.
        Parameters:
        amount - The new value
      • getPeasantWage

        int getPeasantWage()
        Calculates the wage a peasant earns according to the biggest castle in this region. While the value of the wage field is directly taken from the report and may be biased by the race of the owner faction of that report, this function tries to determine the real wage a peasant can earn in this region. Wage for player persons can be derived from that value
      • toString

        java.lang.String toString()
        Returns a String representation of this Region object. If region has no name the string representation of the region type is used.
        Overrides:
        toString in class java.lang.Object
      • getCoordinate

        CoordinateID getCoordinate()
        Returns the coordinate of this region. This method is only a type-safe short cut for retrieving and converting the ID object of this region.
      • getRegionType

        RegionType getRegionType()
        Returns the RegionType of this region. This method is only a type-safe short cut for retrieving and converting the RegionType of this region.
      • refreshUnitRelations

        void refreshUnitRelations()
        Refreshes all the relations of all units in this region. It is preferrable to call this method instead of refreshing the unit relations 'manually'.
      • refreshUnitRelations

        @Deprecated
        void refreshUnitRelations​(boolean forceRefresh)
        Deprecated.
        should be triggered implicitly by UnitOrdersEvents
        Refreshes all the relations of all units in this region. It is preferrable to call this method instead of refreshing the unit relations 'manually'.
        Parameters:
        forceRefresh - to enforce refreshment, false for one refreshment only
      • addGuard

        void addGuard​(Unit u)
        Add guarding Unit to region.
      • getGuards

        java.util.List<Unit> getGuards()
        Get The List of guarding Units.
      • getUnit

        Unit getUnit​(ID key)
        Get the unit with the given ID if it's in the region, null otherwise.
        Specified by:
        getUnit in interface UnitContainer
      • setNeighbours

        @Deprecated
        void setNeighbours​(java.util.Collection<CoordinateID> neighbours)
        Deprecated.
        Sets the collection of ids for reachable regions to neighbours. If neighbours is null they will be evaluated.
        Throws:
        java.lang.IllegalArgumentException - if one of the neighbours doesn't exist in the data.
      • setNeighbors

        void setNeighbors​(java.util.Map<Direction,​Region> neighbors)
        Sets the collection of ids for reachable regions to neighbors. If neighbors is null they will be evaluated from Coordinate neighbors.
      • addNeighbor

        Region addNeighbor​(Direction dir,
                           Region newNeighbor)
        Adds a neighbor in the specified direction.
        Returns:
        The old neighbor in this direction, if there was one, otherwise null.
      • removeNeighbor

        Region removeNeighbor​(Direction d)
        Removes the neighbor in the specified direction.
      • getNeighbours

        @Deprecated
        java.util.Collection<CoordinateID> getNeighbours()
        Deprecated.
        Returns a collection of ids for reachable neighbours. This may be set by setNeighbours() if neighbours is null it will be calculated from the game data). This function may be necessary for new xml reports.
      • getNeighbors

        java.util.Map<Direction,​Region> getNeighbors()
        Returns a map for reachable neighbors. If the neighbors have not been set by setNeighbors(), it will be calculated from the game data).
      • getOceanWithCoast

        int getOceanWithCoast()
        Returns:
        the ozeanWithCoast
      • getCoordX

        int getCoordX()
        Used for replacers..showing coordinates of region
      • getCoordY

        int getCoordY()
        Used for replacers..showing coordinates of region
      • getSigns

        java.util.Collection<Sign> getSigns()
        Returns:
        the signLines
      • addSign

        void addSign​(Sign s)
        Adds a sign to the region.
      • addSigns

        void addSigns​(java.util.Collection<Sign> c)
        Add all signs in c to the region.
      • clearSigns

        void clearSigns()
        Remove all signs
      • getEvents

        java.util.List<Message> getEvents()
        Returns the value of events.
        Returns:
        Returns events.
      • setEvents

        void setEvents​(java.util.List<Message> events)
        Sets the value of events.
        Parameters:
        events - The value for events.
      • getHerb

        ItemType getHerb()
        Returns the value of herb.
        Returns:
        Returns herb.
      • setHerb

        void setHerb​(ItemType herb)
        Sets the value of herb.
        Parameters:
        herb - The value for herb.
      • getHerbAmount

        java.lang.String getHerbAmount()
        Returns the value of herbAmount.
        Returns:
        Returns herbAmount.
      • setHerbAmount

        void setHerbAmount​(java.lang.String herbAmount)
        Sets the value of herbAmount.
        Parameters:
        herbAmount - The value for herbAmount.
      • getHorses

        int getHorses()
        Returns the value of horses.
        Returns:
        Returns horses.
      • setHorses

        void setHorses​(int horses)
        Sets the value of horses.
        Parameters:
        horses - The value for horses.
      • getIron

        int getIron()
        Returns the value of iron.
        Returns:
        Returns iron.
      • setIron

        void setIron​(int iron)
        Sets the value of iron.
        Parameters:
        iron - The value for iron.
      • getLaen

        int getLaen()
        Returns the value of laen.
        Returns:
        Returns laen.
      • setLaen

        void setLaen​(int laen)
        Sets the value of laen.
        Parameters:
        laen - The value for laen.
      • isMallorn

        boolean isMallorn()
        Returns the value of mallorn.
        Returns:
        Returns mallorn.
      • setMallorn

        void setMallorn​(boolean mallorn)
        Sets the value of mallorn.
        Parameters:
        mallorn - The value for mallorn.
      • getMessages

        java.util.List<Message> getMessages()
        Returns the value of messages.
        Returns:
        Returns messages.
      • setMessages

        void setMessages​(java.util.List<Message> messages)
        Sets the value of messages.
        Parameters:
        messages - The value for messages.
      • getOldHorses

        int getOldHorses()
        Returns the value of oldHorses.
        Returns:
        Returns oldHorses.
      • setOldHorses

        void setOldHorses​(int oldHorses)
        Sets the value of oldHorses.
        Parameters:
        oldHorses - The value for oldHorses.
      • getOldIron

        int getOldIron()
        Returns the value of oldIron.
        Returns:
        Returns oldIron.
      • setOldIron

        void setOldIron​(int oldIron)
        Sets the value of oldIron.
        Parameters:
        oldIron - The value for oldIron.
      • getOldLaen

        int getOldLaen()
        Returns the value of oldLaen.
        Returns:
        Returns oldLaen.
      • setOldLaen

        void setOldLaen​(int oldLaen)
        Sets the value of oldLaen.
        Parameters:
        oldLaen - The value for oldLaen.
      • getOldPeasants

        int getOldPeasants()
        Returns the value of oldPeasants.
        Returns:
        Returns oldPeasants.
      • setOldPeasants

        void setOldPeasants​(int oldPeasants)
        Sets the value of oldPeasants.
        Parameters:
        oldPeasants - The value for oldPeasants.
      • getOldPrices

        java.util.Map<StringID,​LuxuryPrice> getOldPrices()
        Returns the value of oldPrices.
        Returns:
        Returns oldPrices.
      • setOldPrices

        void setOldPrices​(java.util.Map<StringID,​LuxuryPrice> oldPrices)
        Sets the value of oldPrices.
        Parameters:
        oldPrices - The value for oldPrices.
      • getOldRecruits

        int getOldRecruits()
        Returns the value of oldRecruits.
        Returns:
        Returns oldRecruits.
      • setOldRecruits

        void setOldRecruits​(int oldRecruits)
        Sets the value of oldRecruits.
        Parameters:
        oldRecruits - The value for oldRecruits.
      • getOldSilver

        int getOldSilver()
        Returns the value of oldSilver.
        Returns:
        Returns oldSilver.
      • setOldSilver

        void setOldSilver​(int oldSilver)
        Sets the value of oldSilver.
        Parameters:
        oldSilver - The value for oldSilver.
      • getOldSprouts

        int getOldSprouts()
        Returns the value of oldSprouts.
        Returns:
        Returns oldSprouts.
      • setOldSprouts

        void setOldSprouts​(int oldSprouts)
        Sets the value of oldSprouts.
        Parameters:
        oldSprouts - The value for oldSprouts.
      • getOldStones

        int getOldStones()
        Returns the value of oldStones.
        Returns:
        Returns oldStones.
      • setOldStones

        void setOldStones​(int oldStones)
        Sets the value of oldStones.
        Parameters:
        oldStones - The value for oldStones.
      • getOldTrees

        int getOldTrees()
        Returns the value of oldTrees.
        Returns:
        Returns oldTrees.
      • setOldTrees

        void setOldTrees​(int oldTrees)
        Sets the value of oldTrees.
        Parameters:
        oldTrees - The value for oldTrees.
      • getOldWage

        int getOldWage()
        Returns the value of oldWage.
        Returns:
        Returns oldWage.
      • setOldWage

        void setOldWage​(int oldWage)
        Sets the value of oldWage.
        Parameters:
        oldWage - The value for oldWage.
      • isOrcInfested

        boolean isOrcInfested()
        Returns the value of orcInfested.
        Returns:
        Returns orcInfested.
      • setOrcInfested

        void setOrcInfested​(boolean orcInfested)
        Sets the value of orcInfested.
        Parameters:
        orcInfested - The value for orcInfested.
      • getPeasants

        int getPeasants()
        Returns the value of peasants.
        Returns:
        Returns peasants.
      • setPeasants

        void setPeasants​(int peasants)
        Sets the value of peasants.
        Parameters:
        peasants - The value for peasants.
      • getPlayerMessages

        java.util.List<Message> getPlayerMessages()
        Returns the value of playerMessages.
        Returns:
        Returns playerMessages.
      • setPlayerMessages

        void setPlayerMessages​(java.util.List<Message> playerMessages)
        Sets the value of playerMessages.
        Parameters:
        playerMessages - The value for playerMessages.
      • getPrices

        java.util.Map<StringID,​LuxuryPrice> getPrices()
        Returns the value of prices.
        Returns:
        Returns prices.
      • setPrices

        void setPrices​(java.util.Map<StringID,​LuxuryPrice> prices)
        Sets the value of prices.
        Parameters:
        prices - The value for prices.
      • getRecruits

        int getRecruits()
        Returns the value of recruits.
        Returns:
        Returns recruits.
      • setRecruits

        void setRecruits​(int recruits)
        Sets the value of recruits.
        Parameters:
        recruits - The value for recruits.
      • getSilver

        int getSilver()
        Returns the value of silver.
        Returns:
        Returns silver.
      • setSilver

        void setSilver​(int silver)
        Sets the value of silver.
        Parameters:
        silver - The value for silver.
      • getSprouts

        int getSprouts()
        Returns the value of sprouts.
        Returns:
        Returns sprouts.
      • setSprouts

        void setSprouts​(int sprouts)
        Sets the value of sprouts.
        Parameters:
        sprouts - The value for sprouts.
      • getStones

        int getStones()
        Returns the value of stones.
        Returns:
        Returns stones.
      • setStones

        void setStones​(int stones)
        Sets the value of stones.
        Parameters:
        stones - The value for stones.
      • getSurroundings

        java.util.List<Message> getSurroundings()
        Returns the value of surroundings.
        Returns:
        Returns surroundings.
      • setSurroundings

        void setSurroundings​(java.util.List<Message> surroundings)
        Sets the value of surroundings.
        Parameters:
        surroundings - The value for surroundings.
      • getTravelThru

        java.util.List<Message> getTravelThru()
        Returns the value of travelThru.
        Returns:
        Returns travelThru.
      • setTravelThru

        void setTravelThru​(java.util.List<Message> travelThru)
        Sets the value of travelThru.
        Parameters:
        travelThru - The value for travelThru.
      • getTravelThruShips

        java.util.List<Message> getTravelThruShips()
        Returns the value of travelThruShips.
        Returns:
        Returns travelThruShips.
      • setTravelThruShips

        void setTravelThruShips​(java.util.List<Message> travelThruShips)
        Sets the value of travelThruShips.
        Parameters:
        travelThruShips - The value for travelThruShips.
      • getTrees

        int getTrees()
        Returns the value of trees.
        Returns:
        Returns trees.
      • setTrees

        void setTrees​(int trees)
        Sets the value of trees.
        Parameters:
        trees - The value for trees.
      • getWage

        int getWage()
        Returns the value of wage. Returns -1 if unknown.
        Returns:
        Returns wage.
      • setWage

        void setWage​(int wage)
        Sets the value of wage.
        Parameters:
        wage - The value for wage.
      • isActive

        @Deprecated
        boolean isActive()
        Deprecated.
        Returns true if this region is the activ region.
      • getCoastBitMap

        java.lang.Integer getCoastBitMap()
        The returned integer is an BitMap representing the info, if neighboring regions are ozean or not-
        BitMask 1: dir = 0
        BitMask 2: dir = 1
        BitMask 4: dir = 2 ....
        BitMask 64: random bit 1 (for variable effects like ice)
        BitMask 128: random bit 2
        Bit = 1 -> there is land!
        Bit = 0 -> there is ozean!
        Returns:
        an Integer as BitMap
      • setCoastBitMap

        void setCoastBitMap​(java.lang.Integer bitMap)
        The given integer is an BitMap representing the info, if neighboring regions are ozean or not.
        BitMask 1: dir = 0
        BitMask 2: dir = 1
        BitMask 4: dir = 2 ....
        BitMask 64: random bit 1 (for variable effects like ice)
        BitMask 128: random bit 2
        Bit = 1 -> there is land!
        Bit = 0 -> there is ozean!
        Parameters:
        bitMap - an Integer as BitMap
      • hasUID

        boolean hasUID()
        Returns true if a UID has been set.
      • getUID

        long getUID()
        Returns the unique regionID generated by the eressea-server. Note that this is no longer necessarily unique, due to wrap around effects! Real region IDs (from the server) should be >=0. Invented region IDs can be <0.
      • setUID

        void setUID​(long uID)
        Sets the given long value as the unique regionID. Note that this is no longer necessarily unique, due to wrap around effects!
      • setOwnerFaction

        void setOwnerFaction​(Faction f)
        Sets the faction owning this region (E3A only, currently)
      • getOwnerFaction

        Faction getOwnerFaction()
        Returns the faction owning this region (E3A only, currently) or null if not applicable.
      • setMorale

        void setMorale​(int morale)
        Sets the region's morale (from 0 to 5(?)).
      • getMorale

        int getMorale()
        Gets the region's morale (from 0 to 5(?)) or -1 if not defined or known.
      • getMourning

        int getMourning()
        Returns the current mourning state or -1 if unknown.
      • setMourning

        void setMourning​(int newMourning)
        Sets the current mourning state.
      • removeMaintenance

        void removeMaintenance​(Unit u)
        Remove a unit from the list of units that may be in this region in the next turn.
        Parameters:
        u -
      • addMaintenance

        void addMaintenance​(Unit u)
        Add a unit that may be in this region in the next turn.
        Parameters:
        u -
      • getMaintained

        java.util.Set<Unit> getMaintained()
        Returns a set of units that may be new in this region and thus need to be maintained. Does not include units from UnitContainer.units(), but may contain units that won't actually be in this region. Check Unit.getNewRegion() to verify.
        Returns:
        The set of additional units