net.sf.freecol.common.model
Class Turn

java.lang.Object
  extended by net.sf.freecol.common.model.Turn

public class Turn
extends java.lang.Object

Represents a given turn in the game.


Nested Class Summary
static class Turn.Season
           
 
Field Summary
private static int[] ages
          The first years of the "ages" of the game, which are only used for weighting FoundingFathers.
private static int seasonYear
          The first year in which there are two seasons.
private static int startingYear
          The year in which the game starts.
private  int turn
          The numerical value of the Turn, never less than one.
 
Constructor Summary
Turn(int turn)
          Creates a new Turn instance.
 
Method Summary
 boolean equals(java.lang.Object o)
          Checks if this turn is equal to another turn.
 int getAge()
          Describe getAge method here.
static int getAge(int year)
          Describe getAge method here.
static int[] getAges()
          Get the Ages value.
 StringTemplate getLabel()
          Describe getLabel method here.
static StringTemplate getLabel(int turn)
          Describe getLabel method here.
 int getNumber()
          Gets the turn number.
 Turn.Season getSeason()
          Return the Season of this Turn.
static Turn.Season getSeason(int turn)
          Return the Season of the given Turn number.
static int getSeasonYear()
          Get the SeasonYear value.
static int getStartingYear()
          Get the StartingYear value.
 int getYear()
          Gets the year this turn is in.
static int getYear(int turn)
          Gets the year the given turn is in.
 boolean isFirstSeasonTurn()
          Describe isFirstSeasonTurn method here.
 Turn next()
          Increases the turn number by one.
static void setAges(int[] newAges)
          Set the Ages value.
static void setSeasonYear(int newSeasonYear)
          Set the SeasonYear value.
static void setStartingYear(int newStartingYear)
          Set the StartingYear value.
 java.lang.String toString()
          Returns a string representation of this turn.
static java.lang.String toString(int turn)
          Returns a non-localized string representation of the given turn.
static int yearToTurn(int year)
          Describe yearToTurn method here.
static int yearToTurn(int year, Turn.Season season)
          Describe yearToTurn method here.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

turn

private int turn
The numerical value of the Turn, never less than one.


startingYear

private static int startingYear
The year in which the game starts.


seasonYear

private static int seasonYear
The first year in which there are two seasons.


ages

private static int[] ages
The first years of the "ages" of the game, which are only used for weighting FoundingFathers.

Constructor Detail

Turn

public Turn(int turn)
Creates a new Turn instance.

Parameters:
turn - an int value
Method Detail

yearToTurn

public static int yearToTurn(int year)
Describe yearToTurn method here.

Parameters:
year - an int value
Returns:
an int value

yearToTurn

public static int yearToTurn(int year,
                             Turn.Season season)
Describe yearToTurn method here.

Parameters:
year - an int value
season - a Season value
Returns:
an int value

next

public Turn next()
Increases the turn number by one.


getNumber

public int getNumber()
Gets the turn number.

Returns:
The number of turns.

getAge

public int getAge()
Describe getAge method here.

Returns:
an int value

getAge

public static int getAge(int year)
Describe getAge method here.

Parameters:
year - an int value
Returns:
an int value

equals

public boolean equals(java.lang.Object o)
Checks if this turn is equal to another turn.

Overrides:
equals in class java.lang.Object

getYear

public static int getYear(int turn)
Gets the year the given turn is in.

Returns:
The calculated year based on the turn number.

getYear

public int getYear()
Gets the year this turn is in.

Returns:
The calculated year based on the turn number.

toString

public java.lang.String toString()
Returns a string representation of this turn.

Overrides:
toString in class java.lang.Object
Returns:
A string with the format: "[season] year". Examples: "Spring 1602", "1503"...

toString

public static java.lang.String toString(int turn)
Returns a non-localized string representation of the given turn.

Returns:
A string with the format: "season year". Examples: "SPRING 1602", "YEAR 1503"...

getSeason

public static Turn.Season getSeason(int turn)
Return the Season of the given Turn number.

Parameters:
turn - The turn number to calculate from.
Returns:
The season corresponding to the turn number.

getSeason

public Turn.Season getSeason()
Return the Season of this Turn.

Returns:
a Season value

getLabel

public StringTemplate getLabel()
Describe getLabel method here.

Returns:
a StringTemplate value

getLabel

public static StringTemplate getLabel(int turn)
Describe getLabel method here.

Parameters:
turn - an int value
Returns:
a StringTemplate value

getStartingYear

public static final int getStartingYear()
Get the StartingYear value.

Returns:
an int value

setStartingYear

public static final void setStartingYear(int newStartingYear)
Set the StartingYear value.

Parameters:
newStartingYear - The new StartingYear value.

getSeasonYear

public static final int getSeasonYear()
Get the SeasonYear value.

Returns:
an int value

setSeasonYear

public static final void setSeasonYear(int newSeasonYear)
Set the SeasonYear value.

Parameters:
newSeasonYear - The new SeasonYear value.

isFirstSeasonTurn

public boolean isFirstSeasonTurn()
Describe isFirstSeasonTurn method here.

Returns:
a boolean value

getAges

public static final int[] getAges()
Get the Ages value.

Returns:
an int[] value

setAges

public static final void setAges(int[] newAges)
Set the Ages value.

Parameters:
newAges - The new Ages value.