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.


Field Summary
static int SEASON_YEAR
           
static int STARTING_YEAR
           
 
Constructor Summary
Turn(int turn)
           
 
Method Summary
 boolean equals(java.lang.Object o)
          Checks if this turn is equal to another turn.
 int getAge()
          Gets the age.
 int getNumber()
          Gets the turn number.
 int getYear()
          Gets the year this turn is in.
static int getYear(int turn)
          Gets the year the given turn is in.
 void increase()
          Increases the turn number by one.
 void setNumber(int turn)
          Sets the turn number.
 java.lang.String toSaveGameString()
          Returns a string representation of this turn suitable for savegame files.
 java.lang.String toString()
          Returns a string representation of this turn.
static java.lang.String toString(int turn)
          Returns a string representation of the given turn.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STARTING_YEAR

public static final int STARTING_YEAR
See Also:
Constant Field Values

SEASON_YEAR

public static final int SEASON_YEAR
See Also:
Constant Field Values
Constructor Detail

Turn

public Turn(int turn)
Method Detail

increase

public void increase()
Increases the turn number by one.


getNumber

public int getNumber()
Gets the turn number.

Returns:
The number of turns.

setNumber

public void setNumber(int turn)
Sets the turn number.

Parameters:
turn - The number of turns.

getAge

public int getAge()
Gets the age.

Returns:
The age:

1 - if before SEASON_YEAR
2 - if between 1600 and 1700.
3 - if after 1700.

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 string representation of the given turn.

Returns:
A string with the format: "[season] year". Examples: "Spring 1602", "1503"...

toSaveGameString

public java.lang.String toSaveGameString()
Returns a string representation of this turn suitable for savegame files.

Returns:
A string with the format: "[season] year". Examples: "1602_1_Spring", "1503"...