Clover icon

jalviewX

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

File CompoundMatcher.java

 

Coverage histogram

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

Code metrics

10
41
22
1
368
154
30
0.73
1.86
22
1.36

Classes

Class Line # Actions
CompoundMatcher 22 41 30 73
0.00%
 

Contributing tests

No tests hitting this source file were found.

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