BrightSide Workbench Full Report + Source Code
All Classes Namespaces Files Functions Variables Pages
org.turro.scheduler.constraints.WeekDayConstraint Class Reference
Inheritance diagram for org.turro.scheduler.constraints.WeekDayConstraint:
Collaboration diagram for org.turro.scheduler.constraints.WeekDayConstraint:

Public Member Functions

void readXML (Element root)
 
void writeXML (Element root)
 
WeekDayConstraint setAll ()
 
boolean isValid (Date date)
 
boolean needsRefresh ()
 
WeekDay getWeekDay (Date date)
 

Detailed Description

Author
Lluis Turró Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 32 of file constraints/WeekDayConstraint.java.

Member Function Documentation

◆ getWeekDay()

WeekDay org.turro.scheduler.constraints.WeekDayConstraint.getWeekDay ( Date  date)

Definition at line 75 of file constraints/WeekDayConstraint.java.

75  {
76  Calendar c = Calendar.getInstance();
77  c.setTime(date);
78  switch(c.get(Calendar.DAY_OF_WEEK)) {
79  case Calendar.MONDAY:
80  return WeekDay.MONDAY;
81  case Calendar.TUESDAY:
82  return WeekDay.TUESDAY;
83  case Calendar.WEDNESDAY:
84  return WeekDay.WEDNESDAY;
85  case Calendar.THURSDAY:
86  return WeekDay.THURSDAY;
87  case Calendar.FRIDAY:
88  return WeekDay.FRIDAY;
89  case Calendar.SATURDAY:
90  return WeekDay.SATURDAY;
91  case Calendar.SUNDAY:
92  return WeekDay.SUNDAY;
93  }
94  return null;
95  }
Here is the caller graph for this function:

◆ isValid()

boolean org.turro.scheduler.constraints.WeekDayConstraint.isValid ( Date  date)

Definition at line 59 of file constraints/WeekDayConstraint.java.

59  {
60  refresh = false;
61  WeekDay wd = getWeekDay(date);
62  if(wd != null && contains(wd)) {
63  refresh = !wd.equals(lastCheck);
64  lastCheck = wd;
65  return true;
66  }
67  lastCheck = wd;
68  return isEmpty();
69  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ needsRefresh()

boolean org.turro.scheduler.constraints.WeekDayConstraint.needsRefresh ( )

Definition at line 71 of file constraints/WeekDayConstraint.java.

71  {
72  return refresh;
73  }
Here is the caller graph for this function:

◆ readXML()

void org.turro.scheduler.constraints.WeekDayConstraint.readXML ( Element  root)

Definition at line 37 of file constraints/WeekDayConstraint.java.

37  {
38  Element parent = root.getChild("week-day-constraint");
39  for(Element el : (List<Element>) parent.getChildren("week-day")) {
40  add(WeekDay.valueOf(el.getAttributeValue("name")));
41  }
42  }
Here is the caller graph for this function:

◆ setAll()

WeekDayConstraint org.turro.scheduler.constraints.WeekDayConstraint.setAll ( )

Definition at line 54 of file constraints/WeekDayConstraint.java.

54  {
55  addAll(EnumSet.allOf(WeekDay.class));
56  return this;
57  }

◆ writeXML()

void org.turro.scheduler.constraints.WeekDayConstraint.writeXML ( Element  root)

Definition at line 44 of file constraints/WeekDayConstraint.java.

44  {
45  Element el = new Element("week-day-constraint");
46  root.addContent(el);
47  for(WeekDay wd : this) {
48  Element e = new Element("week-day");
49  e.setAttribute("name", wd.toString());
50  el.addContent(e);
51  }
52  }
Here is the caller graph for this function:

The documentation for this class was generated from the following file: