import net.sf.memoranda.date.CalendarDate; //导入方法依赖的package包/类
public Collection getNotesForPeriod(CalendarDate startDate, CalendarDate endDate) {
Vector v = new Vector();
Elements yrs = _root.getChildElements("year");
for (int yi = 0; yi < yrs.size(); yi++) {
Year y = new Year(yrs.get(yi));
if ((y.getValue() >= startDate.getYear()) && (y.getValue() <= endDate.getYear())) {
Vector months = y.getMonths();
for (int mi = 0; mi < months.size(); mi++) {
Month m = (Month) months.get(mi);
if (!((y.getValue() == startDate.getYear()) && (m.getValue() < startDate.getMonth()))
|| !((y.getValue() == endDate.getYear()) && (m.getValue() > endDate.getMonth()))) {
Vector days = m.getDays();
for (int di = 0; di < days.size(); di++) {
Day d = (Day) days.get(di);
if (!((m.getValue() == startDate.getMonth()) && (d.getValue() < startDate.getDay()))
|| !((m.getValue() == endDate.getMonth()) && (d.getValue() > endDate.getDay()))) {
Vector ns = d.getNotes();
for(int ni = 0; ni < ns.size(); ni++) {
NoteElement n = (NoteElement) ns.get(ni);
v.add(new NoteImpl(n.getElement(), _project));
}
}
}
}
}
}
}
return v;
}