本文整理汇总了Java中net.sf.memoranda.date.CalendarDate.inPeriod方法的典型用法代码示例。如果您正苦于以下问题:Java CalendarDate.inPeriod方法的具体用法?Java CalendarDate.inPeriod怎么用?Java CalendarDate.inPeriod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.memoranda.date.CalendarDate
的用法示例。
在下文中一共展示了CalendarDate.inPeriod方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getStatus
import net.sf.memoranda.date.CalendarDate; //导入方法依赖的package包/类
/**
* @see net.sf.memoranda.Project#getStatus()
*/
public int getStatus() {
if (isFrozen())
return Project.FROZEN;
CalendarDate today = CurrentDate.get();
CalendarDate prStart = getStartDate();
CalendarDate prEnd = getEndDate();
if (prEnd == null) {
if (today.before(prStart))
return Project.SCHEDULED;
else
return Project.ACTIVE;
}
if (today.inPeriod(prStart, prEnd))
return Project.ACTIVE;
else if (today.after(prEnd)) {
//if (getProgress() == 100)
return Project.COMPLETED;
/*else
return Project.FAILED;*/
}
else
return Project.SCHEDULED;
}
示例2: getStatus
import net.sf.memoranda.date.CalendarDate; //导入方法依赖的package包/类
/**s
* @see net.sf.memoranda.Task#getStatus()
*/
public int getStatus(CalendarDate date) {
CalendarDate start = getStartDate();
CalendarDate end = getEndDate();
if (isFrozen())
return Task.FROZEN;
if (isCompleted())
return Task.COMPLETED;
if (date.inPeriod(start, end)) {
if (date.equals(end))
return Task.DEADLINE;
else
return Task.ACTIVE;
}
else if(date.before(start)) {
return Task.SCHEDULED;
}
if(start.after(end)) {
return Task.ACTIVE;
}
return Task.FAILED;
}
示例3: getStatus
import net.sf.memoranda.date.CalendarDate; //导入方法依赖的package包/类
/**
* @see net.sf.memoranda.Project#getStatus(CalendarDate)
*/
public int getStatus(CalendarDate date) {
// There's no way to tell when a project was frozen, so a project that
// is frozen is frozen at any date
if (isFrozen()) {
return Project.FROZEN;
}
if (getEndDate() == null) {
if (date.before(getStartDate())) {
return Project.SCHEDULED;
} else {
return Project.ACTIVE;
}
} else if (date.inPeriod(getStartDate(), getEndDate())) {
return Project.ACTIVE;
} else if (date.after(getEndDate())) {
return Project.COMPLETED;
} else {
return Project.SCHEDULED;
}
}
示例4: getStatus
import net.sf.memoranda.date.CalendarDate; //导入方法依赖的package包/类
/**
* @see net.sf.memoranda.Project#getStatus()
*/
public int getStatus() {
if (isFrozen())
return Project.FROZEN;
CalendarDate today = CurrentDate.get();
CalendarDate prStart = getStartDate();
CalendarDate prEnd = getEndDate();
if (prEnd == null) {
if (today.before(prStart))
return Project.SCHEDULED;
else
return Project.ACTIVE;
}
if (today.inPeriod(prStart, prEnd))
return Project.ACTIVE;
else if (today.after(prEnd)) {
//if (getProgress() == 100)
return Project.OVERDUE;
/*else
return Project.FAILED;*/
}
else
return Project.SCHEDULED;
}
示例5: getStatus
import net.sf.memoranda.date.CalendarDate; //导入方法依赖的package包/类
/**
* @see net.sf.memoranda.Project#getStatus()
*/
public int getStatus() {
if (isFrozen())
return Project.FROZEN;
CalendarDate today = CurrentDate.get();
CalendarDate prStart = getStartDate();
CalendarDate prEnd = getEndDate();
if (prEnd == null) {
if (today.before(prStart))
return Project.SCHEDULED;
else
return Project.ACTIVE;
}
if (today.inPeriod(prStart, prEnd))
return Project.ACTIVE;
else if (today.after(prEnd)) {
//if (getProgress() == 100)
return Project.COMPLETED;
/*else
return Project.FAILED;*/
}
else
return Project.SCHEDULED;
}
示例6: getRepeatableEventsForDate
import net.sf.memoranda.date.CalendarDate; //导入方法依赖的package包/类
public static Collection getRepeatableEventsForDate(CalendarDate date) {
Vector reps = (Vector) getRepeatableEvents();
Vector v = new Vector();
for (int i = 0; i < reps.size(); i++) {
Event ev = (Event) reps.get(i);
// --- ivanrise
// ignore this event if it's a 'only working days' event and today is weekend.
if(ev.getWorkingDays() && (date.getCalendar().get(Calendar.DAY_OF_WEEK) == 1 ||
date.getCalendar().get(Calendar.DAY_OF_WEEK) == 7)) continue;
// ---
/*
* /if ( ((date.after(ev.getStartDate())) &&
* (date.before(ev.getEndDate()))) ||
* (date.equals(ev.getStartDate()))
*/
//System.out.println(date.inPeriod(ev.getStartDate(),
// ev.getEndDate()));
if (date.inPeriod(ev.getStartDate(), ev.getEndDate())) {
if (ev.getRepeat() == REPEAT_DAILY) {
int n = date.getCalendar().get(Calendar.DAY_OF_YEAR);
int ns =
ev.getStartDate().getCalendar().get(
Calendar.DAY_OF_YEAR);
//System.out.println((n - ns) % ev.getPeriod());
if ((n - ns) % ev.getPeriod() == 0)
v.add(ev);
} else if (ev.getRepeat() == REPEAT_WEEKLY) {
if (date.getCalendar().get(Calendar.DAY_OF_WEEK)
== ev.getPeriod())
v.add(ev);
} else if (ev.getRepeat() == REPEAT_MONTHLY) {
if (date.getCalendar().get(Calendar.DAY_OF_MONTH)
== ev.getPeriod())
v.add(ev);
} else if (ev.getRepeat() == REPEAT_YEARLY) {
int period = ev.getPeriod();
//System.out.println(date.getCalendar().get(Calendar.DAY_OF_YEAR));
if ((date.getYear() % 4) == 0
&& date.getCalendar().get(Calendar.DAY_OF_YEAR) > 60)
period++;
if (date.getCalendar().get(Calendar.DAY_OF_YEAR) == period)
v.add(ev);
}
}
}
return v;
}
示例7: getRepeatableEventsForDate
import net.sf.memoranda.date.CalendarDate; //导入方法依赖的package包/类
/**
*
* @param date day to check
* @return a collection of all repeatable events scheduled on date
*/
public static List<Event> getRepeatableEventsForDate(CalendarDate date) {
List<Event> reps = getRepeatableEvents();
List<Event> repsForDate = new ArrayList<>();
for (Event e : reps) {
// ignore this event if it's a 'only working days' event and today is weekend.
if (e.getWorkingDays() && (date.getCalendar().get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY) ||
date.getCalendar().get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
continue;
}
if (date.inPeriod(e.getStartDate(), e.getEndDate())) {
if (e.getRepeatType() == Event.RepeatType.REPEAT_DAILY) {
int n = date.getCalendar().get(Calendar.DAY_OF_YEAR);
int ns = e.getStartDate().getCalendar().get(Calendar.DAY_OF_YEAR);
if ((n - ns) % e.getPeriod() == 0) {
repsForDate.add(e);
}
} else if (e.getRepeatType() == Event.RepeatType.REPEAT_WEEKLY) {
if (e.getRepeatDays()[date.getCalendar().get(Calendar.DAY_OF_WEEK) - 1]) {
repsForDate.add(e);
}
} else if (e.getRepeatType() == Event.RepeatType.REPEAT_MONTHLY) {
if (date.getCalendar().get(Calendar.DAY_OF_MONTH) == e.getPeriod()) {
repsForDate.add(e);
}
} else if (e.getRepeatType() == Event.RepeatType.REPEAT_YEARLY) {
int period = e.getPeriod();
if ((date.getYear() % 4) == 0 && date.getCalendar().get(Calendar.DAY_OF_YEAR) > 60) {
period++;
}
if (date.getCalendar().get(Calendar.DAY_OF_YEAR) == period) {
repsForDate.add(e);
}
}
}
}
return repsForDate;
}
示例8: getRepeatableEventsForDate
import net.sf.memoranda.date.CalendarDate; //导入方法依赖的package包/类
public static Collection getRepeatableEventsForDate(CalendarDate date) {
Vector reps = (Vector) getRepeatableEvents();
Vector v = new Vector();
for (int i = 0; i < reps.size(); i++) {
Event ev = (Event) reps.get(i);
// --- ivanrise
// ignore this event if it's a 'only working days' event and today is weekend.
if(ev.getWorkingDays() && (date.getCalendar().get(Calendar.DAY_OF_WEEK) == 1 ||
date.getCalendar().get(Calendar.DAY_OF_WEEK) == 7)) continue;
// ---
/*
* /if ( ((date.after(ev.getStartDate())) &&
* (date.before(ev.getEndDate()))) ||
* (date.equals(ev.getStartDate()))
*/
//System.out.println(date.inPeriod(ev.getStartDate(),
// ev.getEndDate()));
if (date.inPeriod(ev.getStartDate(), ev.getEndDate())) {
if (ev.getRepeat() == REPEAT_DAILY) {
int n = date.getCalendar().get(Calendar.DAY_OF_YEAR);
int ns =
ev.getStartDate().getCalendar().get(
Calendar.DAY_OF_YEAR);
//System.out.println((n - ns) % ev.getPeriod());arg0
if ((n - ns) % ev.getPeriod() == 0)
v.add(ev);
} else if (ev.getRepeat() == REPEAT_WEEKLY) {
if (date.getCalendar().get(Calendar.DAY_OF_WEEK)
== ev.getPeriod())
v.add(ev);
} else if (ev.getRepeat() == REPEAT_MONTHLY) {
if (date.getCalendar().get(Calendar.DAY_OF_MONTH)
== ev.getPeriod())
v.add(ev);
} else if (ev.getRepeat() == REPEAT_YEARLY) {
int period = ev.getPeriod();
//System.out.println(date.getCalendar().get(Calendar.DAY_OF_YEAR));
if ((date.getYear() % 4) == 0
&& date.getCalendar().get(Calendar.DAY_OF_YEAR) > 60)
period++;
if (date.getCalendar().get(Calendar.DAY_OF_YEAR) == period)
v.add(ev);
}
}
}
return v;
}