com.blogspot.applications4android.comicreader.comictypes
Class DailyGoComicsCalendar

java.lang.Object
  extended by com.blogspot.applications4android.comicreader.comictypes.DailyGoComicsCalendar

public class DailyGoComicsCalendar
extends java.lang.Object

Class responsible for querying the calendar.js from gocomics


Field Summary
 int mCurrMon
          current month
 int mCurrYr
          current year
 int[] mValidDays
          array of valid days for this month
 
Constructor Summary
DailyGoComicsCalendar()
           
 
Method Summary
 void findValidDays(int year, int mon, int increment)
          gets the valid days for the given year and month.
 java.util.Calendar getCurrentCalendar()
          Helper function to construct the calendar instance from the current temporary state
 java.util.Calendar getNextDate()
          get the next date wrt the current state
 java.util.Calendar getPreviousDate()
          get the previous date wrt the current state
 java.util.Calendar getRandomDate(java.util.Calendar first, java.util.Calendar latest)
          get a random date wrt the given bounds
 java.util.Calendar setDate(java.util.Calendar date, int curr)
          This will be used by first/latest calendar 'getters' in gocomics
 void setGoComics(DailyGoComicsCom gcc)
          set the gocomics instance for this object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mCurrYr

public int mCurrYr
current year


mCurrMon

public int mCurrMon
current month


mValidDays

public int[] mValidDays
array of valid days for this month

Constructor Detail

DailyGoComicsCalendar

public DailyGoComicsCalendar()
Method Detail

setGoComics

public void setGoComics(DailyGoComicsCom gcc)
set the gocomics instance for this object

Parameters:
gcc - gocomics instance

getCurrentCalendar

public java.util.Calendar getCurrentCalendar()
Helper function to construct the calendar instance from the current temporary state

Returns:
calendar instance

getPreviousDate

public java.util.Calendar getPreviousDate()
get the previous date wrt the current state

Returns:
previous date

getNextDate

public java.util.Calendar getNextDate()
get the next date wrt the current state

Returns:
next date

setDate

public java.util.Calendar setDate(java.util.Calendar date,
                                  int curr)
This will be used by first/latest calendar 'getters' in gocomics

Parameters:
date - date of the first/latest calendar
curr - >0 means first calendar, <0 means latest calendar, else the same date as in 'date'
Returns:
the current calendar

getRandomDate

public java.util.Calendar getRandomDate(java.util.Calendar first,
                                        java.util.Calendar latest)
get a random date wrt the given bounds

Returns:
random date

findValidDays

public void findValidDays(int year,
                          int mon,
                          int increment)
gets the valid days for the given year and month. Also update them if there are no valid days in the current month

Parameters:
year - desired year
mon - desired month
increment - whether to increment or decrement