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

Public Member Functions

void readXML (Element root)
 
void writeXML (Element root)
 
HourConstraint setAll ()
 
HourConstraint setAllAM ()
 
HourConstraint setAllPM ()
 
boolean isValid (Date date)
 
boolean needsRefresh ()
 
Integer getHour (Date date)
 

Detailed Description

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

Definition at line 31 of file constraints/HourConstraint.java.

Member Function Documentation

◆ getHour()

Integer org.turro.scheduler.constraints.HourConstraint.getHour ( Date  date)

Definition at line 90 of file constraints/HourConstraint.java.

90  {
91  Calendar c = Calendar.getInstance();
92  c.setTime(date);
93  return c.get(Calendar.HOUR_OF_DAY);
94  }
Here is the caller graph for this function:

◆ isValid()

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

Definition at line 74 of file constraints/HourConstraint.java.

74  {
75  refresh = false;
76  Integer h = getHour(date);
77  if(h != null && contains(h)) {
78  refresh = !h.equals(lastCheck);
79  lastCheck = h;
80  return true;
81  }
82  lastCheck = h;
83  return isEmpty();
84  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ needsRefresh()

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

Definition at line 86 of file constraints/HourConstraint.java.

86  {
87  return refresh;
88  }
Here is the caller graph for this function:

◆ readXML()

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

Definition at line 36 of file constraints/HourConstraint.java.

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

◆ setAll()

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

Definition at line 53 of file constraints/HourConstraint.java.

53  {
54  for(int i = 0; i < 24; i++) {
55  add(i);
56  }
57  return this;
58  }

◆ setAllAM()

HourConstraint org.turro.scheduler.constraints.HourConstraint.setAllAM ( )

Definition at line 60 of file constraints/HourConstraint.java.

60  {
61  for(int i = 0; i < 12; i++) {
62  add(i);
63  }
64  return this;
65  }

◆ setAllPM()

HourConstraint org.turro.scheduler.constraints.HourConstraint.setAllPM ( )

Definition at line 67 of file constraints/HourConstraint.java.

67  {
68  for(int i = 12; i < 24; i++) {
69  add(i);
70  }
71  return this;
72  }

◆ writeXML()

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

Definition at line 43 of file constraints/HourConstraint.java.

43  {
44  Element el = new Element("hour-constraint");
45  root.addContent(el);
46  for(Integer i : this) {
47  Element e = new Element("hour");
48  e.setAttribute("name", i + "");
49  el.addContent(e);
50  }
51  }
Here is the caller graph for this function:

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