36a86e34ae8ffae519e584b5c3b805d2668c2383
[jalview.git] / src / jalview / ws2 / operations / AbstractOperation.java
1 package jalview.ws2.operations;
2
3 import jalview.ws.params.ParamDatastoreI;
4 import jalview.ws2.WebServiceI;
5
6 /**
7  * Common base for all operation classes which provides boilerplate
8  * implementation for common {@link Operation} methods.
9  * 
10  * @author mmwarowny
11  *
12  */
13 public abstract class AbstractOperation implements Operation
14 {
15
16   protected final WebServiceI service;
17
18   protected final String typeName;
19
20   protected boolean interactive = false;
21
22   protected boolean protOperation = true;
23
24   protected boolean nucOperation = true;
25
26   protected boolean alignmentAnalysis = false;
27
28   AbstractOperation(WebServiceI service, String typeName)
29   {
30     this.service = service;
31     this.typeName = typeName;
32   }
33
34   @Override
35   public String getName()
36   {
37     return service.getName();
38   }
39
40   @Override
41   public String getDescription()
42   {
43     return service.getDescription();
44   }
45
46   @Override
47   public String getTypeName()
48   {
49     return typeName;
50   }
51
52   @Override
53   public String getHostName()
54   {
55     return service.getHostName();
56   }
57
58   @Override
59   public boolean hasParameters()
60   {
61     return service.hasParameters();
62   }
63
64   @Override
65   public ParamDatastoreI getParamStore()
66   {
67     return service.getParamStore();
68   }
69
70   @Override
71   public int getMinSequences()
72   {
73     return 1;
74   }
75
76   @Override
77   public int getMaxSequences()
78   {
79     return Integer.MAX_VALUE;
80   }
81
82   @Override
83   public boolean canSubmitGaps()
84   {
85     return false;
86   }
87
88   @Override
89   public boolean isProteinOperation()
90   {
91     return protOperation;
92   }
93
94   public void setProteinOperation(boolean value)
95   {
96     protOperation = value;
97   }
98
99   @Override
100   public boolean isNucleotideOperation()
101   {
102     return nucOperation;
103   }
104
105   public void setNucleotideOperation(boolean value)
106   {
107     nucOperation = value;
108   }
109
110   @Override
111   public boolean isInteractive()
112   {
113     return interactive;
114   }
115
116   public void setInteractive(boolean value)
117   {
118     interactive = value;
119   }
120
121   @Override
122   public boolean isAlignmentAnalysis()
123   {
124     return alignmentAnalysis;
125   }
126
127   public void setAlignmentAnalysis(boolean value)
128   {
129     alignmentAnalysis = value;
130   }
131
132   @Override
133   public boolean getFilterNonStandardSymbols()
134   {
135     return false;
136   }
137
138   @Override
139   public boolean getNeedsAlignedSequences()
140   {
141     return false;
142   }
143
144 }