|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.wpi.prc.task.Task
edu.wpi.prc.task.WorkUnit
public class WorkUnit
A WorkUnit is a type of Task that contains raw data to be analyzed by the science application. It can be sent to one or more clients.
Field Summary | |
---|---|
private int |
assignmentCount
|
static long |
DEFAULT_EXPIRATION_TIME
|
private java.util.Date |
expirationDate
|
private long |
expirationDelta
|
private int |
numValidResults
|
private int |
points
|
private java.util.Set<Volunteer> |
users
|
Fields inherited from class edu.wpi.prc.task.Task |
---|
MIN_PRIORITY |
Constructor Summary | |
---|---|
protected |
WorkUnit()
Default constructor is protected so that the WorkUnit will either be created by the TaskFactory or the public constructor that takes a task ID will be called. |
protected |
WorkUnit(java.lang.String taskID)
Constructor that takes a task ID. |
Method Summary | |
---|---|
void |
assignUser(Volunteer user)
Add a user to the set of users associated with this work unit, and increments the assignment count. |
void |
delete()
Deletes a WorkUnit from the database. |
boolean |
equals(java.lang.Object o)
Tests whether this WorkUnit is equal to another. |
WorkUnit[] |
find()
Finds all WorkUnits in the database that match the attributes set in this WorkUnit. |
static WorkUnit[] |
findAll()
Finds all WorkUnits in the database. |
static WorkUnit[] |
findAllEgress()
|
static WorkUnit[] |
findAllIngress()
|
static WorkUnit[] |
findAllPending()
|
static WorkUnit[] |
findAllSpotCheck()
|
int |
getAssignmentCount()
|
protected java.util.Date |
getExpirationDate()
|
protected long |
getExpirationDelta()
|
int |
getNumValidResults()
|
int |
getPoints()
|
java.util.Set<Volunteer> |
getUsers()
|
boolean |
hasExpired()
|
boolean |
hasUser(Volunteer user)
Tests whether this work unit has been assigned to the given user. |
void |
incrementNumValidResults()
Increments the number of valid results for this work unit. |
void |
removeAllusers()
Removes all users from this work unit. |
Volunteer |
removeUser(Volunteer user)
Remove a user from the set of users associated with this work unit. |
void |
resetExpirationDate()
Sets this work unit's expiration date to the current time plus the expiration time. |
void |
save()
Inserts this WorkUnit into the database as a new record. |
void |
setAssignmentCount(int assignmentCount)
|
protected void |
setExpirationDate(java.util.Date expirationDate)
|
protected void |
setExpirationDelta(long expirationDelta)
|
void |
setExpirationTime(long expirationTime)
Sets the expiration time and, then calculates and sets the expiration date. |
protected void |
setNumValidResults(int numValidResults)
|
void |
setPoints(int points)
|
protected void |
setUsers(java.util.Set<Volunteer> users)
|
void |
update()
Updates this WorkUnit in the database. |
Methods inherited from class edu.wpi.prc.task.Task |
---|
getCreationDate, getData, getDataPartitions, getId, getPriority, getState, getStateStr, getTaskID, isEqual, setCreationDate, setData, setDataPartitions, setId, setPriority, setState, setStateStr, setTaskID |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long DEFAULT_EXPIRATION_TIME
private int points
private int numValidResults
private java.util.Set<Volunteer> users
private int assignmentCount
private java.util.Date expirationDate
private long expirationDelta
Constructor Detail |
---|
protected WorkUnit()
protected WorkUnit(java.lang.String taskID)
taskID
- The task ID to set.Method Detail |
---|
public int getPoints()
public void setPoints(int points)
points
- The points to set.public int getNumValidResults()
protected void setNumValidResults(int numValidResults)
numValidResults
- The numValidResults to set.public void incrementNumValidResults()
public java.util.Set<Volunteer> getUsers()
protected void setUsers(java.util.Set<Volunteer> users)
users
- The users to set.public void assignUser(Volunteer user)
user
- The user to add.public void removeAllusers()
public boolean hasUser(Volunteer user)
user
- The user to search for.
public Volunteer removeUser(Volunteer user)
user
- The user to remove.
public int getAssignmentCount()
public void setAssignmentCount(int assignmentCount)
assignmentCount
- The assignmentCount to set.protected java.util.Date getExpirationDate()
protected void setExpirationDate(java.util.Date expirationDate)
expirationDate
- The expirationDate to set.public boolean hasExpired()
protected long getExpirationDelta()
protected void setExpirationDelta(long expirationDelta)
expirationDelta
- The expirationDelta to set.public void setExpirationTime(long expirationTime)
expirationTime
- The expiration time in seconds to set.public void resetExpirationDate()
public void save()
save
in class Task
public void update()
update
in class Task
public WorkUnit[] find()
public static WorkUnit[] findAll()
public static WorkUnit[] findAllIngress()
public static WorkUnit[] findAllPending()
public static WorkUnit[] findAllEgress()
public static WorkUnit[] findAllSpotCheck()
public void delete()
delete
in class Task
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- The object to compare this WorkUnit to.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |