ProgressionListener
.progression :: Trackable :: defaultinit
progression :: Trackable :: fire_done
Notice the registeredProgessionListener
that the operation is done.
progression :: Trackable :: fire_progressed
Notice the registeredProgessionListener
that the operation progressed.
progression :: Trackable :: fire_started
Notice the registeredProgessionListener
that the operation started.
progression :: Trackable :: progression_listeners
Listen to the progression of the operation.progression :: Trackable :: progression_listeners=
Listen to the progression of the operation.progression $ Trackable :: SELF
Type of this instance, automatically specialized in every classcore :: Object :: class_factory
Implementation used byget_class
to create the specific class.
progression :: Trackable :: defaultinit
core :: Object :: defaultinit
progression :: Trackable :: fire_done
Notice the registeredProgessionListener
that the operation is done.
progression :: Trackable :: fire_progressed
Notice the registeredProgessionListener
that the operation progressed.
progression :: Trackable :: fire_started
Notice the registeredProgessionListener
that the operation started.
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: output_class_name
Display class name on stdout (debug only).progression :: Trackable :: progression_listeners
Listen to the progression of the operation.progression :: Trackable :: progression_listeners=
Listen to the progression of the operation.
# An operation that is trackable using a `ProgressionListener`.
abstract class Trackable
# Listen to the progression of the operation.
var progression_listeners: SimpleCollection[ProgressionListener] =
new Array[ProgressionListener]
# Notice the registered `ProgessionListener` that the operation started.
protected fun fire_started do
for l in progression_listeners do
l.started
l.progressed(0)
end
end
# Notice the registered `ProgessionListener` that the operation progressed.
#
# Parameter:
#
# * `done_part`: Indicates what is done.
# * `total`: Indicates what need to be done, `done_part` included.
protected fun fire_progressed(done_part: Int, total: Int) do
for l in progression_listeners do
l.progressed(done_part * l.progression_max / total)
end
end
# Notice the registered `ProgessionListener` that the operation is done.
protected fun fire_done do
for l in progression_listeners do
l.progressed(l.progression_max)
l.done
end
end
end
lib/progression/progression.nit:14,1--48,3