Clover icon

jalviewX

  1. Project Clover database Wed Oct 31 2018 15:13:58 GMT
  2. Package jalview.ws.jws2.dm

File JabaWsParamSet.java

 

Coverage histogram

../../../../img/srcFileCovDistChart0.png
56% of files have more coverage

Code metrics

10
36
17
1
201
134
23
0.64
2.12
17
1.35

Classes

Class Line # Actions
JabaWsParamSet 33 36 23 63
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ The Jalview Authors
4    *
5    * This file is part of Jalview.
6    *
7    * Jalview is free software: you can redistribute it and/or
8    * modify it under the terms of the GNU General Public License
9    * as published by the Free Software Foundation, either version 3
10    * of the License, or (at your option) any later version.
11    *
12    * Jalview is distributed in the hope that it will be useful, but
13    * WITHOUT ANY WARRANTY; without even the implied warranty
14    * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15    * PURPOSE. See the GNU General Public License for more details.
16    *
17    * You should have received a copy of the GNU General Public License
18    * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19    * The Jalview Authors are detailed in the 'AUTHORS' file.
20    */
21    package jalview.ws.jws2.dm;
22   
23    import jalview.util.MessageManager;
24    import jalview.ws.jws2.JabaParamStore;
25    import jalview.ws.params.ArgumentI;
26    import jalview.ws.params.WsParamSetI;
27   
28    import java.util.ArrayList;
29    import java.util.List;
30   
31    import compbio.metadata.Option;
32   
 
33    public class JabaWsParamSet implements WsParamSetI
34    {
35    /**
36    * raw jaba arguments.
37    */
38    List<Option> jabaArguments;
39   
40    String name, description, applicableUrls[], sourceFile;
41   
 
42  0 toggle public JabaWsParamSet(String storeSetName, String descr, List jobParams)
43    {
44  0 if (jobParams.size() > 0)
45    {
46  0 if (jobParams.get(0) instanceof Option)
47    {
48  0 jabaArguments = new ArrayList<Option>();
49    // if classCastExceptions are raised then there has been an
50    // implementation error.
51  0 jabaArguments.addAll((List<Option>) jobParams);
52    }
53    else
54    {
55  0 if (!allJaba(jobParams))
56    {
57  0 throw new Error(MessageManager
58    .getString("error.cannot_create_jabaws_param_set"));
59    }
60    else
61    {
62  0 jabaArguments = JabaParamStore.getJabafromJwsArgs(jobParams);
63    }
64    }
65    }
66  0 name = storeSetName;
67  0 description = descr;
68  0 sourceFile = null;
69  0 applicableUrls = null;
70    }
71   
 
72  0 toggle public JabaWsParamSet()
73    {
74   
75    }
76   
 
77  0 toggle private boolean allJaba(List jobParams)
78    {
79   
80  0 boolean allJaba = true;
81  0 for (Object jp : jobParams)
82    {
83  0 if (jp instanceof JabaParameter || jp instanceof JabaOption)
84    {
85  0 allJaba &= true;
86    }
87    else
88    {
89  0 allJaba = false;
90  0 break;
91    }
92    }
93  0 return allJaba;
94    }
95   
 
96  0 toggle @Override
97    public String getName()
98    {
99  0 return name;
100    }
101   
 
102  0 toggle @Override
103    public String getDescription()
104    {
105  0 return description;
106    }
107   
108    /**
109    * @param name
110    * the name to set
111    */
 
112  0 toggle public void setName(String name)
113    {
114  0 this.name = name;
115    }
116   
117    /**
118    * @param description
119    * the description to set
120    */
 
121  0 toggle public void setDescription(String description)
122    {
123  0 this.description = description;
124    }
125   
126    /**
127    * @param applicableUrls
128    * the applicableUrls to set
129    */
 
130  0 toggle public void setApplicableUrls(String[] applicableUrls)
131    {
132  0 this.applicableUrls = applicableUrls;
133    }
134   
135    /**
136    * @param modifiable
137    * the modifiable to set
138    */
 
139  0 toggle public void setModifiable(boolean modifiable)
140    {
141  0 this.modifiable = modifiable;
142    }
143   
 
144  0 toggle @Override
145    public String[] getApplicableUrls()
146    {
147  0 return applicableUrls;
148    }
149   
 
150  0 toggle @Override
151    public String getSourceFile()
152    {
153  0 return sourceFile;
154    }
155   
 
156  0 toggle @Override
157    public void setSourceFile(String newfile)
158    {
159  0 sourceFile = newfile;
160    }
161   
162    boolean modifiable = true;
163   
 
164  0 toggle @Override
165    public boolean isModifiable()
166    {
167  0 return modifiable;
168    }
169   
 
170  0 toggle @Override
171    public List<ArgumentI> getArguments()
172    {
173  0 return JabaParamStore.getJwsArgsfromJaba(jabaArguments);
174    }
175   
 
176  0 toggle @Override
177    public void setArguments(List<ArgumentI> args)
178    {
179  0 if (!allJaba(args))
180    {
181  0 throw new Error(MessageManager
182    .getString("error.cannot_set_arguments_to_jabaws_param_set"));
183    }
184  0 jabaArguments = new ArrayList<Option>();
185  0 for (ArgumentI rg : args)
186    {
187  0 jabaArguments.add(((JabaOption) rg).opt);
188    }
189    }
190   
 
191  0 toggle public List<Option> getjabaArguments()
192    {
193  0 return jabaArguments;
194    }
195   
 
196  0 toggle public void setjabaArguments(List<Option> args)
197    {
198  0 jabaArguments = args;
199    }
200   
201    }