jfreerails.world.common
Class GameCalendar

java.lang.Object
  extended by jfreerails.world.common.GameCalendar
All Implemented Interfaces:
java.io.Serializable, FreerailsSerializable

public final class GameCalendar
extends java.lang.Object
implements FreerailsSerializable

This class converts time measured in ticks since the game began into time represented as Month, Year and hour:minute.

Author:
Luke
See Also:
Serialized Form

Field Summary
private static java.text.DecimalFormat decimalFormat
           
private static long serialVersionUID
           
private  int startYear
           
private  int ticksPerYear
           
 
Constructor Summary
GameCalendar(int ticksPerYear, int startYear)
           
 
Method Summary
 boolean equals(java.lang.Object o)
           
 int getMonth(int i)
          Returns the month, 0=Jan, 1=Feb, etc.
 GameTime getStartOfYear(GameTime t)
           
 int getTicks(int year)
           
 int getTicksPerYear()
           
 java.lang.String getTimeOfDay(int i)
          Returns the time of day as a string, note that a year is made up of a representative day, so 1st June is equilavent to 12 noon.
 int getYear(int ticks)
           
 java.lang.String getYearAndMonth(int i)
           
 java.lang.String getYearAsString(int ticks)
           
 int hashCode()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

decimalFormat

private static final java.text.DecimalFormat decimalFormat

ticksPerYear

private final int ticksPerYear

startYear

private final int startYear
Constructor Detail

GameCalendar

public GameCalendar(int ticksPerYear,
                    int startYear)
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getStartOfYear

public GameTime getStartOfYear(GameTime t)

getYearAsString

public java.lang.String getYearAsString(int ticks)

getYear

public int getYear(int ticks)

getTicks

public int getTicks(int year)

getTimeOfDay

public java.lang.String getTimeOfDay(int i)
Returns the time of day as a string, note that a year is made up of a representative day, so 1st June is equilavent to 12 noon.


getYearAndMonth

public java.lang.String getYearAndMonth(int i)

getMonth

public int getMonth(int i)
Returns the month, 0=Jan, 1=Feb, etc.


equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

getTicksPerYear

public int getTicksPerYear()