Module com.flexganttfx.model
Package com.flexganttfx.model.activity
Class MutableCompletableActivityBase<T>
java.lang.Object
com.flexganttfx.model.activity.ActivityBase<T>
com.flexganttfx.model.activity.CompletableActivityBase<T>
com.flexganttfx.model.activity.MutableCompletableActivityBase<T>
- Type Parameters:
T- the type of the optional user object
- All Implemented Interfaces:
Activity,CompletableActivity,MutableActivity,MutableCompletableActivity
public class MutableCompletableActivityBase<T> extends CompletableActivityBase<T> implements MutableCompletableActivity
The base implementation of a mutable and completable activity.
- Since:
- 1.0
-
Field Summary
Fields inherited from class com.flexganttfx.model.activity.CompletableActivityBase
percentageCompleteFields inherited from class com.flexganttfx.model.activity.ActivityBase
DEFAULT_DURATION, endTime, id, name, startTime, userObject -
Constructor Summary
Constructors Constructor Description MutableCompletableActivityBase()Constructs a new mutable activity.MutableCompletableActivityBase(String name)Constructs a new mutable activity with the given name.MutableCompletableActivityBase(String name, Instant startTime, Instant endTime)Constructs a new mutable activity with the given name, start time, and end time.MutableCompletableActivityBase(Instant startTime, Instant endTime)Constructs a new mutable activity with the start time and end time. -
Method Summary
Modifier and Type Method Description voidaddDuration(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.voidaddDuration(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.DurationgetDuration()Convenience method to determine the duration between the start and the end time of the activity.voidsetDuration(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.voidsetEndTime(Instant time)Sets a new end time on the activity.voidsetName(String name)Sets the name of the activity.voidsetPercentageComplete(double complete)Returns the percentage complete value of the activity.voidsetStartTime(Instant time)Sets a new start time on the activity.voidsetUserObject(T userObject)Methods inherited from class com.flexganttfx.model.activity.CompletableActivityBase
getPercentageComplete, toStringMethods inherited from class com.flexganttfx.model.activity.ActivityBase
getEndTime, getId, getName, getStartTime, getUserObjectMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.flexganttfx.model.Activity
getEndTime, getId, getName, getStartTimeMethods inherited from interface com.flexganttfx.model.activity.CompletableActivity
getPercentageComplete
-
Constructor Details
-
MutableCompletableActivityBase
public MutableCompletableActivityBase()Constructs a new mutable activity. The initial start time will be set toInstant.now()and the end time will be equal toInstant.now()plus the value ofActivityBase.DEFAULT_DURATION.- Since:
- 1.0
-
MutableCompletableActivityBase
Constructs a new mutable activity with the given name. The initial start time will be set toInstant.now()and the end time will be equal toInstant.now()plus the value ofActivityBase.DEFAULT_DURATION.- Parameters:
name- the name of the activity- Since:
- 1.0
-
MutableCompletableActivityBase
Constructs a new mutable activity with the start time and end time.- Parameters:
startTime- the start time of the activityendTime- the end time of the activity- Since:
- 1.0
-
MutableCompletableActivityBase
Constructs a new mutable activity with the given name, start time, and end time.- Parameters:
name- the name of the activitystartTime- the start time of the activityendTime- the end time of the activity- Since:
- 1.0
-
-
Method Details
-
setName
Description copied from interface:MutableActivitySets the name of the activity.- Specified by:
setNamein interfaceMutableActivity- Parameters:
name- the new name of the activity
-
setUserObject
- Overrides:
setUserObjectin classActivityBase<T>
-
setStartTime
Description copied from interface:MutableActivitySets a new start time on the activity.- Specified by:
setStartTimein interfaceMutableActivity- Parameters:
time- the new start time
-
setEndTime
Description copied from interface:MutableActivitySets a new end time on the activity.- Specified by:
setEndTimein interfaceMutableActivity- Parameters:
time- the new end time
-
setDuration
Convenience method to determine a new end time based on a duration that will be added to the current start time of the activity.- Parameters:
duration- the duration of the activity- Since:
- 1.0
-
getDuration
Convenience method to determine the duration between the start and the end time of the activity.- Returns:
- the duration of the activity
-
addDuration
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.- Parameters:
duration- the duration of the activity- Since:
- 1.0
-
addDuration
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.- Parameters:
duration- the duration of the activitymultipliedBy- the number of times that the duration will be added- Since:
- 1.0
-
setPercentageComplete
public void setPercentageComplete(double complete)Description copied from interface:MutableCompletableActivityReturns the percentage complete value of the activity.- Specified by:
setPercentageCompletein interfaceMutableCompletableActivity- Parameters:
complete- the new percentage complete value (must be between 0 and 100).
-