Clover icon

jalviewX

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

File JabaOption.java

 

Coverage histogram

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

Code metrics

0
15
10
1
120
77
13
0.87
1.5
10
1.3

Classes

Class Line # Actions
JabaOption 33 15 13 25
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.ParameterUtils;
25    import jalview.ws.params.OptionI;
26   
27    import java.net.MalformedURLException;
28    import java.net.URL;
29    import java.util.List;
30   
31    import compbio.metadata.Option;
32   
 
33    public class JabaOption implements jalview.ws.params.OptionI
34    {
 
35  0 toggle public JabaOption(Option rg)
36    {
37  0 opt = rg;
38    }
39   
40    Option opt;
41   
 
42  0 toggle @Override
43    public String getValue()
44    {
45  0 return opt.getDefaultValue();
46    }
47   
 
48  0 toggle @Override
49    public String getName()
50    {
51  0 return opt.getName();
52    }
53   
 
54  0 toggle @Override
55    public URL getFurtherDetails()
56    {
57  0 try
58    {
59  0 return new URL(opt.getBasicURL().toExternalForm() + "/"
60    + opt.getFurtherDetails());
61    } catch (NullPointerException q)
62    {
63    } catch (MalformedURLException q)
64    {
65   
66    }
67  0 return null;
68    }
69   
 
70  0 toggle @Override
71    public boolean isRequired()
72    {
73  0 return opt.isRequired();
74    }
75   
 
76  0 toggle @Override
77    public String getDescription()
78    {
79  0 return opt.getDescription();
80    }
81   
 
82  0 toggle @Override
83    public List<String> getPossibleValues()
84    {
85    // TODO: assert typesafety
86  0 return opt.getPossibleValues();
87    }
88   
 
89  0 toggle @Override
90    public void setValue(String selectedItem)
91    {
92  0 try
93    {
94  0 opt.setDefaultValue(selectedItem);
95    } catch (Exception e)
96    {
97  0 e.printStackTrace();
98  0 throw new Error(MessageManager.getString(
99    "error.implementation_error_cannot_set_jaba_option"));
100    }
101    }
102   
 
103  0 toggle @Override
104    public OptionI copy()
105    {
106  0 return new JabaOption(ParameterUtils.copyOption(opt));
107    }
108   
109    /**
110    * get the underlying Jaba option or parameter object. Note - use copy first
111    * if you want to modify the value of the option.
112    *
113    * @return
114    */
 
115  0 toggle public Option getOption()
116    {
117  0 return opt;
118    }
119   
120    }