Clover icon

jalviewX

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

File CompoundMatcher.java

 

Coverage histogram

../../../img/srcFileCovDistChart3.png
47% of files have more coverage

Code metrics

10
41
22
1
374
158
30
0.73
1.86
22
1.36

Classes

Class Line # Actions
CompoundMatcher 22 41 30 56
0.2328767223.3%
 

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