Golibri

org.golibri.common
Class YearQuarter

java.lang.Object
  extended byorg.golibri.common.YearQuarter

public final class YearQuarter
extends java.lang.Object

The class YearQuarter is an immutable class and represents email addresses.


Constructor Summary
YearQuarter(java.lang.String yearQuarter)
          Constructor.
 
Method Summary
static YearQuarter addQuarters(YearQuarter yearQuarter, int quarters)
          Static method that adds a number of quarters to a yearquarter and returns the result as a new YearQuarter object.
static YearQuarter addYears(YearQuarter yearQuarter, int years)
          Static method that adds a number of years to a yearquarter and returns the result as a new YearQuarter object.
 boolean equals(java.lang.Object object)
           
 java.util.Date getEndingDate()
          Returns the ending date of the quarter.
 int getQuarter()
          Returns the quarter of the yearquarter
 java.util.Date getStartingDate()
          Returns the starting date of the quarter.
 int getYear()
          Returns the year of the yearquarter
 java.lang.String getYearQuarter()
          Returns the yearquarter as a String
 int hashCode()
           
static boolean isValid(java.lang.String yearQuarter)
          Static method to verify whether a given yearquarter is valid.
static YearQuarter subtractQuarters(YearQuarter yearQuarter, int quarters)
          Static method that subtracts a number of quarters to a yearquarter and returns the result as a new YearQuarter object.
static YearQuarter subtractYears(YearQuarter yearQuarter, int years)
          Static method that subtracts a number of years to a yearquarter and returns the result as a new YearQuarter object.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

YearQuarter

public YearQuarter(java.lang.String yearQuarter)
Constructor. The constructor verifies the validity of the yearquarter that is passed in.

Parameters:
yearQuarter - A String containing the yearquarter address
Throws:
java.lang.NullPointerException - If the parameter yearQuarter is null
java.lang.IllegalArgumentException - If the parameter yearQuarter does not contain a valid yearquarter
Method Detail

isValid

public static boolean isValid(java.lang.String yearQuarter)
Static method to verify whether a given yearquarter is valid.

Parameters:
yearQuarter - The yearquarter to verify.
Returns:
true if the yearquarter is valid, false otherwise

getYear

public int getYear()
Returns the year of the yearquarter

Returns:
The year

getQuarter

public int getQuarter()
Returns the quarter of the yearquarter

Returns:
The quarter

addQuarters

public static YearQuarter addQuarters(YearQuarter yearQuarter,
                                      int quarters)
Static method that adds a number of quarters to a yearquarter and returns the result as a new YearQuarter object. The number of quarters to add must be between 0 and 1000.

Parameters:
quarters - The number of quarters to add
Returns:
the yearquarter which is the result of adding the quarters

addYears

public static YearQuarter addYears(YearQuarter yearQuarter,
                                   int years)
Static method that adds a number of years to a yearquarter and returns the result as a new YearQuarter object. The number of years to add must be between 0 and 1000.

Parameters:
years - The number of years to add
Returns:
the yearquarter which is the result of adding the years

subtractQuarters

public static YearQuarter subtractQuarters(YearQuarter yearQuarter,
                                           int quarters)
Static method that subtracts a number of quarters to a yearquarter and returns the result as a new YearQuarter object. The number of quarters to subtract must be between 0 and 1000.

Parameters:
quarters - The number of quarters to subtract
Returns:
the yearquarter which is the result of subtracting the quarters

subtractYears

public static YearQuarter subtractYears(YearQuarter yearQuarter,
                                        int years)
Static method that subtracts a number of years to a yearquarter and returns the result as a new YearQuarter object. The number of years to subtract must be between 0 and 1000.

Parameters:
years - The number of years to subtract
Returns:
the yearquarter which is the result of adding the years

getStartingDate

public java.util.Date getStartingDate()
Returns the starting date of the quarter.

Returns:
The starting date

getEndingDate

public java.util.Date getEndingDate()
Returns the ending date of the quarter.

Returns:
The ending date

getYearQuarter

public java.lang.String getYearQuarter()
Returns the yearquarter as a String

Returns:
The yearquarter

toString

public java.lang.String toString()
See Also:
Object.toString()

hashCode

public int hashCode()
See Also:
Object.hashCode()

equals

public boolean equals(java.lang.Object object)
See Also:
Object.equals(java.lang.Object)

Golibri