public class DutySchedule extends Object
| Modifier and Type | Field and Description | 
|---|---|
static String[] | 
DAY_NAMES
A list of names to abbreviate the days of the week 
 | 
static int | 
FRIDAY
Constant  
FRIDAY=4 | 
static int | 
MONDAY
A series of constants to identify the days of the week as used by the
 DutySchedule class 
 | 
static int | 
SATURDAY
Constant  
SATURDAY=5 | 
static int | 
SUNDAY
Constant  
SUNDAY=6 | 
static int | 
THURSDAY
Constant  
THURSDAY=3 | 
static int | 
TUESDAY
Constant  
TUESDAY=1 | 
static int | 
WEDNESDAY
Constant  
WEDNESDAY=2 | 
| Constructor and Description | 
|---|
DutySchedule()
Default constructor, builds the BitSet used to identify the days of the
 week that are set. 
 | 
DutySchedule(List<Boolean> schedule,
            int start,
            int end)
This constructor is designed to convert from a Vector filled with 7
 Boolean objects and two String objects into the BitSet and integer start
 and stop time. 
 | 
DutySchedule(String aSchedule)
This constructor is designed to build a new DutySchedule from a String
 representation formatted as such. 
 | 
DutySchedule(Vector<Object> aSchedule)
This constructor is designed to convert from a Vector filled with 7
 Boolean objects and two String objects into the BitSet and integer start
 and stop time. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
Vector<Object> | 
getAsVector()
This method formats the DutySchedule as a vector populated with the first
 seven objects as Booleans set to indicate what days of the week are
 stored, and the last two objects as Strings that reflect the start time
 and stop time respectively. 
 | 
int | 
getStartTime()
This method return the start time as an integer 
 | 
int | 
getStopTime()
This method return the stop time as an integer 
 | 
boolean | 
hasDay(int aDay)
hasDay 
 | 
boolean | 
isInSchedule(Calendar aTime)
This method decides if a given time falls within the duty schedule
 contained in this object. 
 | 
boolean | 
isInSchedule(Date time)
isInSchedule 
 | 
long | 
nextInSchedule(Calendar nTime)
This method decides if a given time falls within the duty schedule
 contained in this object. 
 | 
void | 
setDay(int aDay)
This method sets the BitSet that tracks what days this DutySchedule
 applies to. 
 | 
void | 
setEndHour(int anHour)
This method sets the stop time of this DutySchedule 
 | 
void | 
setStartHour(int anHour)
This method sets the start time of this DutySchedule 
 | 
String | 
toString()
This method returns the DutySchedule formatted as a string that the
 DutySchedule(String) constructor could parse. 
 | 
public static final int MONDAY
public static final int TUESDAY
TUESDAY=1public static final int WEDNESDAY
WEDNESDAY=2public static final int THURSDAY
THURSDAY=3public static final int FRIDAY
FRIDAY=4public static final int SATURDAY
SATURDAY=5public static final int SUNDAY
SUNDAY=6public static final String[] DAY_NAMES
public DutySchedule()
public DutySchedule(Vector<Object> aSchedule)
aSchedule - filled with 7 Boolean objects and two String objectspublic DutySchedule(List<Boolean> schedule, int start, int end)
schedule - a List object.start - a int.end - a int.public DutySchedule(String aSchedule)
aSchedule - the string to convert to a new DutySchedulepublic void setDay(int aDay)
aDay - the day index to set in the BitSetpublic int getStartTime()
public int getStopTime()
public Vector<Object> getAsVector()
public boolean isInSchedule(Calendar aTime)
aTime - The time to check.public long nextInSchedule(Calendar nTime)
nTime - The time to check.public void setStartHour(int anHour)
anHour - The hour in military time to set the start time for the
            DutySchedule.public void setEndHour(int anHour)
anHour - The hour in military time to set the end time for the
            DutySchedule.public String toString()
public boolean isInSchedule(Date time)
isInSchedule
time - a Date object.public boolean hasDay(int aDay)
hasDay
aDay - a int.Copyright © 2020. All rights reserved.