|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object speedscheduler.Schedule
public class Schedule
The Schedule is fundamental to SpeedScheduler. It stores two Time objects, a set of days of the week, and rate information (max up rate, max down rate, and whether transfers should be paused during this Schedule). SpeedScheduler passes instances of Schedule all over the place to figure out when to do what.
Field Summary | |
---|---|
private boolean |
downloadsPaused
|
private boolean |
enabled
|
private Time |
endTime
|
private int |
maxDownloadRate
|
private int |
maxUploadRate
|
private boolean |
seedsPaused
|
private boolean[] |
selectedDays
|
private Time |
startTime
|
Constructor Summary | |
---|---|
Schedule()
Creates a new schedule with default values. |
|
Schedule(boolean[] selectedDays,
Time startTime,
Time endTime,
int maxUploadRate,
int maxDownloadRate,
boolean downloadsPaused,
boolean seedsPaused)
Create a new Schedule with a specified set of days, start/end times, and rate configuration. |
Method Summary | |
---|---|
boolean |
areDownloadsPaused()
Gets whether transfers are supposed to be paused during this Schedule. |
boolean |
areSeedsPaused()
|
boolean |
equals(java.lang.Object o)
Compares the specified Schedule (t) with this one. |
java.lang.String |
getDaySelectionString()
Gets a human-readable string to show which days of the week have been selected. |
java.lang.String |
getDownloadRateString()
Gets a human-readable string representing the max download speed for this Schedule. |
Time |
getEndTime()
Gets the end time for this Schedule, represented as a Time object. |
java.lang.String |
getHourSelectionString()
Gets a nicely formatted string representing the hours selected by this Schedule. |
int |
getMaxDownloadRate()
Gets the max download rate for this schedule. |
int |
getMaxUploadRate()
Gets the max upload rate for this schedule. |
boolean[] |
getSelectedDays()
Gets the raw boolean array (of size TimeUtils.WEEK_LEN) to show which days have been selected for this Schedule. |
Time |
getStartTime()
Gets the start time for this Schedule. |
java.lang.String |
getUploadRateString()
Gets a human-readable string representing the max upload speed for this Schedule. |
int |
hashCode()
Gets this object's hash code |
boolean |
inSpan(Time time)
Returns true if the specified Time object falls withing the span covered by this Schedule. |
boolean |
isDaySelected(int dayIndex)
Given a day index, gets whether that day is selected by this Schedule. |
boolean |
isEnabled()
Gets whether this Schedule is enabled by the user. |
void |
setDownloadsPaused(boolean paused)
Sets whether downloading torrents are supposed to be paused during this Schedule. |
void |
setEnabled(boolean enabled)
Enable or disable this schedule |
void |
setEndTime(Time endTime)
Sets the end time. |
void |
setMaxDownloadRate(int maxDownloadRate)
Sets the max download rate for this schedule. |
void |
setMaxUploadRate(int maxUploadRate)
Sets the max upload rate for this schedule. |
void |
setSeedsPaused(boolean paused)
Sets whether seeding torrents are supposed to be paused during this Schedule. |
void |
setSelectedDays(boolean[] selectedDays)
Sets the selected days for this Schedule. |
void |
setStartTime(Time startTime)
Sets the start time for this Schedule. |
boolean |
toggleEnabledState()
Toggles the schedule from enabled to disabled and vice versa. |
java.lang.String |
toString()
Gets a human readable representation of this Schedule, mostly for debugging purposes. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private Time startTime
private Time endTime
private boolean[] selectedDays
private int maxUploadRate
private int maxDownloadRate
private boolean seedsPaused
private boolean downloadsPaused
private boolean enabled
Constructor Detail |
---|
public Schedule(boolean[] selectedDays, Time startTime, Time endTime, int maxUploadRate, int maxDownloadRate, boolean downloadsPaused, boolean seedsPaused)
selectedDays
- An array of 7 booleans (see TimeUtils.WEEK_LEN) representing
which days of the week this Schedule applies to. True entries in thearray
indicate that this Schedule does apply, and False entries indicate
the opposite. Sunday is index 0 and Saturday is index 6.startTime
- The start time of this Schedule.endTime
- The end time of this Schedule.maxUploadRate
- The maxium upload rate for this Schedule.maxDownloadRate
- The maxium download rate for this Schedule.downloadsPaused
- True if all torrents should be paused during this Schedule.public Schedule()
Method Detail |
---|
public java.lang.String getDaySelectionString()
public Time getEndTime()
public java.lang.String getHourSelectionString()
public java.lang.String getUploadRateString()
public java.lang.String getDownloadRateString()
public boolean[] getSelectedDays()
public Time getStartTime()
public boolean inSpan(Time time)
time
- The time to check.
public boolean isDaySelected(int dayIndex)
dayIndex
-
public void setEndTime(Time endTime)
endTime
- The end time.public void setSelectedDays(boolean[] selectedDays)
selectedDays
- The selected days array.public void setStartTime(Time startTime)
startTime
- The start time.public java.lang.String toString()
toString
in class java.lang.Object
public int getMaxDownloadRate()
public void setMaxDownloadRate(int maxDownloadRate)
public int getMaxUploadRate()
public void setMaxUploadRate(int maxUploadRate)
public boolean areDownloadsPaused()
public void setDownloadsPaused(boolean paused)
public void setSeedsPaused(boolean paused)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
t
- The Schedule to compare to this one
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public boolean isEnabled()
public void setEnabled(boolean enabled)
enabled
- The enabled to set.public boolean toggleEnabledState()
public boolean areSeedsPaused()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |