package jalview.ws2.helpers; import jalview.gui.WebserviceInfo; import jalview.ws.WSClientI; import jalview.ws2.actions.api.TaskI; /** * A simple wrapper around the {@link TaskI} implementing {@link WSClientI}. Its * main purpose is to delegate the call to {@link #cancelJob} to the underlying * task. * * @author mmwarowny */ public class WSClientTaskWrapper implements WSClientI { private TaskI delegate; private boolean cancellable; private boolean canMerge; public WSClientTaskWrapper(TaskI task, boolean cancellable, boolean canMerge) { this.delegate = task; this.cancellable = cancellable; this.canMerge = canMerge; } public WSClientTaskWrapper(TaskI task) { this(task, true, false); } @Override public boolean isCancellable() { return cancellable; } @Override public boolean canMergeResults() { return canMerge; } @Override public void cancelJob() { delegate.cancel(); } }