Clover icon

jalviewX

  1. Project Clover database Wed Oct 31 2018 15:13:58 GMT
  2. Package jalview.schemabinding.version2

File FeatureMatcher.java

 

Coverage histogram

../../../img/srcFileCovDistChart4.png
45% of files have more coverage

Code metrics

10
41
23
1
383
157
31
0.76
1.78
23
1.35

Classes

Class Line # Actions
FeatureMatcher 22 41 31 46
0.378378437.8%
 

Contributing tests

This file is covered by 2 tests. .

Source view

1    /*
2    * This class was automatically generated with
3    * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
4    * Schema.
5    * $Id$
6    */
7   
8    package jalview.schemabinding.version2;
9   
10    //---------------------------------/
11    //- Imported classes and packages -/
12    //---------------------------------/
13   
14    import org.exolab.castor.xml.Marshaller;
15    import org.exolab.castor.xml.Unmarshaller;
16   
17    /**
18    * Class FeatureMatcher.
19    *
20    * @version $Revision$ $Date$
21    */
 
22    public class FeatureMatcher implements java.io.Serializable
23    {
24   
25    // --------------------------/
26    // - Class/Member Variables -/
27    // --------------------------/
28   
29    /**
30    * Field _by.
31    */
32    private jalview.schemabinding.version2.types.FeatureMatcherByType _by;
33   
34    /**
35    * name of feature attribute to filter on, or attribute and sub-attribute
36    */
37    private java.util.Vector _attributeNameList;
38   
39    /**
40    * Field _condition.
41    */
42    private java.lang.String _condition;
43   
44    /**
45    * Field _value.
46    */
47    private java.lang.String _value;
48   
49    // ----------------/
50    // - Constructors -/
51    // ----------------/
52   
 
53  20 toggle public FeatureMatcher()
54    {
55  20 super();
56  20 this._attributeNameList = new java.util.Vector();
57    }
58   
59    // -----------/
60    // - Methods -/
61    // -----------/
62   
63    /**
64    *
65    *
66    * @param vAttributeName
67    * @throws java.lang.IndexOutOfBoundsException
68    * if the index given is outside the bounds of the collection
69    */
 
70  6 toggle public void addAttributeName(final java.lang.String vAttributeName)
71    throws java.lang.IndexOutOfBoundsException
72    {
73    // check for the maximum size
74  6 if (this._attributeNameList.size() >= 2)
75    {
76  0 throw new IndexOutOfBoundsException(
77    "addAttributeName has a maximum of 2");
78    }
79   
80  6 this._attributeNameList.addElement(vAttributeName);
81    }
82   
83    /**
84    *
85    *
86    * @param index
87    * @param vAttributeName
88    * @throws java.lang.IndexOutOfBoundsException
89    * if the index given is outside the bounds of the collection
90    */
 
91  0 toggle public void addAttributeName(final int index,
92    final java.lang.String vAttributeName)
93    throws java.lang.IndexOutOfBoundsException
94    {
95    // check for the maximum size
96  0 if (this._attributeNameList.size() >= 2)
97    {
98  0 throw new IndexOutOfBoundsException(
99    "addAttributeName has a maximum of 2");
100    }
101   
102  0 this._attributeNameList.add(index, vAttributeName);
103    }
104   
105    /**
106    * Method enumerateAttributeName.
107    *
108    * @return an Enumeration over all java.lang.String elements
109    */
 
110  0 toggle public java.util.Enumeration enumerateAttributeName()
111    {
112  0 return this._attributeNameList.elements();
113    }
114   
115    /**
116    * Method getAttributeName.
117    *
118    * @param index
119    * @throws java.lang.IndexOutOfBoundsException
120    * if the index given is outside the bounds of the collection
121    * @return the value of the java.lang.String at the given index
122    */
 
123  0 toggle public java.lang.String getAttributeName(final int index)
124    throws java.lang.IndexOutOfBoundsException
125    {
126    // check bounds for index
127  0 if (index < 0 || index >= this._attributeNameList.size())
128    {
129  0 throw new IndexOutOfBoundsException("getAttributeName: Index value '"
130    + index + "' not in range [0.."
131    + (this._attributeNameList.size() - 1) + "]");
132    }
133   
134  0 return (java.lang.String) _attributeNameList.get(index);
135    }
136   
137    /**
138    * Method getAttributeName.Returns the contents of the collection in an Array.
139    * <p>
140    * Note: Just in case the collection contents are changing in another thread,
141    * we pass a 0-length Array of the correct type into the API call. This way we
142    * <i>know</i> that the Array returned is of exactly the correct length.
143    *
144    * @return this collection as an Array
145    */
 
146  29 toggle public java.lang.String[] getAttributeName()
147    {
148  29 java.lang.String[] array = new java.lang.String[0];
149  29 return (java.lang.String[]) this._attributeNameList.toArray(array);
150    }
151   
152    /**
153    * Method getAttributeNameCount.
154    *
155    * @return the size of this collection
156    */
 
157  0 toggle public int getAttributeNameCount()
158    {
159  0 return this._attributeNameList.size();
160    }
161   
162    /**
163    * Returns the value of field 'by'.
164    *
165    * @return the value of field 'By'.
166    */
 
167  35 toggle public jalview.schemabinding.version2.types.FeatureMatcherByType getBy()
168    {
169  35 return this._by;
170    }
171   
172    /**
173    * Returns the value of field 'condition'.
174    *
175    * @return the value of field 'Condition'.
176    */
 
177  35 toggle public java.lang.String getCondition()
178    {
179  35 return this._condition;
180    }
181   
182    /**
183    * Returns the value of field 'value'.
184    *
185    * @return the value of field 'Value'.
186    */
 
187  35 toggle public java.lang.String getValue()
188    {
189  35 return this._value;
190    }
191   
192    /**
193    * Method isValid.
194    *
195    * @return true if this object is valid according to the schema
196    */
 
197  0 toggle public boolean isValid()
198    {
199  0 try
200    {
201  0 validate();
202    } catch (org.exolab.castor.xml.ValidationException vex)
203    {
204  0 return false;
205    }
206  0 return true;
207    }
208   
209    /**
210    *
211    *
212    * @param out
213    * @throws org.exolab.castor.xml.MarshalException
214    * if object is null or if any SAXException is thrown during
215    * marshaling
216    * @throws org.exolab.castor.xml.ValidationException
217    * if this object is an invalid instance according to the schema
218    */
 
219  0 toggle public void marshal(final java.io.Writer out)
220    throws org.exolab.castor.xml.MarshalException,
221    org.exolab.castor.xml.ValidationException
222    {
223  0 Marshaller.marshal(this, out);
224    }
225   
226    /**
227    *
228    *
229    * @param handler
230    * @throws java.io.IOException
231    * if an IOException occurs during marshaling
232    * @throws org.exolab.castor.xml.ValidationException
233    * if this object is an invalid instance according to the schema
234    * @throws org.exolab.castor.xml.MarshalException
235    * if object is null or if any SAXException is thrown during
236    * marshaling
237    */
 
238  0 toggle public void marshal(final org.xml.sax.ContentHandler handler)
239    throws java.io.IOException,
240    org.exolab.castor.xml.MarshalException,
241    org.exolab.castor.xml.ValidationException
242    {
243  0 Marshaller.marshal(this, handler);
244    }
245   
246    /**
247    */
 
248  0 toggle public void removeAllAttributeName()
249    {
250  0 this._attributeNameList.clear();
251    }
252   
253    /**
254    * Method removeAttributeName.
255    *
256    * @param vAttributeName
257    * @return true if the object was removed from the collection.
258    */
 
259  0 toggle public boolean removeAttributeName(final java.lang.String vAttributeName)
260    {
261  0 boolean removed = _attributeNameList.remove(vAttributeName);
262  0 return removed;
263    }
264   
265    /**
266    * Method removeAttributeNameAt.
267    *
268    * @param index
269    * @return the element removed from the collection
270    */
 
271  0 toggle public java.lang.String removeAttributeNameAt(final int index)
272    {
273  0 java.lang.Object obj = this._attributeNameList.remove(index);
274  0 return (java.lang.String) obj;
275    }
276   
277    /**
278    *
279    *
280    * @param index
281    * @param vAttributeName
282    * @throws java.lang.IndexOutOfBoundsException
283    * if the index given is outside the bounds of the collection
284    */
 
285  0 toggle public void setAttributeName(final int index,
286    final java.lang.String vAttributeName)
287    throws java.lang.IndexOutOfBoundsException
288    {
289    // check bounds for index
290  0 if (index < 0 || index >= this._attributeNameList.size())
291    {
292  0 throw new IndexOutOfBoundsException("setAttributeName: Index value '"
293    + index + "' not in range [0.."
294    + (this._attributeNameList.size() - 1) + "]");
295    }
296   
297  0 this._attributeNameList.set(index, vAttributeName);
298    }
299   
300    /**
301    *
302    *
303    * @param vAttributeNameArray
304    */
 
305  4 toggle public void setAttributeName(final java.lang.String[] vAttributeNameArray)
306    {
307    // -- copy array
308  4 _attributeNameList.clear();
309   
310  10 for (int i = 0; i < vAttributeNameArray.length; i++)
311    {
312  6 this._attributeNameList.add(vAttributeNameArray[i]);
313    }
314    }
315   
316    /**
317    * Sets the value of field 'by'.
318    *
319    * @param by
320    * the value of field 'by'.
321    */
 
322  20 toggle public void setBy(
323    final jalview.schemabinding.version2.types.FeatureMatcherByType by)
324    {
325  20 this._by = by;
326    }
327   
328    /**
329    * Sets the value of field 'condition'.
330    *
331    * @param condition
332    * the value of field 'condition'.
333    */
 
334  20 toggle public void setCondition(final java.lang.String condition)
335    {
336  20 this._condition = condition;
337    }
338   
339    /**
340    * Sets the value of field 'value'.
341    *
342    * @param value
343    * the value of field 'value'.
344    */
 
345  20 toggle public void setValue(final java.lang.String value)
346    {
347  20 this._value = value;
348    }
349   
350    /**
351    * Method unmarshal.
352    *
353    * @param reader
354    * @throws org.exolab.castor.xml.MarshalException
355    * if object is null or if any SAXException is thrown during
356    * marshaling
357    * @throws org.exolab.castor.xml.ValidationException
358    * if this object is an invalid instance according to the schema
359    * @return the unmarshaled jalview.schemabinding.version2.FeatureMatcher
360    */
 
361  0 toggle public static jalview.schemabinding.version2.FeatureMatcher unmarshal(
362    final java.io.Reader reader)
363    throws org.exolab.castor.xml.MarshalException,
364    org.exolab.castor.xml.ValidationException
365    {
366  0 return (jalview.schemabinding.version2.FeatureMatcher) Unmarshaller
367    .unmarshal(jalview.schemabinding.version2.FeatureMatcher.class,
368    reader);
369    }
370   
371    /**
372    *
373    *
374    * @throws org.exolab.castor.xml.ValidationException
375    * if this object is an invalid instance according to the schema
376    */
 
377  0 toggle public void validate() throws org.exolab.castor.xml.ValidationException
378    {
379  0 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
380  0 validator.validate(this);
381    }
382   
383    }