planty
Class Weather

java.lang.Object
  extended by planty.Weather

public class Weather
extends java.lang.Object

Implements weather behaviours and bonuses.

Author:
Nereare

Field Summary
private static int autumn
          Represents Autumn.
private static java.lang.String[] COLD_WEATHERS
          The cold weather (climatological status on cold temperatures) names.
private  java.util.Random rnd
          Pseudorandom number generator.
private static int spring
          Represents Spring.
private static int summer
          Represents Summer.
static int TEMP_COLD
          Represents the Cold temperature.
static int TEMP_FREEZING
          Represents the Freezing temperature.
static int TEMP_FRYING
          Represents the Frying temperature.
static int TEMP_MILD
          Represents the Mild temperature.
static int TEMP_WARM
          Represents the Warm temperature.
private  int temperature
          The current temperature.
private static java.lang.String[] TEMPERATURES
          The temperatures names.
private static java.lang.String[] WARM_WEATHERS
          The warm and mild weather (climatological status on warm and mild temperatures) names.
private  int weather
          The current weather status.
static int WEATHER_DESERTIC
          Represents the Desertic weather (clear extremily low relative humidity day).
static int WEATHER_DRY
          Represents the Dry weather (clear low relative humidity day).
static int WEATHER_HUMID
          Represents the Humid weather (cloudy day).
static int WEATHER_NORMAL
          Represents the Normal weather (clear day).
static int WEATHER_X_HUMID
          Represents the Highly Humid weather (either snow or rain).
static int WEATHER_XX_HUMID
          Represents the Hyper Humid weather (either heavy snow or storm).
private static int winter
          Represents Winter.
 
Constructor Summary
Weather()
          Constructor method.
Weather(boolean startMild)
          Constructor method.
 
Method Summary
 int getTemperature()
          Does what you'd expect it to.
 java.lang.String getTemperatureName()
          Does what you'd expect it to.
 int getWeather()
          Does what you'd expect it to.
 java.lang.String getWeatherName()
          Does what you'd expect it to.
 void newDay()
          Deprecated. Due to the excessive randomicity of the resulting climates. Use newDay(temperature, weather) instead.
 void newDay(int season)
          Rerandomizes the wheather accordingly to the season.
 void newDay(int temperature, int weather)
          Sets the weather to the given values;
 void setTemperature(int newTemperature)
          Sets the current temperature to the given one.
 void setWeather(int newWeather)
          Sets the current weather to the given status.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COLD_WEATHERS

private static final java.lang.String[] COLD_WEATHERS
The cold weather (climatological status on cold temperatures) names.


WARM_WEATHERS

private static final java.lang.String[] WARM_WEATHERS
The warm and mild weather (climatological status on warm and mild temperatures) names.


TEMPERATURES

private static final java.lang.String[] TEMPERATURES
The temperatures names.


WEATHER_XX_HUMID

public static final int WEATHER_XX_HUMID
Represents the Hyper Humid weather (either heavy snow or storm).

See Also:
Constant Field Values

WEATHER_X_HUMID

public static final int WEATHER_X_HUMID
Represents the Highly Humid weather (either snow or rain).

See Also:
Constant Field Values

WEATHER_HUMID

public static final int WEATHER_HUMID
Represents the Humid weather (cloudy day).

See Also:
Constant Field Values

WEATHER_NORMAL

public static final int WEATHER_NORMAL
Represents the Normal weather (clear day).

See Also:
Constant Field Values

WEATHER_DRY

public static final int WEATHER_DRY
Represents the Dry weather (clear low relative humidity day).

See Also:
Constant Field Values

WEATHER_DESERTIC

public static final int WEATHER_DESERTIC
Represents the Desertic weather (clear extremily low relative humidity day).

See Also:
Constant Field Values

TEMP_FREEZING

public static final int TEMP_FREEZING
Represents the Freezing temperature.

See Also:
Constant Field Values

TEMP_COLD

public static final int TEMP_COLD
Represents the Cold temperature.

See Also:
Constant Field Values

TEMP_MILD

public static final int TEMP_MILD
Represents the Mild temperature.

See Also:
Constant Field Values

TEMP_WARM

public static final int TEMP_WARM
Represents the Warm temperature.

See Also:
Constant Field Values

TEMP_FRYING

public static final int TEMP_FRYING
Represents the Frying temperature.

See Also:
Constant Field Values

spring

private static final int spring
Represents Spring.

See Also:
Constant Field Values

summer

private static final int summer
Represents Summer.

See Also:
Constant Field Values

autumn

private static final int autumn
Represents Autumn.

See Also:
Constant Field Values

winter

private static final int winter
Represents Winter.

See Also:
Constant Field Values

rnd

private java.util.Random rnd
Pseudorandom number generator.


weather

private int weather
The current weather status.


temperature

private int temperature
The current temperature.

Constructor Detail

Weather

public Weather()
Constructor method.


Weather

public Weather(boolean startMild)
Constructor method.

Parameters:
startMild - whether or not the weather should be initialized with a mild set.
Method Detail

getWeather

public int getWeather()
Does what you'd expect it to.

Returns:
the current weather.

getWeatherName

public java.lang.String getWeatherName()
Does what you'd expect it to.

Returns:
the name of the current weather.

getTemperature

public int getTemperature()
Does what you'd expect it to.

Returns:
the current temperature.

getTemperatureName

public java.lang.String getTemperatureName()
Does what you'd expect it to.

Returns:
the current temperature's name.

setWeather

public void setWeather(int newWeather)
Sets the current weather to the given status.

Parameters:
newWeather - the new weather, spaning from 0 (Hyper Humid) to 5 (Desertic).

setTemperature

public void setTemperature(int newTemperature)
Sets the current temperature to the given one.

Parameters:
newTemperature - the new temperature, spaning from 0 (Freezing) to 4 (Frying).

newDay

public void newDay()
Deprecated. Due to the excessive randomicity of the resulting climates. Use newDay(temperature, weather) instead.

Rerandomizes the weather.


newDay

public void newDay(int temperature,
                   int weather)
Sets the weather to the given values;

Parameters:
temperature - the new temperature, at least 0 (Freezing), at most 4 (Frying).
weather - the new weather, at least 0 (Hyper Humid), at most 5 (Desertic).

newDay

public void newDay(int season)
Rerandomizes the wheather accordingly to the season.

Parameters:
season - the season id, ranging from 0 (Spring) to 3 (Winter).