T
- the type of the optional user objectpublic class MutableActivityBase<T> extends ActivityBase<T> implements MutableActivity
MutableActivity
interface. By doing so
we now have access to various setter methods to alter the state of the
activity.DEFAULT_DURATION, endTime, id, name, startTime, userObject
Constructor and Description |
---|
MutableActivityBase()
Constructs a new mutable activity.
|
MutableActivityBase(Instant startTime,
Instant endTime)
Constructs a new mutable activity with the start time and end time.
|
MutableActivityBase(String name)
Constructs a new mutable activity with the given name.
|
MutableActivityBase(String name,
Instant startTime,
Instant endTime)
Constructs a new mutable activity with the given name, start time, and
end time.
|
Modifier and Type | Method and Description |
---|---|
void |
addDuration(Duration duration)
Convenience method to determine a new end time based on a duration that
will be added once to the current end time of the activity.
|
void |
addDuration(Duration duration,
long multipliedBy)
Convenience method to determine a new end time based on a duration that
will be added several times to the current end time of the activity.
|
Duration |
getDuration()
Convenience method to determine the duration between the start and the
end time of the activity.
|
void |
setDuration(Duration duration)
Convenience method to determine a new end time based on a duration that
will be added to the current start time of the activity.
|
void |
setEndTime(Instant time)
Sets a new end time on the activity.
|
void |
setId(String id)
Sets the ID field on the activity.
|
void |
setName(String name)
Sets the name of the activity.
|
void |
setStartTime(Instant time)
Sets a new start time on the activity.
|
void |
setUserObject(T userObject) |
getEndTime, getId, getName, getStartTime, getUserObject, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getEndTime, getId, getName, getStartTime
public MutableActivityBase()
Instant.now()
and the end time will be equal to
Instant.now()
plus the value of ActivityBase.DEFAULT_DURATION
.public MutableActivityBase(String name)
Instant.now()
and the end time will be equal
to Instant.now()
plus the value of ActivityBase.DEFAULT_DURATION
.name
- the name of the activitypublic MutableActivityBase(Instant startTime, Instant endTime)
startTime
- the start time of the activityendTime
- the end time of the activitypublic MutableActivityBase(String name, Instant startTime, Instant endTime)
name
- the name of the activitystartTime
- the start time of the activityendTime
- the end time of the activitypublic void setId(String id)
MutableActivity
UUID
. Only change it if your application uses its own ID
system.setId
in interface MutableActivity
id
- the new ID of the activitypublic void setName(String name)
MutableActivity
setName
in interface MutableActivity
name
- the new name of the activitypublic void setUserObject(T userObject)
public void setStartTime(Instant time)
MutableActivity
setStartTime
in interface MutableActivity
time
- the new start timepublic void setEndTime(Instant time)
MutableActivity
setEndTime
in interface MutableActivity
time
- the new end timepublic void setDuration(Duration duration)
duration
- the duration of the activitypublic Duration getDuration()
public void addDuration(Duration duration)
duration
- the duration of the activitypublic void addDuration(Duration duration, long multipliedBy)
duration
- the duration of the activitymultipliedBy
- the number of times that the duration will be addedCopyright © 2014 Dirk Lemmermann Software & Consulting. All rights reserved.