Class GameData

  • All Implemented Interfaces:
    java.lang.Cloneable, Addeable
    Direct Known Subclasses:
    CompleteData, EmptyData

    public abstract class GameData
    extends java.lang.Object
    implements java.lang.Cloneable, Addeable
    This is the central class for collecting all the data representing one computer report.

    The maps units, regions and so on are declared as abstract methods and the getX and addX provide access to them. This allows for subclasses that implicitly represent only a certain part of the game data by declaring certain maps as null and returning null on the corresponding getX() methods. This concept has so far not been applied and you usually operate on the CompleteData subclass.

    • Field Detail

      • rules

        @Deprecated
        public final Rules rules
        Deprecated.
        Game specific and usually fixed data (like races etc.).
      • gameName

        public java.lang.String gameName
        The name of the game.
      • base

        public int base
        The base (radix) in which ids are interpreted. The default value is 10. Note that all internal and cr representation is always decimal.
      • version

        public int version
        version number of computer report (CR)
      • noSkillPoints

        public boolean noSkillPoints
        Indicates whether in this report skill points are to be expected or whether they are meaningful, respectively.
      • errors

        public java.util.List<Problem> errors
      • encoding

        protected java.lang.String encoding
        encoding
      • originals

        protected java.util.Map<Region,​Region> originals
      • curTempID

        protected int curTempID
        The current TempUnit-ID. This means, if a new TempUnit is created, it's suggested ID is usually curTempID and if this suggestion is accepted by the user (which means, that a TempUnit with this id was created) curTempID is increased. A value of -1 indicates, that the variable is uninitialized and a value of 0 that the old system shall be used (which means, that the suggested temp id shall be calculated out of the id of the parent unit of the tempunit).
      • date

        protected Date date
        The 'round' this game data belongs to. Note that this imposes a restriction on how fine-grained date information can be applied to game data or certain parts of it. This will probably have to be changed the one or the other way.
      • timestamp

        protected long timestamp
        Contains the date of the report (it's not the date of the report).
      • mailTo

        public java.lang.String mailTo
        The 'mail' connection this game data belongs to. This may be null
      • mailSubject

        public java.lang.String mailSubject
        The 'mail' subject for this game data. This may be null
      • build

        public java.lang.String build
        The "Build" attribute
      • maxUnits

        public int maxUnits
        The "max_units" attribute
      • outOfMemory

        protected boolean outOfMemory
        is set to true, if while proceeding some functions (e.g. CRParse) and we are running out of memory... data may be corrupted or empty then
    • Constructor Detail

      • GameData

        public GameData​(Rules _rules)
        Creates a new GameData object with the name of "default".
        Parameters:
        _rules - Valid rules for the game
      • GameData

        public GameData​(Rules rules,
                        java.lang.String name)
        Creates a new GameData object.
        Parameters:
        rules - Valid rules for the game
        name - The game name (like "Eressea", "E3", ...)
        Throws:
        java.lang.NullPointerException - if rules==null
    • Method Detail

      • units

        @Deprecated
        public java.util.Map<UnitID,​Unit> units()
        Deprecated.
        Try using getUnits()
        A collection of all units. The keys are Integer objects containing the unit's ids. The values consist of objects of class Unit. TEMP units are not included, they are only stored in the unit collection of their parents and their regions and in the tempUnits map.
        Returns:
        returns the units map
      • getUnits

        public java.util.Collection<Unit> getUnits()
        Returns a collection of all units in the data.
      • unitView

        protected abstract java.util.Map<UnitID,​Unit> unitView()
        Returns a modifiable view of the units.
      • tempUnits

        @Deprecated
        public java.util.Map<UnitID,​TempUnit> tempUnits()
        Deprecated.
        A collection of tempUnits. The keys are Integer objects containinng the unit's ids. The values consist of objects of class TempUnit.
        Returns:
        returns the tempunits map
      • tempUnitView

        protected abstract java.util.Map<UnitID,​TempUnit> tempUnitView()
        Returns a modifiable of the temp units.
      • oldUnitsView

        protected abstract java.util.Map<UnitID,​Unit> oldUnitsView()
        Returns a modifiable view of the old units.
      • getRegions

        public java.util.Collection<Region> getRegions()
        Returns a collection of all regions of the report.
      • regionView

        protected abstract java.util.Map<CoordinateID,​Region> regionView()
        Returns a modifiable view of the regions.
      • factions

        @Deprecated
        public java.util.Map<EntityID,​Faction> factions()
        Deprecated.
        Try using getFactions()
        All factions in this game data. The keys are Integer objects containg the id of each faction. The values consist of objects of class Faction. One of these factions can be referenced by the ownerFaction attribute.
        Returns:
        returns the factions map
      • getFactions

        public java.util.Collection<Faction> getFactions()
        Returns a collection of all the report's factions.
      • factionView

        protected abstract java.util.Map<EntityID,​Faction> factionView()
        Returns a modifiable view of the factions.
      • buildings

        @Deprecated
        public java.util.Map<EntityID,​Building> buildings()
        Deprecated.
        Try using getBuildings()
        All buildings in this game data. The keys are Integer objects containg the id of each building. The values consist of objects of class Building.
        Returns:
        returns the buildings map
      • getBuildings

        public java.util.Collection<Building> getBuildings()
        Returns an unmodifiable view of all buildings in the data.
      • buildingView

        protected abstract java.util.Map<EntityID,​Building> buildingView()
        Returns a modifiable view of the buildings.
      • ships

        @Deprecated
        public java.util.Map<EntityID,​Ship> ships()
        Deprecated.
        Try using getShips()
        All ships in this game data. The keys are Integer objects containing the id of each ship. The values consist of objects of class Ship.
        Returns:
        returns the ships map
      • getShips

        public java.util.Collection<Ship> getShips()
        Returns an unmodifiable view of all ships in the data.
      • shipView

        protected abstract java.util.Map<EntityID,​Ship> shipView()
        Returns a modifiable view of the ships.
      • msgTypes

        public java.util.Map<IntegerID,​MessageType> msgTypes()
        All message types in this game data. The keys are Integer objects containg the id of each message type. The values consist of MessageType objects.
        Returns:
        returns the messageType map
      • msgTypeView

        protected abstract java.util.Map<IntegerID,​MessageType> msgTypeView()
        Returns a modifiable view of the message types.
      • spells

        @Deprecated
        public java.util.Map<StringID,​Spell> spells()
        Deprecated.
        Try using getSpells()
        All magic spells in this game data. The keys are Integer objects containing the id of each spell. The values consist of objects of class Spell.
        Returns:
        returns the spells map
      • getSpells

        public java.util.Collection<Spell> getSpells()
        Returns an unmodifiable view of all spells in the data.
      • spellView

        protected abstract java.util.Map<StringID,​Spell> spellView()
        Returns a modifiable view of the spells.
      • potions

        @Deprecated
        public java.util.Map<IntegerID,​Potion> potions()
        Deprecated.
        All potions in this game data. The keys are Integer objects containg the id of each potion. The values consist of objects of class Potion.
        Returns:
        returns the potions map
      • getPotions

        public java.util.Collection<Potion> getPotions()
        Returns an unmodifiable view of all potions in the data.
      • potionView

        protected abstract java.util.Map<IntegerID,​Potion> potionView()
        Returns a modifiable view of the potions.
      • islands

        @Deprecated
        public java.util.Map<IntegerID,​Island> islands()
        Deprecated.
        All islands in this game data. The keys are Integer objects containing the id of each island. The values consist of objects of class Island.
        Returns:
        returns the islands map
      • getIslands

        public java.util.Collection<Island> getIslands()
        Returns an unmodifiable collection of all islands in the data.
      • islandView

        public abstract java.util.Map<IntegerID,​Island> islandView()
        Returns a modifiable view of the islands.
      • translations

        public abstract Translations translations()
        Represents the table of translations from the report.
      • getAllianceGroups

        public java.util.Collection<AllianceGroup> getAllianceGroups()
        Returns a collection of all known AllianceGroups.
      • addUnit

        public void addUnit​(Unit u)
        Add a unit to the specified game data. If units() is null, this method has no effect.
        Parameters:
        u - the unit to be added.
      • addTempUnit

        public abstract void addTempUnit​(TempUnit t)
        Add a temp unit.
      • addOldUnit

        public void addOldUnit​(Unit newUnit)
        Add a unit that doesn't exist any more.
      • getOldUnits

        public java.util.Collection<Unit> getOldUnits()
        Returns a collection of all old units in the data.
      • getOldUnit

        public Unit getOldUnit​(UnitID id)
        Returns an old unit
        Parameters:
        id -
        Returns:
        the old unit with the given id, or null if it doesn't exist
      • addRegion

        public void addRegion​(Region r)
        Add a region to the specified game data. If regions() is null, this method has no effect.
        Parameters:
        r - the region to be added.
      • addFaction

        public void addFaction​(Faction f)
        Add a faction to the specified game data. If factions() is null, this method has no effect.
        Parameters:
        f - the faction to be added.
      • addBuilding

        public void addBuilding​(Building b)
        Add a building to the specified game data. If buildings() is null, this method has no effect.
        Parameters:
        b - the building to be added.
      • addShip

        public void addShip​(Ship s)
        Add a ship to the specified game data. If ships() is null, this method has no effect.
        Parameters:
        s - the ship to be added.
      • addMsgType

        public void addMsgType​(MessageType type)
        Add a message type to the specified game data. If msgTypes() is null, this method has no effect.
        Parameters:
        type - the message type to be added.
      • addSpell

        public void addSpell​(Spell s)
        Add a spell to the specified game data. If spells() is null, this method has no effect.
        Parameters:
        s - the spells to be added.
      • addPotion

        public void addPotion​(Potion p)
        Add a potion to the specified game data. If potions() is null, this method has no effect.
        Parameters:
        p - the potion to be added.
      • addIsland

        public void addIsland​(Island i)
        Add an island to the specified game data. If islands() is null, this method has no effect.
        Parameters:
        i - the island to be added.
      • addAllianceGroup

        public void addAllianceGroup​(AllianceGroup alliance)
        Add an AllianceGroup.
      • getAttribute

        public java.lang.String getAttribute​(java.lang.String key)
        Description copied from interface: Addeable
        Returns the value for the given key.
        Specified by:
        getAttribute in interface Addeable
        Returns:
        the value for the given key or null if no value has been added for the key.
        See Also:
        Addeable.getAttribute(java.lang.String)
      • getAttributeKeys

        public java.util.List<java.lang.String> getAttributeKeys()
        Description copied from interface: Addeable
        Returns all keys that have been added to this object.
        Specified by:
        getAttributeKeys in interface Addeable
        Returns:
        a list of keys that have been added to this object.
        See Also:
        Addeable.getAttributeKeys()
      • getUnit

        public Unit getUnit​(ID id)
        Retrieve a unit from units() by id.
        Parameters:
        id - the id of the unit to be retrieved.
        Returns:
        an instance of class Unit or null if there is no unit with the specified id or if units() is null.
      • getTempUnit

        public TempUnit getTempUnit​(UnitID id)
        Returns the temp unit with the specified ID, null if it doesn not exist.
      • getFaction

        public Faction getFaction​(ID id)
        Retrieve a faction from factions() by id.
        Parameters:
        id - the id of the faction to be retrieved.
        Returns:
        an instance of class Faction or null if there is no faction with the specified id or if factions() is null.
      • getBuilding

        public Building getBuilding​(ID id)
        Retrieve a building from buildings() by id.
        Parameters:
        id - the id of the building to be retrieved.
        Returns:
        an instance of class Building or null if there is no building with the specified id or if buildings() is null.
      • getShip

        public Ship getShip​(ID id)
        Retrieve a ship from ships() by id.
        Parameters:
        id - the id of the ship to be retrieved.
        Returns:
        an instance of class Ship or null if there is no ship with the specified id or if ships() is null.
      • getMsgType

        public MessageType getMsgType​(ID id)
        Retrieve a message type from msgTypes() by id.
        Parameters:
        id - the id of the message type to be retrieved.
        Returns:
        an instance of class MessageType or null if there is no message type with the specified id or if msgTypes() is null.
      • getSpell

        public Spell getSpell​(ID id)
        Retrieve a spell from spells() by id.
        Parameters:
        id - the id of the spell to be retrieved.
        Returns:
        an instance of class Spell or null if there is no spell with the specified id or if spells() is null.
      • getSpell

        public Spell getSpell​(java.lang.String spellName)
        Retrieve a spell from spells() by Name. used for orderReader / completer
        Parameters:
        spellName - the name of the spell to be retrieved.
        Returns:
        an instance of class Spell or null if there is no spell with the specified id or if spells() is null.
      • getPotion

        public Potion getPotion​(ID id)
        Retrieve a potion from potions() by id.
        Parameters:
        id - the id of the potion to be retrieved.
        Returns:
        an instance of class Potion or null if there is no potion with the specified id or if potions() is null.
      • getIsland

        public Island getIsland​(ID id)
        Retrieve a island from islands() by id.
        Parameters:
        id - the id of the island to be retrieved.
        Returns:
        an instance of class Island or null if there is no island with the specified id or if islands() is null.
      • getAllianceGroup

        public AllianceGroup getAllianceGroup​(ID allianceID)
        Returns the AllianceGroup with the specified ID if it exists, otherwise null.
      • removeUnit

        public void removeUnit​(UnitID id)
        Removes unit from the report.
      • removeTemp

        public void removeTemp​(UnitID key)
        Removes a temp unit from the collection of temp units.
      • removeFaction

        public void removeFaction​(EntityID id)
        Removes a faction from the report.
      • removeRegion

        public Region removeRegion​(Region r)
        Removes a region from the data. Also removes units, buildings, ships, and hot spots.
        Returns:
        The region that was removed, or null if the region wasn't found
      • removeIsland

        public void removeIsland​(IntegerID islandID)
        Removes the island from the report.
      • setIslands

        public abstract void setIslands​(java.util.Map<IntegerID,​Island> islands)
        Sets the new set of islands.
      • getSelectedRegionCoordinates

        public abstract java.util.Map<CoordinateID,​Region> getSelectedRegionCoordinates()
        Returns a map selected regions.
      • addSelectedRegionCoordinate

        public abstract void addSelectedRegionCoordinate​(Region region)
        Adds a region to the selection
      • setSelectedRegionCoordinates

        public abstract void setSelectedRegionCoordinates​(java.util.Map<CoordinateID,​Region> regions)
        Set a collection of selected regions.
        Parameters:
        regions - the Map of coordinates of selected regions
      • getCurTempID

        public int getCurTempID()
        This method sets the current temp id.
      • setCurTempID

        public void setCurTempID​(int newTempID)
        This method sets the current Temp ID with respect to the possible max value of the current base. The value also has to be >= -1
        Parameters:
        newTempID - Temp ID
      • setCurTempID

        public void setCurTempID​(java.lang.String s)
        This method interprets the string as a number in the base and sets the current Temp ID with respect to the possible max value of the current base. The value also has to be >= -1
        Parameters:
        s - Temp ID
      • getTranslation

        public java.lang.String getTranslation​(Named key)
        Retrieve a translation from translations().
        Parameters:
        key - the key of the translation to be retrieved.
        Returns:
        an instance of class String. If no translation could be found, the name of the object is returned.
      • getTranslation

        public java.lang.String getTranslation​(java.lang.String key)
        Retrieve a translation from translations().
        Parameters:
        key - the key of the translation to be retrieved.
        Returns:
        an instance of class String. If no translation could be found, the key is returned.
      • addTranslation

        public void addTranslation​(java.lang.String from,
                                   java.lang.String to,
                                   int source)
        Puts a translation into the translation table.
        Parameters:
        from - a language independent key.
        to - the language dependent translation of key.
      • setDate

        public void setDate​(Date d)
        Set a date, or a 'round', for this game data.
        Parameters:
        d - the new date.
      • getDate

        public Date getDate()
        Get the date associated with this game data.
        Returns:
        rules.Date object
      • setLocale

        public abstract void setLocale​(java.util.Locale l)
        Sets the valid locale for this report. Currently, this is only used to remember this setting and write it back into the cr.
      • getLocale

        public abstract java.util.Locale getLocale()
        Returns the locale of this report. Currently, this is only used to remember this setting and write it back into the cr.
      • clone

        public GameData clone()
                       throws java.lang.CloneNotSupportedException
        returns a clone of the game data (using CRWriter/CRParser trick encapsulated in Loader)
        Overrides:
        clone in class java.lang.Object
        Throws:
        java.lang.CloneNotSupportedException - If cloning doesn't succeed
        See Also:
        Object.clone()
      • clone

        public GameData clone​(CoordinateID newOrigin)
                       throws java.lang.CloneNotSupportedException
        Returns a clone of the game data (using CRWriter/CRParser trick encapsulated in Loader) and at the same time translates the origin to newOrigin.
        Throws:
        java.lang.CloneNotSupportedException - If cloning doesn't succeed
      • clone

        public GameData clone​(ReportTransformer coordinateTranslator)
                       throws java.lang.CloneNotSupportedException
        Returns a clone of the game data (using CRWriter/CRParser trick encapsulated in Loader) and at the same time translates the new report.
        Throws:
        java.lang.CloneNotSupportedException - If cloning doesn't succeed
      • estimateSize

        public abstract long estimateSize()
        Returns an estimate of the memory (in bytes) needed to store this game data. This can be a very rough estimate!
        Returns:
        An estimate of the memory needed to store this game data
      • getRules

        public final Rules getRules()
        Game specific and usually fixed data (like races etc.).
      • postProcess

        public void postProcess()
        This method can be called after loading or merging a report to avoid double messages and to set some game specific stuff.
      • postProcessErrors

        public void postProcessErrors()
      • postProcessIslands

        public void postProcessIslands()
        Post process of Island objects. The Regions of the GameData are attached to their Island.
      • postProcessUnknown

        public void postProcessUnknown()
        Set data to default values: RegionTypes, faction races, unit name/race/faction
      • postProcessDefaultTranslations

        public void postProcessDefaultTranslations()
        adding Default Translations to the translations
      • postProcessTheVoid

        public void postProcessTheVoid()
        scans the regions for missing regions, for regions with regionType "The Void" or "Leere" These Regions are not created in the world on the server, but we are so near, that we should have some information about it. So we add these Regions with the special RegionType "Leere"
      • postProcessLocale

        public void postProcessLocale()
        Adds the order locale of Magellan if locale is null. This should prevent some NPE with the sideeffect to store a locale in a locale-less game data object.
      • postProcessMessages

        public void postProcessMessages()
        This function post processes the message blocks to remove duplicate messages. In former times this has been done while loading the game data but this had a negative time tradeoff (O(n^2)). This functions needs about O(n log n).
      • postProcessPotions

        public void postProcessPotions()
        This functions post processes the potions to remove duplicate potions (potions with different ID but the same name) It is tricky to determine which is the latest potion definition in the code as far as i know there was no change in potion-definitions last months but only the IDs chanegd over time - so it does not matter finally we could keep the potion with the highest ID - asuming that this was the last potion-definition reveived from the server
      • postProcessAfterTrustlevelChange

        public void postProcessAfterTrustlevelChange()
        DOCUMENT-ME
      • removeTheVoid

        public void removeTheVoid()
        removes all "Leere" Regions needed for merging
      • getMaxSortIndex

        public int getMaxSortIndex()
      • setMaxSortIndex

        public void setMaxSortIndex​(int maxSortIndex)
      • setEncoding

        public void setEncoding​(java.lang.String encoding)
      • getEncoding

        public java.lang.String getEncoding()
      • getActiveRegion

        public Region getActiveRegion()
        Returns the current active region.
      • setActiveRegion

        public void setActiveRegion​(Region region)
        Marks a new region as the active region.
        Parameters:
        region -
      • getLevelRelation

        public LevelRelation getLevelRelation​(int fromLevel,
                                              int toLevel)
        Returns the relation of two map layers.
        Returns:
        the CoordinateID of the toLevel region which is accessible by the fromLevel region with CoordinateID <0, 0, fromLevel>.
      • getRelatedCoordinate

        public CoordinateID getRelatedCoordinate​(CoordinateID c,
                                                 int level)
        This method should wrap the mapping information former contained in magellan.client.swing.MapperPanel.setLevel(int)
        Parameters:
        level -
        Returns:
        Mapped Coordinate
      • clearTranslations

        public void clearTranslations​(EntityID f)
        Removes all translations for Faction f.
        Parameters:
        f -
      • getCoordinateTranslation

        public CoordinateID getCoordinateTranslation​(EntityID otherFaction,
                                                     int layer)
        Returns a coordinate translation of otherFaction this report. This is the coordinate vector that has to be added to the origin (with z-coordinate layer) of this report to get the origin of otherFaction. In other words, you have to subtract this translation from otherFaction's coordinates in layer layer to get coordinates of this report. The coordinate translation of the owner faction is not always (0, 0, layer).
        Parameters:
        otherFaction -
        layer -
        Returns:
        The coordinate translation of otherFaction to the owner faction. null if the translation is unknown
      • getCoordinateTranslations

        protected java.util.Map<EntityID,​java.util.Map<java.lang.Integer,​CoordinateID>> getCoordinateTranslations()
      • getCoordinateTranslationMap

        public java.util.Map<java.lang.Integer,​CoordinateID> getCoordinateTranslationMap​(EntityID otherFaction)
        Returns the immutable map of all known coordinate translations of otherFaction. This is a mapping of layers to coordinateIDs. This is the coordinate vector that has to be added to the origin (with z-coordinate layer) of this report to get the origin of otherFaction. In other words, you have to subtract this translation from otherFaction's coordinates in layer layer to get coordinates of this report. The coordinate translation of the owner faction is not always (0, 0, layer).
        Returns:
        The map of coordinate translations of faction otherFaction or null if unknown
        See Also:
        getCoordinateTranslation(EntityID, int)
      • setCoordinateTranslation

        public void setCoordinateTranslation​(EntityID otherFaction,
                                             CoordinateID usedTranslation)
        Sets the coordinate translation of otherFaction to the owner faction. This is a mapping of layers to coordinateIDs. This is the coordinate vector that has to be added to the origin (with z-coordinate layer) of this report to get the origin of otherFaction. In other words, you have to subtract this translation from otherFaction's coordinates in layer layer to get coordinates of this report. The coordinate translation of the owner faction is not always (0, 0, layer).
        Parameters:
        otherFaction -
        usedTranslation -
      • getOwnerFaction

        public EntityID getOwnerFaction()
        The faction that this report is for.
        Returns:
        The owner faction. null for unknown is possible.
      • setOwnerFaction

        public void setOwnerFaction​(EntityID ownerFaction)
        Changes the owner faction. Clears all coordinate translations.
        Parameters:
        ownerFaction -
      • getGameName

        public java.lang.String getGameName()
        Returns the name of the game (e.g. "eresea").
      • setGameName

        public void setGameName​(java.lang.String newName)
        Sets the name of the game (e.g. "eresea").
      • setFileType

        public void setFileType​(FileType filetype)
        Sets the FileType (basically the file name this report was read from).
      • getFileType

        public FileType getFileType()
        Returns the FileType (basically the file name this report was read from).
      • setTimestamp

        public void setTimestamp​(long timestamp)
        Sets the date of the report (it's not the date of the report).
      • getTimestamp

        public long getTimestamp()
        Returns the date of the report (it's not the date of the report).
      • addVoid

        public Region addVoid​(CoordinateID c)
        Adds a "void" region at c.
        Returns:
        the new void region
        Throws:
        java.lang.IllegalArgumentException - if there was already a region at c.
      • voids

        public java.util.Map<CoordinateID,​Region> voids()
        Returns all "void" regions, i.e., regions inserted only because we should have seen a region at this place, but there is none for some region. Most functions do not need to take these regions into account. The exception are displaying function, for example in the Mapper.
      • makeWrapper

        public void makeWrapper​(Region wrapper,
                                Region original)
        Makes r a "wraparound" region, removing it as a normal region. A wrapper is a region which is not a real region, but is only a placeholder for a another region (most probably to represent a cylinder- or torus-shaped world.
        Parameters:
        wrapper - The placeholder region
        original - The original region, represented by the wrapper.
      • getOriginal

        public Region getOriginal​(Region wrapper)
        Gets the real region for a wrapper region.
        Returns:
        The region corresponding to this wrapper, or null if none is known.
        See Also:
        makeWrapper(Region, Region)
      • getNullRegion

        public Region getNullRegion()
        Returns a dummy region which may be used for units without region. This region should not be contained in regions().
      • getNullFaction

        public Faction getNullFaction()
        Returns a dummy faction which may be used for units without faction. This faction should not be contained in factions().
      • getNullRace

        public Race getNullRace()
        Returns a dummy race which may be used for units without race. This race should not be contained in rules.Rules.getRaces().
      • addError

        public void addError​(Problem err)
      • getErrors

        public java.util.List<Problem> getErrors()
      • setOutOfMemory

        public void setOutOfMemory​(boolean outOfMemory)
        Sets the value of outOfMemory.
        Parameters:
        outOfMemory - The value for outOfMemory.
      • isOutOfMemory

        public boolean isOutOfMemory()
        Returns the value of outOfMemory.
        Returns:
        Returns outOfMemory.
      • repair

        public GameData repair​(UserInterface ui2)
        Tries to repair errors in this data and returns the repaired data.
        Parameters:
        ui2 -
        Returns:
        The repaired data (may be this)
      • isSameRound

        public boolean isSameRound​(GameData otherGameData)
      • fireOrdersChanged

        public void fireOrdersChanged​(java.lang.Object source,
                                      Unit u,
                                      java.lang.Object cause)
      • removeUnitChangeListener

        public void removeUnitChangeListener​(UnitChangeListener l)
      • getUnitChangeListeners

        protected java.util.Collection<UnitChangeListener> getUnitChangeListeners()
      • fireOrdersChanged

        public void fireOrdersChanged​(java.lang.Object source,
                                      Region r,
                                      java.lang.Object cause)
      • addBookmark

        public abstract void addBookmark​(Bookmark bookmark)
      • getBookmarks

        public abstract java.util.Collection<Bookmark> getBookmarks()
      • removeBookmark

        public abstract void removeBookmark​(Selectable selection)
      • getMaxUnits

        public int getMaxUnits()
        Returns the maximum number of units per faction or -1 if this is unknown