Class SimpleProgressionTracker
java.lang.Object
org.ametys.core.schedule.progression.AbstractProgressionTracker
org.ametys.core.schedule.progression.SimpleProgressionTracker
- All Implemented Interfaces:
ProgressionTracker
Simple implementation that tracks a progression with graduations
-
Field Summary
Fields inherited from class org.ametys.core.schedule.progression.AbstractProgressionTracker
_factory, _label, _parent
-
Method Summary
Modifier and TypeMethodDescriptiondouble
Get the progression percentage, that can be simplyProgressionTracker.getIndex()
/ProgressionTracker.getSize()
or a more complex algorithm when handling children progressionsprotected void
complete()
Complete the steplong
getIndex()
Get the index of the current steplong
getSize()
Get the sizevoid
Increment the progression of 1 incrementvoid
increment
(long increment) Increment the progression of 'increment' graduationsvoid
setSize
(long size) Set the sizewithLoggerGranularity
(int loggerGranularity) Add a granularity to the trackerMethods inherited from class org.ametys.core.schedule.progression.AbstractProgressionTracker
_getHierarchicalLabel, _getLogger, _getLogPrefix, getId, getLabel, getParent, toJSON
-
Method Details
-
withLoggerGranularity
Add a granularity to the tracker- Parameters:
loggerGranularity
- The granularity- Returns:
- The tracker
-
complete
Complete the step -
getIndex
Description copied from interface:ProgressionTracker
Get the index of the current step- Returns:
- The index between [1 and size]
-
getSize
Description copied from interface:ProgressionTracker
Get the size- Returns:
- The size
-
setSize
Set the size- Parameters:
size
- The size wanted
-
increment
Increment the progression of 1 increment -
increment
Increment the progression of 'increment' graduations- Parameters:
increment
- The number of increment to add
-
asPercentage
Description copied from interface:ProgressionTracker
Get the progression percentage, that can be simplyProgressionTracker.getIndex()
/ProgressionTracker.getSize()
or a more complex algorithm when handling children progressions- Returns:
- The progression (between 0 and 100)
-