Package model.zone

Class Zone

java.lang.Object
model.zone.Zone
All Implemented Interfaces:
Serializable, Buildable
Direct Known Subclasses:
CommercialZone, IndustrialZone, ResidentialZone

public abstract class Zone extends Object implements Buildable, Serializable
See Also:
  • Field Details

    • level

      protected Level level
    • dayToBuild

      protected int dayToBuild
    • statistics

      protected ZoneStatistics statistics
    • birthday

      protected final Date birthday
    • coordinate

      protected Coordinate coordinate
    • citizens

      protected ArrayList<Citizen> citizens
    • dimension

      protected final Dimension dimension
    • buildableType

      protected BuildableType buildableType
    • isUnderConstruction

      protected Boolean isUnderConstruction
    • effectRadius

      protected float effectRadius
  • Constructor Details

  • Method Details

    • getCapacity

      public int getCapacity()
    • isConnected

      public boolean isConnected()
      Description copied from interface: Buildable
      if buildable is connected to master road
      Specified by:
      isConnected in interface Buildable
      Returns:
      true id connected
    • getOneTimeCost

      public int getOneTimeCost()
      Description copied from interface: Buildable
      Every buildable cost some when built.
      Specified by:
      getOneTimeCost in interface Buildable
      Returns:
      the costs.
    • resetConnected

      public void resetConnected(Buildable connectingPoint, Buildable[][] map)
      Resets the connected property with the current possibility of connection
      Parameters:
      connectingPoint - master road
      map - map of city
    • getLevel

      public Level getLevel()
    • getStatistics

      public ZoneStatistics getStatistics()
    • getBirthday

      public Date getBirthday()
    • getCoordinate

      public Coordinate getCoordinate()
      Specified by:
      getCoordinate in interface Buildable
      Returns:
      the coordinate of the buildable
    • getDimension

      public Dimension getDimension()
      Specified by:
      getDimension in interface Buildable
      Returns:
      the dimension of the buildable
    • getCitizens

      public List<Citizen> getCitizens()
    • getBuildableType

      public BuildableType getBuildableType()
      Description copied from interface: Buildable
      A type can be:
      Specified by:
      getBuildableType in interface Buildable
      Returns:
      the type of the buildable
    • setUnderConstruction

      public void setUnderConstruction(Boolean underConstruction)
    • setLevel

      public void setLevel(Level level)
    • getFreeWorkSpaceEffect

      public double getFreeWorkSpaceEffect()
    • getIndustrialEffect

      public double getIndustrialEffect()
    • updateForestEffect

      public void updateForestEffect(double newValue)
      If new is positive, use new value as effect if is greater than the old one. If is negative, set to zero if abs is the same.
      Parameters:
      newValue - double new value
    • updatePoliceEffect

      public void updatePoliceEffect(int newValue)
    • updateIndustrialEffect

      public void updateIndustrialEffect(int newValue)
    • updateStadiumEffect

      public void updateStadiumEffect(int newValue)
    • addCitizen

      public void addCitizen(Citizen citizen, GameModel gm)
      Adds new citizen to the zone. Increments the population and updates the citizen avg satisfaction with the new citizen.
      Parameters:
      citizen - the citizen to be added.
    • removeCitizen

      public void removeCitizen(Citizen citizen, GameModel gm)
      Removes new citizen to the zone. Increments the population and updates the citizen avg satisfaction with the new citizen.
      Parameters:
      citizen - the citizen to be added.
    • getZoneSatisfaction

      public double getZoneSatisfaction(GameModel gm)
      Gets the satisfaction of the zone
      Returns:
      the satisfaction of the zone
    • getPoliceEffect

      public double getPoliceEffect()
    • getZonRelatedSatisfaction

      public double getZonRelatedSatisfaction()
      Gets the satisfaction of the zone
      Returns:
      the satisfaction of the zone
    • isUnderConstruction

      public boolean isUnderConstruction()
      Description copied from interface: Buildable
      Checks if the buildable is under construction
      Specified by:
      isUnderConstruction in interface Buildable
      Returns:
      boolean
    • getPopulation

      public int getPopulation()
    • toString

      public String toString()
      Overrides:
      toString in class Object