Package org.cesilko.rachota.core
Class Plan
- java.lang.Object
-
- org.cesilko.rachota.core.Plan
-
public class Plan extends java.lang.ObjectPlan containing all days that have some tasks planned. Plan also contains all regular tasks.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDay(Day day)Adds new day to plan.voidaddRegularTask(RegularTask regularTask)Adds new regular task to plan.voidaddRegularTasks(Day day)Adds regular tasks to given day.voidcopyUnfinishedTasks()Copies all unfinished tasks from previous working day to today.static voidcreateBackup()Creates a backup copy of current diary.java.util.VectorgetCategories()Returns all categories that were used to date.DaygetDay(java.util.Date date)Returns day identified by given date.DaygetDayAfter(Day day)Returns one day after given day.DaygetDayBefore(Day day)Returns one day before given day.java.lang.StringgetDayID(java.util.Calendar calendar)Returns identification of day set in given calendar.java.util.IteratorgetDays(int scale)Returns iterator of days according to given period scale.static PlangetDefault()Returns the only available instance of plan.java.util.VectorgetRegularTasks()Returns vector of all regular tasks.booleanisFuture(Day day)Checks if given day will be after today.booleanisToday(Day day)Checks if given day represents today.static voidloadPlan()Loads all planned days and history.static voidloadRegularTasks()Loads plan of regular tasks.voidremoveRegularTask(RegularTask regularTask)Removes existing regular task from plan.static booleansavePlan()Saves all days to XML files.static voidsaveRegularTasks()Saves all regular tasks.
-
-
-
Method Detail
-
getDefault
public static Plan getDefault()
Returns the only available instance of plan.- Returns:
- The only instance of Plan object in system.
-
addDay
public void addDay(Day day)
Adds new day to plan.- Parameters:
day- New day to be added to plan.
-
getDay
public Day getDay(java.util.Date date)
Returns day identified by given date.- Parameters:
date- Date that will be used to find the day.- Returns:
- Day with given date.
-
getDayBefore
public Day getDayBefore(Day day)
Returns one day before given day.- Parameters:
day- Day whose predecessor should be found.- Returns:
- Day before given day.
-
getDayAfter
public Day getDayAfter(Day day)
Returns one day after given day.- Parameters:
day- Day whose ancessor should be found.- Returns:
- Day after given day.
-
getDays
public java.util.Iterator getDays(int scale)
Returns iterator of days according to given period scale.- Parameters:
scale- Period whose days to return. Either week or all time.- Returns:
- Iterator of days from previous week or all days.
-
getDayID
public java.lang.String getDayID(java.util.Calendar calendar)
Returns identification of day set in given calendar.- Parameters:
calendar- Calendar preset to some day.- Returns:
- Identification of day e.g. "2005_2_17"
-
isToday
public boolean isToday(Day day)
Checks if given day represents today.- Parameters:
day- Day that should be checked.- Returns:
- True if given day represents today otherwise false.
-
isFuture
public boolean isFuture(Day day)
Checks if given day will be after today.- Parameters:
day- Day that should be checked.- Returns:
- True if given day represents some day after today otherwise false.
-
addRegularTask
public void addRegularTask(RegularTask regularTask)
Adds new regular task to plan.- Parameters:
regularTask- New regular task to be added to plan.
-
removeRegularTask
public void removeRegularTask(RegularTask regularTask)
Removes existing regular task from plan.- Parameters:
regularTask- Regular task to be removed from plan.
-
getRegularTasks
public java.util.Vector getRegularTasks()
Returns vector of all regular tasks.- Returns:
- Vector of all regular tasks.
-
createBackup
public static void createBackup()
Creates a backup copy of current diary.
-
savePlan
public static boolean savePlan()
Saves all days to XML files.- Returns:
- True if plan was saved successfully, false otherwise
-
loadPlan
public static void loadPlan() throws java.lang.ExceptionLoads all planned days and history.- Throws:
java.lang.Exception- Exception thrown whenever any problem while loading plan occurs.
-
saveRegularTasks
public static void saveRegularTasks()
Saves all regular tasks.
-
loadRegularTasks
public static void loadRegularTasks() throws java.lang.ExceptionLoads plan of regular tasks.- Throws:
java.lang.Exception- Exception thrown whenever any problem while loading regular tasks occurs.
-
copyUnfinishedTasks
public void copyUnfinishedTasks()
Copies all unfinished tasks from previous working day to today.
-
addRegularTasks
public void addRegularTasks(Day day)
Adds regular tasks to given day.- Parameters:
day- Day to be extended for regular tasks.
-
getCategories
public java.util.Vector getCategories()
Returns all categories that were used to date.- Returns:
- Vector of categories that were used to date.
-
-