1 package jalview.ws2.actions.annotation;
4 import java.util.Objects;
6 import jalview.viewmodel.AlignmentViewport;
7 import jalview.ws.params.ArgumentI;
8 import jalview.ws2.actions.BaseAction;
9 import jalview.ws2.actions.api.TaskEventListener;
10 import jalview.ws2.actions.api.TaskI;
11 import jalview.ws2.api.Credentials;
12 import jalview.ws2.client.api.AnnotationWebServiceClientI;
14 public class AnnotationAction extends BaseAction<AnnotationResult>
17 * A builder of {@link AnnotationAction} instances.
19 public static class Builder extends BaseAction.Builder<AnnotationAction>
21 protected AnnotationWebServiceClientI client;
23 protected boolean alignmentAnalysis = false;
25 protected boolean requireAlignedSequences = false;
27 protected boolean filterSymbols = true;
29 public Builder(AnnotationWebServiceClientI client)
32 Objects.requireNonNull(client);
37 * Set if action is an alignment analysis action.
39 public void alignmentAnalysis(boolean val)
41 alignmentAnalysis = val;
45 * Set if action require aligned sequences.
47 public void requireAlignedSequences(boolean val)
49 requireAlignedSequences = val;
53 * Set if action requires non-standard residues to be filtered out
55 public void filterSymbols(boolean val)
60 public AnnotationAction build()
62 return new AnnotationAction(this);
66 public static Builder newBuilder(AnnotationWebServiceClientI client)
68 return new Builder(client);
71 protected final AnnotationWebServiceClientI client;
73 protected final boolean alignmentAnalysis;
75 protected final boolean requireAlignedSequences;
77 protected final boolean filterSymbols;
79 protected AnnotationAction(Builder builder)
82 client = builder.client;
83 alignmentAnalysis = builder.alignmentAnalysis;
84 requireAlignedSequences = builder.requireAlignedSequences;
85 filterSymbols = builder.filterSymbols;
89 public TaskI<AnnotationResult> perform(AlignmentViewport viewport,
90 List<ArgumentI> args, Credentials credentials,
91 TaskEventListener<AnnotationResult> handler)
93 var task = new AnnotationTask(client, this, args, credentials, viewport,
95 task.start(viewport.getCalcManager());
100 * Return if this action is an alignment analysis service.
102 public boolean isAlignmentAnalysis()
104 return alignmentAnalysis;
108 * Return if this action require sequences to be aligned.
110 public boolean getRequireAlignedSequences()
112 return requireAlignedSequences;
116 * Return if this action require non-standard symbols to be filtered out.
118 public boolean getFilterSymbols()
120 return filterSymbols;
124 public boolean isActive(AlignmentViewport viewport)