Package org.codelibs.fess.helper
Class IntervalControlHelper.IntervalRule
java.lang.Object
org.codelibs.fess.helper.IntervalControlHelper.IntervalRule
- Enclosing class:
IntervalControlHelper
Represents a rule for controlling crawler intervals.
Each rule defines a time range, applicable days, and delay amount.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int[]Array of days when this rule applies (1=Sunday, 7=Saturday)protected longDelay in milliseconds to apply during this intervalprotected intStarting hour of the intervalprotected intStarting minute of the intervalprotected booleanFlag indicating if the interval spans across midnightprotected intEnding hour of the intervalprotected intEnding minute of the interval -
Constructor Summary
ConstructorsConstructorDescriptionIntervalRule(String from, String to, String days, long delay) Creates a new interval rule. -
Method Summary
Modifier and TypeMethodDescriptionprotected intcompareTime(int h1, int m1, int h2, int m2) Compares two times.longgetDelay()Gets the delay amount for this rule.booleanisTarget(int hours, int minutes, int day) Checks if this rule applies to the given time and day.
-
Field Details
-
fromHours
protected int fromHoursStarting hour of the interval -
fromMinutes
protected int fromMinutesStarting minute of the interval -
toHours
protected int toHoursEnding hour of the interval -
toMinutes
protected int toMinutesEnding minute of the interval -
delay
protected long delayDelay in milliseconds to apply during this interval -
days
protected int[] daysArray of days when this rule applies (1=Sunday, 7=Saturday) -
reverse
protected boolean reverseFlag indicating if the interval spans across midnight
-
-
Constructor Details
-
IntervalRule
Creates a new interval rule.- Parameters:
from- the start time in HH:MM formatto- the end time in HH:MM formatdays- comma-separated list of days (1=Sunday, 7=Saturday)delay- the delay in milliseconds to apply during this interval
-
-
Method Details
-
getDelay
public long getDelay()Gets the delay amount for this rule.- Returns:
- the delay in milliseconds
-
isTarget
public boolean isTarget(int hours, int minutes, int day) Checks if this rule applies to the given time and day.- Parameters:
hours- the hour of the day (0-23)minutes- the minute of the hour (0-59)day- the day of the week (1=Sunday, 7=Saturday)- Returns:
- true if this rule applies, false otherwise
-
compareTime
protected int compareTime(int h1, int m1, int h2, int m2) Compares two times.- Parameters:
h1- the first hourm1- the first minuteh2- the second hourm2- the second minute- Returns:
- positive if first time is earlier, 0 if equal, negative if later
-