Module com.flexganttfx.model
Package com.flexganttfx.model.activity
Class MutableHighLowChartActivityBase<T>
java.lang.Object
com.flexganttfx.model.activity.ActivityBase<T>
com.flexganttfx.model.activity.HighLowChartActivityBase<T>
com.flexganttfx.model.activity.MutableHighLowChartActivityBase<T>
- Type Parameters:
T
- the type of the optional user object
- All Implemented Interfaces:
Activity
,HighLowChartActivity
,MutableActivity
,MutableHighLowChartActivity
public class MutableHighLowChartActivityBase<T> extends HighLowChartActivityBase<T> implements MutableHighLowChartActivity
The base implementation of a mutable high / low activity.
- Since:
- 1.0
-
Field Summary
Fields inherited from class com.flexganttfx.model.activity.HighLowChartActivityBase
high, low
Fields inherited from class com.flexganttfx.model.activity.ActivityBase
DEFAULT_DURATION, endTime, id, name, startTime, userObject
-
Constructor Summary
Constructors Constructor Description MutableHighLowChartActivityBase()
Constructs a new high-low activity.MutableHighLowChartActivityBase(double low, double high, Instant time)
Constructs a new high-low activity with the given initial high and low values and the start and end time set to the given time.MutableHighLowChartActivityBase(double low, double high, Instant startTime, Instant endTime)
Constructs a new high-low activity with the given initial high and low values and the given start and end time. -
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
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
setHigh(double high)
Sets the high value of the activity.void
setLow(double low)
Sets the low value of 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.HighLowChartActivityBase
getHigh, getLow
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.HighLowChartActivity
getHigh, getLow
-
Constructor Details
-
MutableHighLowChartActivityBase
public MutableHighLowChartActivityBase()Constructs a new high-low activity. The initial high and low values will both be equal to zero. The start time will be equal toInstant.now()
and the end time will be equal toInstant.now()
plusActivityBase.DEFAULT_DURATION
.- Since:
- 1.0
-
MutableHighLowChartActivityBase
public MutableHighLowChartActivityBase(double low, double high, Instant startTime, Instant endTime)Constructs a new high-low activity with the given initial high and low values and the given start and end time.- Parameters:
low
- the low value of the activityhigh
- the high value of the activitystartTime
- the start time of the activityendTime
- the end time of the activity- Throws:
IllegalArgumentException
- if low is larger than high- Since:
- 1.0
-
MutableHighLowChartActivityBase
Constructs a new high-low activity with the given initial high and low values and the start and end time set to the given time.- Parameters:
low
- the low value of the activityhigh
- the high value of the activitytime
- the start and end time of the activity- Throws:
IllegalArgumentException
- if low is larger than high- Since:
- 1.0
-
-
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
-
setHigh
public void setHigh(double high)Description copied from interface:MutableHighLowChartActivity
Sets the high value of the activity.- Specified by:
setHigh
in interfaceMutableHighLowChartActivity
- Parameters:
high
- the new high value
-
setLow
public void setLow(double low)Description copied from interface:MutableHighLowChartActivity
Sets the low value of the activity.- Specified by:
setLow
in interfaceMutableHighLowChartActivity
- Parameters:
low
- the new low value
-
toString
- Overrides:
toString
in classHighLowChartActivityBase<T>
-