uk.ac.leeds.ccg.andyt.projects.genesis.utilities
Class GENESIS_Time

java.lang.Object
  extended by uk.ac.leeds.ccg.andyt.projects.genesis.io.schema.common.Time
      extended by uk.ac.leeds.ccg.andyt.projects.genesis.utilities.GENESIS_Time
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable

public class GENESIS_Time
extends uk.ac.leeds.ccg.andyt.projects.genesis.io.schema.common.Time
implements java.lang.Comparable, java.io.Serializable

See Also:
Serialized Form

Field Summary
static java.math.BigInteger NormalDaysInYear_BigInteger
           
static int NormalDaysInYear_int
           
static int NormalHoursInDay_int
           
static int NormalHoursInYear_int
           
static int NormalMinutesInDay_int
           
static int NormalMinutesInHour_int
           
static int NormalMinutesInYear_int
           
static java.math.BigInteger NormalSecondsInDay_BigInteger
           
static int NormalSecondsInDay_int
           
static int NormalSecondsInHour_int
           
static int NormalSecondsInMinute_int
           
static java.math.BigInteger NormalSecondsInYear_BigInteger
           
static int NormalSecondsInYear_int
           
 
Fields inherited from class uk.ac.leeds.ccg.andyt.projects.genesis.io.schema.common.Time
dayOfYear, secondOfDay, year
 
Constructor Summary
GENESIS_Time()
           
GENESIS_Time(GENESIS_Time t)
           
GENESIS_Time(long year, int dayOfYear)
           
GENESIS_Time(long year, int dayOfYear, int secondOfDay)
           
GENESIS_Time(uk.ac.leeds.ccg.andyt.projects.genesis.io.schema.common.Time t)
           
 
Method Summary
 GENESIS_Time add(GENESIS_Time aGENESIS_Time)
           
 void addDay()
           
 void addDays(java.math.BigInteger days)
           
 void addDays(long days)
           
 void addDaysExclusivelyBetweenMinusNormalDaysInYearAndZero(long days)
           
 void addDaysExclusivelyBetweenZeroAndNormalDaysInYear(long days)
           
 void addHour()
           
 void addHours(long hours)
           
 void addHoursExclusivelyBetweenMinusNormalHoursInDayAndZero(long hours)
           
 void addHoursExclusivelyBetweenZeroAndNormalHoursInDay(long hours)
           
 void addMinute()
           
 void addMinutes(long minutes)
           
 void addSecond()
           
 void addSeconds(java.math.BigInteger seconds)
           
 void addSeconds(long seconds)
           
 void addSecondsExclusivelyBetweenMinusNormalHoursInDayAndZero(long seconds)
           
 void addSecondsExclusivelyBetweenZeroAndNormalSecondsInDay(long seconds)
           
 void addYear()
           
 void addYears(long years)
           
 void checkConsistency()
           
 int compareTo(java.lang.Object o)
          A error warning is written to System.err.println when the comparison is not for the same class of object.
 boolean equals(java.lang.Object a_Object)
           
 java.math.BigInteger getDayOfYear_BigInteger()
           
 java.math.BigInteger getDifferenceInDays_BigInteger(GENESIS_Time a_Time)
           
 long getDifferenceInDays_long(GENESIS_Time a_Time)
           
 java.math.BigInteger getDifferenceInSeconds_BigInteger(GENESIS_Time a_Time)
           
 long getDifferenceInSeconds_long(GENESIS_Time a_Time)
           
 int getHourOfDay_int()
           
 int getMinuteOfHour_int()
           
static GENESIS_Time getRandomTime(GENESIS_Time a_LowerTimeLimit, GENESIS_Time a_UpperTimeLimit, java.util.Random randomDay, java.util.Random randomSecond)
          This only works where the difference in years is less than Integer.MaxValue.
 java.math.BigInteger getSecondOfDay_BigInteger()
           
 java.math.BigInteger getSecondOfYear_BigInteger()
           
 java.math.BigInteger getYear_BigInteger()
           
 int hashCode()
           
 boolean isBetween(GENESIS_Time _Start_Time, GENESIS_Time _End_Time)
          Inclusive between
 boolean isNormalised()
           
static boolean isNormalised(GENESIS_Time a_Time)
          &TODO Leap years and leap seconds may cause issues.
 void normalise()
           
static void normalise(GENESIS_Time a_Time)
           
 GENESIS_Time subtract(uk.ac.leeds.ccg.andyt.projects.genesis.io.schema.common.Time a_Time)
           
 void subtractDay()
           
 void subtractSecond()
           
 java.lang.String toString()
           
 java.lang.String toStringCSV()
           
 
Methods inherited from class uk.ac.leeds.ccg.andyt.projects.genesis.io.schema.common.Time
getDayOfYear, getSecondOfDay, getYear, setDayOfYear, setSecondOfDay, setYear
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NormalDaysInYear_int

public static final int NormalDaysInYear_int
See Also:
Constant Field Values

NormalHoursInDay_int

public static final int NormalHoursInDay_int
See Also:
Constant Field Values

NormalHoursInYear_int

public static final int NormalHoursInYear_int
See Also:
Constant Field Values

NormalMinutesInHour_int

public static final int NormalMinutesInHour_int
See Also:
Constant Field Values

NormalMinutesInDay_int

public static final int NormalMinutesInDay_int
See Also:
Constant Field Values

NormalMinutesInYear_int

public static final int NormalMinutesInYear_int
See Also:
Constant Field Values

NormalSecondsInMinute_int

public static final int NormalSecondsInMinute_int
See Also:
Constant Field Values

NormalSecondsInHour_int

public static final int NormalSecondsInHour_int
See Also:
Constant Field Values

NormalSecondsInDay_int

public static final int NormalSecondsInDay_int
See Also:
Constant Field Values

NormalSecondsInYear_int

public static final int NormalSecondsInYear_int
See Also:
Constant Field Values

NormalDaysInYear_BigInteger

public static final java.math.BigInteger NormalDaysInYear_BigInteger

NormalSecondsInDay_BigInteger

public static final java.math.BigInteger NormalSecondsInDay_BigInteger

NormalSecondsInYear_BigInteger

public static final java.math.BigInteger NormalSecondsInYear_BigInteger
Constructor Detail

GENESIS_Time

public GENESIS_Time()

GENESIS_Time

public GENESIS_Time(GENESIS_Time t)

GENESIS_Time

public GENESIS_Time(long year,
                    int dayOfYear,
                    int secondOfDay)

GENESIS_Time

public GENESIS_Time(long year,
                    int dayOfYear)

GENESIS_Time

public GENESIS_Time(uk.ac.leeds.ccg.andyt.projects.genesis.io.schema.common.Time t)
Method Detail

checkConsistency

public final void checkConsistency()

getDayOfYear_BigInteger

public java.math.BigInteger getDayOfYear_BigInteger()

getSecondOfDay_BigInteger

public java.math.BigInteger getSecondOfDay_BigInteger()

getYear_BigInteger

public java.math.BigInteger getYear_BigInteger()

getHourOfDay_int

public int getHourOfDay_int()

getMinuteOfHour_int

public int getMinuteOfHour_int()

getRandomTime

public static GENESIS_Time getRandomTime(GENESIS_Time a_LowerTimeLimit,
                                         GENESIS_Time a_UpperTimeLimit,
                                         java.util.Random randomDay,
                                         java.util.Random randomSecond)
This only works where the difference in years is less than Integer.MaxValue.

Parameters:
a_LowerTimeLimit -
a_UpperTimeLimit -
randomYear -
randomDay -
randomSecond -
Returns:
A time between a_LowerTimeLimit inclusive and a_UpperTimeLimit exclusive.

addSecond

public void addSecond()

subtractSecond

public void subtractSecond()

addSeconds

public void addSeconds(long seconds)

addSecondsExclusivelyBetweenZeroAndNormalSecondsInDay

public void addSecondsExclusivelyBetweenZeroAndNormalSecondsInDay(long seconds)

addSecondsExclusivelyBetweenMinusNormalHoursInDayAndZero

public void addSecondsExclusivelyBetweenMinusNormalHoursInDayAndZero(long seconds)

addSeconds

public void addSeconds(java.math.BigInteger seconds)

addMinute

public void addMinute()

addMinutes

public void addMinutes(long minutes)

addHour

public void addHour()

addHours

public void addHours(long hours)

addHoursExclusivelyBetweenZeroAndNormalHoursInDay

public void addHoursExclusivelyBetweenZeroAndNormalHoursInDay(long hours)

addHoursExclusivelyBetweenMinusNormalHoursInDayAndZero

public void addHoursExclusivelyBetweenMinusNormalHoursInDayAndZero(long hours)

addDay

public void addDay()

subtractDay

public void subtractDay()

addDays

public void addDays(long days)

addDays

public void addDays(java.math.BigInteger days)

addDaysExclusivelyBetweenZeroAndNormalDaysInYear

public void addDaysExclusivelyBetweenZeroAndNormalDaysInYear(long days)

addDaysExclusivelyBetweenMinusNormalDaysInYearAndZero

public void addDaysExclusivelyBetweenMinusNormalDaysInYearAndZero(long days)

addYear

public void addYear()

addYears

public void addYears(long years)

getSecondOfYear_BigInteger

public java.math.BigInteger getSecondOfYear_BigInteger()

isBetween

public boolean isBetween(GENESIS_Time _Start_Time,
                         GENESIS_Time _End_Time)
Inclusive between

Parameters:
_Start_Time -
_End_Time -
Returns:

subtract

public GENESIS_Time subtract(uk.ac.leeds.ccg.andyt.projects.genesis.io.schema.common.Time a_Time)

getDifferenceInDays_BigInteger

public java.math.BigInteger getDifferenceInDays_BigInteger(GENESIS_Time a_Time)

getDifferenceInDays_long

public long getDifferenceInDays_long(GENESIS_Time a_Time)
Parameters:
a_Time -
Returns:

getDifferenceInSeconds_BigInteger

public java.math.BigInteger getDifferenceInSeconds_BigInteger(GENESIS_Time a_Time)

getDifferenceInSeconds_long

public long getDifferenceInSeconds_long(GENESIS_Time a_Time)
Parameters:
a_Time -
Returns:

isNormalised

public static boolean isNormalised(GENESIS_Time a_Time)
&TODO Leap years and leap seconds may cause issues. Check and confirm.

Parameters:
a_Time -
Returns:

isNormalised

public boolean isNormalised()

normalise

public final void normalise()

normalise

public static void normalise(GENESIS_Time a_Time)

add

public GENESIS_Time add(GENESIS_Time aGENESIS_Time)
Parameters:
oGENESIS_Time -
Returns:

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toStringCSV

public java.lang.String toStringCSV()

compareTo

public int compareTo(java.lang.Object o)
A error warning is written to System.err.println when the comparison is not for the same class of object. This may or may not be the best way to handle this.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o -
Returns:

equals

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

hashCode

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