Package model.zone
Class Zone
java.lang.Object
model.zone.Zone
- All Implemented Interfaces:
Serializable
,Buildable
- Direct Known Subclasses:
CommercialZone
,IndustrialZone
,ResidentialZone
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Date
protected BuildableType
protected Coordinate
protected int
protected final Dimension
protected float
protected Boolean
protected Level
protected ZoneStatistics
-
Constructor Summary
ConstructorsConstructorDescriptionZone
(Level level, int dayToBuild, ZoneStatistics statistics, Date birthday, Coordinate coordinate, float effectRadius) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCitizen
(Citizen citizen, GameModel gm) Adds new citizen to the zone.A type can be:int
double
double
getLevel()
int
Every buildable cost some when built.double
int
double
Gets the satisfaction of the zonedouble
Gets the satisfaction of the zoneboolean
if buildable is connected to master roadboolean
Checks if the buildable is under constructionvoid
removeCitizen
(Citizen citizen, GameModel gm) Removes new citizen to the zone.void
resetConnected
(Buildable connectingPoint, Buildable[][] map) Resets the connected property with the current possibility of connectionvoid
void
setUnderConstruction
(Boolean underConstruction) toString()
void
updateForestEffect
(double newValue) If new is positive, use new value as effect if is greater than the old one.void
updateIndustrialEffect
(int newValue) void
updatePoliceEffect
(int newValue) void
updateStadiumEffect
(int newValue)
-
Field Details
-
level
-
dayToBuild
protected int dayToBuild -
statistics
-
birthday
-
coordinate
-
citizens
-
dimension
-
buildableType
-
isUnderConstruction
-
effectRadius
protected float effectRadius
-
-
Constructor Details
-
Zone
public Zone(Level level, int dayToBuild, ZoneStatistics statistics, Date birthday, Coordinate coordinate, float effectRadius)
-
-
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 interfaceBuildable
- Returns:
- true id connected
-
getOneTimeCost
public int getOneTimeCost()Description copied from interface:Buildable
Every buildable cost some when built.- Specified by:
getOneTimeCost
in interfaceBuildable
- Returns:
- the costs.
-
resetConnected
Resets the connected property with the current possibility of connection- Parameters:
connectingPoint
- master roadmap
- map of city
-
getLevel
-
getStatistics
-
getBirthday
-
getCoordinate
- Specified by:
getCoordinate
in interfaceBuildable
- Returns:
- the coordinate of the buildable
-
getDimension
- Specified by:
getDimension
in interfaceBuildable
- Returns:
- the dimension of the buildable
-
getCitizens
-
getBuildableType
Description copied from interface:Buildable
A type can be:- Specified by:
getBuildableType
in interfaceBuildable
- Returns:
- the type of the buildable
-
setUnderConstruction
-
setLevel
-
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
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
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
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 interfaceBuildable
- Returns:
- boolean
-
getPopulation
public int getPopulation() -
toString
-