Warning: session_start(): open(/var/lib/php/sessions/sess_65krs7o9h3hil2bdvpgaelf1to, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
// "Probabilistic" - a probabilistic runnable
// subclass must implement run {} to do first action and schedule
// next steps with at() or atRelative()
// Creates its own scheduler if none is set
// Steppable is implemented only as convenience
// (it steps the whole scheduler)
// TODO: This is not very clear
asclass Probabilistic implements IProbabilistic, Steppable {
IProbabilisticScheduler ps;
void initScheduler {
if (ps == null) ps = new ProbabilisticScheduler;
}
public void setScheduler(IProbabilisticScheduler ps) {
this.ps = ps;
}
IProbabilisticScheduler scheduler() {
initScheduler();
ret ps;
}
// Breaking change: Made this relative
void schedule aka at(Runnable action) {
scheduleRelative(1.0, action);
}
void schedule aka at(double probability, Runnable action) {
initScheduler();
ps.at(probability, action);
}
void scheduleRelative aka atRelative(double probability, Runnable action) {
initScheduler();
ps.atRelative(probability, action);
}
void scheduleAll(Iterable extends Runnable> actions) {
forEach schedule(actions);
}
void scheduleAll(double probability, Iterable extends Runnable> actions) {
forEach(actions, a -> schedule(probability, a));
}
void scheduleAllRelative(double probability, Iterable extends Runnable> actions) {
forEach(actions, a -> scheduleRelative(probability, a));
}
// call run() before
void stepAll() {
main stepAll(ps);
}
// call run() before
public bool step() {
ret ps.step();
}
}