BrightSide Workbench Full Report + Source Code
org.turro.scheduler.constraints.MonthConstraint Class Reference
Inheritance diagram for org.turro.scheduler.constraints.MonthConstraint:
Collaboration diagram for org.turro.scheduler.constraints.MonthConstraint:

Public Member Functions

void readXML (Element root)
 
void writeXML (Element root)
 
MonthConstraint setAll ()
 
boolean isValid (Date date)
 
boolean needsRefresh ()
 
Month getMonth (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/MonthConstraint.java.

Member Function Documentation

◆ getMonth()

Month org.turro.scheduler.constraints.MonthConstraint.getMonth ( Date  date)

Definition at line 76 of file constraints/MonthConstraint.java.

76  {
77  Calendar c = Calendar.getInstance();
78  c.setTime(date);
79  switch(c.get(Calendar.MONTH)) {
80  case Calendar.JANUARY:
81  return Month.JANUARY;
82  case Calendar.FEBRUARY:
83  return Month.FEBRUARY;
84  case Calendar.MARCH:
85  return Month.MARCH;
86  case Calendar.APRIL:
87  return Month.APRIL;
88  case Calendar.MAY:
89  return Month.MAY;
90  case Calendar.JUNE:
91  return Month.JUNE;
92  case Calendar.JULY:
93  return Month.JULY;
94  case Calendar.AUGUST:
95  return Month.AUGUST;
96  case Calendar.SEPTEMBER:
97  return Month.SEPTEMBER;
98  case Calendar.OCTOBER:
99  return Month.OCTOBER;
100  case Calendar.NOVEMBER:
101  return Month.NOVEMBER;
102  case Calendar.DECEMBER:
103  return Month.DECEMBER;
104  }
105  return null;
106  }
Here is the caller graph for this function:

◆ isValid()

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

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

59  {
60  refresh = false;
61  Month m = getMonth(date);
62  if(m != null && contains(m)) {
63  refresh = !m.equals(lastCheck);
64  lastCheck = m;
65  return true;
66  }
67  lastCheck = m;
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.MonthConstraint.needsRefresh ( )

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

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

◆ readXML()

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

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

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

◆ setAll()

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

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

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

◆ writeXML()

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

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

44  {
45  Element el = new Element("month-constraint");
46  root.addContent(el);
47  for(Month m : this) {
48  Element e = new Element("month");
49  e.setAttribute("name", m.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: