Task class
Metadata bag for command objects. It's a JSO so that a lightweight JsArray can be used instead of a Collections type.
class Task {
Object _command;
bool _repeating = false;
factory Task.fromRepeatingCommand(RepeatingCommand cmd) {
return new Task._internal(cmd, true);
}
factory Task.fromScheduledCommand(ScheduledCommand cmd) {
return new Task._internal(cmd, false);
}
Task._internal(this._command, this._repeating);
bool executeRepeating() {
return getRepeating().execute();
}
void executeScheduled() {
getScheduled().execute();
}
/**
* Has implicit cast.
*/
RepeatingCommand getRepeating() {
return _command as RepeatingCommand;
}
/**
* Has implicit cast.
*/
ScheduledCommand getScheduled() {
return _command as ScheduledCommand;
}
bool isRepeating() {
return _repeating;
}
}
Constructors
factory Task.fromRepeatingCommand(RepeatingCommand cmd) #
factory Task.fromRepeatingCommand(RepeatingCommand cmd) {
return new Task._internal(cmd, true);
}
factory Task.fromScheduledCommand(ScheduledCommand cmd) #
factory Task.fromScheduledCommand(ScheduledCommand cmd) {
return new Task._internal(cmd, false);
}
Methods
bool executeRepeating() #
bool executeRepeating() {
return getRepeating().execute();
}
void executeScheduled() #
void executeScheduled() {
getScheduled().execute();
}
RepeatingCommand getRepeating() #
Has implicit cast.
RepeatingCommand getRepeating() {
return _command as RepeatingCommand;
}
ScheduledCommand getScheduled() #
Has implicit cast.
ScheduledCommand getScheduled() {
return _command as ScheduledCommand;
}
bool isRepeating() #
bool isRepeating() {
return _repeating;
}