Module com.flexganttfx.model
Package com.flexganttfx.model.activity
Class MutableChartActivityBase<T>
java.lang.Object
com.flexganttfx.model.activity.ActivityBase<T>
com.flexganttfx.model.activity.ChartActivityBase<T>
com.flexganttfx.model.activity.MutableChartActivityBase<T>
- Type Parameters:
T
- the type of the optional user object
- All Implemented Interfaces:
Activity
,ChartActivity
,MutableActivity
,MutableChartActivity
public class MutableChartActivityBase<T> extends ChartActivityBase<T> implements MutableChartActivity
The base implementation of a mutable chart activity.
- Since:
- 1.0
-
Field Summary
Fields inherited from class com.flexganttfx.model.activity.ChartActivityBase
chartValue
Fields inherited from class com.flexganttfx.model.activity.ActivityBase
DEFAULT_DURATION, endTime, id, name, startTime, userObject
-
Constructor Summary
Constructors Constructor Description MutableChartActivityBase()
Constructs a new mutable chart activity.MutableChartActivityBase(double value)
Constructs a new mutable chart activity with the given value.MutableChartActivityBase(double value, Instant time)
Constructs a new mutable chart activity with the given value.MutableChartActivityBase(double value, Instant startTime, Instant endTime)
Constructs a new mutable chart activity with the given value. -
Method Summary
Modifier and Type Method 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
setChartValue(double value)
Sets a new chart value.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
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)
String
toString()
Methods inherited from class com.flexganttfx.model.activity.ChartActivityBase
getChartValue
Methods inherited from class com.flexganttfx.model.activity.ActivityBase
getEndTime, getId, getName, getStartTime, getUserObject
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.flexganttfx.model.Activity
getEndTime, getId, getName, getStartTime
Methods inherited from interface com.flexganttfx.model.activity.ChartActivity
getChartValue
-
Constructor Details
-
MutableChartActivityBase
public MutableChartActivityBase()Constructs a new mutable chart 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
. The chart value will be equal to zero.- Since:
- 1.0
-
MutableChartActivityBase
public MutableChartActivityBase(double value)Constructs a new mutable chart activity with the given value. 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:
value
- the chart value of the activity- Since:
- 1.0
-
MutableChartActivityBase
Constructs a new mutable chart activity with the given value. The start and end time will be equal to the given time.- Parameters:
value
- the chart value of the activitytime
- the start and end time of the activity- Since:
- 1.0
-
MutableChartActivityBase
Constructs a new mutable chart activity with the given value.- Parameters:
value
- the chart value of the activitystartTime
- the start and end time of the activityendTime
- the start and end time of the activity- Since:
- 1.5
-
-
Method Details
-
setName
Description copied from interface:MutableActivity
Sets the name of the activity.- Specified by:
setName
in interfaceMutableActivity
- Parameters:
name
- the new name of the activity
-
setUserObject
- Overrides:
setUserObject
in classActivityBase<T>
-
setStartTime
Description copied from interface:MutableActivity
Sets a new start time on the activity.- Specified by:
setStartTime
in interfaceMutableActivity
- Parameters:
time
- the new start time
-
setEndTime
Description copied from interface:MutableActivity
Sets a new end time on the activity.- Specified by:
setEndTime
in 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
-
setChartValue
public void setChartValue(double value)Description copied from interface:MutableChartActivity
Sets a new chart value.- Specified by:
setChartValue
in interfaceMutableChartActivity
- Parameters:
value
- the new value
-
toString
- Overrides:
toString
in classChartActivityBase<T>
-