JAL-2843 save/restore colour feature by attribute, and feature filters, to Jalview...
[jalview.git] / src / jalview / schemabinding / version2 / Setting.java
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 Setting.
19  * 
20  * @version $Revision$ $Date$
21  */
22 public class Setting implements java.io.Serializable
23 {
24
25   // --------------------------/
26   // - Class/Member Variables -/
27   // --------------------------/
28
29   /**
30    * Field _type.
31    */
32   private java.lang.String _type;
33
34   /**
35    * Field _colour.
36    */
37   private int _colour;
38
39   /**
40    * keeps track of state for field: _colour
41    */
42   private boolean _has_colour;
43
44   /**
45    * Field _display.
46    */
47   private boolean _display;
48
49   /**
50    * keeps track of state for field: _display
51    */
52   private boolean _has_display;
53
54   /**
55    * Field _order.
56    */
57   private float _order;
58
59   /**
60    * keeps track of state for field: _order
61    */
62   private boolean _has_order;
63
64   /**
65    * Optional minimum colour for graduated feature colour
66    * 
67    */
68   private int _mincolour;
69
70   /**
71    * keeps track of state for field: _mincolour
72    */
73   private boolean _has_mincolour;
74
75   /**
76    * Field _noValueColour.
77    */
78   private jalview.schemabinding.version2.types.NoValueColour _noValueColour = jalview.schemabinding.version2.types.NoValueColour
79           .valueOf("Min");
80
81   /**
82    * threshold value for graduated feature colour
83    * 
84    */
85   private float _threshold;
86
87   /**
88    * keeps track of state for field: _threshold
89    */
90   private boolean _has_threshold;
91
92   /**
93    * threshold type for graduated feature colour
94    * 
95    */
96   private int _threshstate;
97
98   /**
99    * keeps track of state for field: _threshstate
100    */
101   private boolean _has_threshstate;
102
103   /**
104    * Field _max.
105    */
106   private float _max;
107
108   /**
109    * keeps track of state for field: _max
110    */
111   private boolean _has_max;
112
113   /**
114    * Field _min.
115    */
116   private float _min;
117
118   /**
119    * keeps track of state for field: _min
120    */
121   private boolean _has_min;
122
123   /**
124    * Field _colourByLabel.
125    */
126   private boolean _colourByLabel;
127
128   /**
129    * keeps track of state for field: _colourByLabel
130    */
131   private boolean _has_colourByLabel;
132
133   /**
134    * Field _autoScale.
135    */
136   private boolean _autoScale;
137
138   /**
139    * keeps track of state for field: _autoScale
140    */
141   private boolean _has_autoScale;
142
143   /**
144    * name of feature attribute to colour by, or attribute and sub-attribute
145    */
146   private java.util.Vector _attributeNameList;
147
148   /**
149    * optional filter(s) applied to the feature type
150    */
151   private jalview.schemabinding.version2.MatcherSet _matcherSet;
152
153   // ----------------/
154   // - Constructors -/
155   // ----------------/
156
157   public Setting()
158   {
159     super();
160     setNoValueColour(jalview.schemabinding.version2.types.NoValueColour
161             .valueOf("Min"));
162     this._attributeNameList = new java.util.Vector();
163   }
164
165   // -----------/
166   // - Methods -/
167   // -----------/
168
169   /**
170    * 
171    * 
172    * @param vAttributeName
173    * @throws java.lang.IndexOutOfBoundsException
174    *           if the index given is outside the bounds of the collection
175    */
176   public void addAttributeName(final java.lang.String vAttributeName)
177           throws java.lang.IndexOutOfBoundsException
178   {
179     // check for the maximum size
180     if (this._attributeNameList.size() >= 2)
181     {
182       throw new IndexOutOfBoundsException(
183               "addAttributeName has a maximum of 2");
184     }
185
186     this._attributeNameList.addElement(vAttributeName);
187   }
188
189   /**
190    * 
191    * 
192    * @param index
193    * @param vAttributeName
194    * @throws java.lang.IndexOutOfBoundsException
195    *           if the index given is outside the bounds of the collection
196    */
197   public void addAttributeName(final int index,
198           final java.lang.String vAttributeName)
199           throws java.lang.IndexOutOfBoundsException
200   {
201     // check for the maximum size
202     if (this._attributeNameList.size() >= 2)
203     {
204       throw new IndexOutOfBoundsException(
205               "addAttributeName has a maximum of 2");
206     }
207
208     this._attributeNameList.add(index, vAttributeName);
209   }
210
211   /**
212    */
213   public void deleteAutoScale()
214   {
215     this._has_autoScale = false;
216   }
217
218   /**
219    */
220   public void deleteColour()
221   {
222     this._has_colour = false;
223   }
224
225   /**
226    */
227   public void deleteColourByLabel()
228   {
229     this._has_colourByLabel = false;
230   }
231
232   /**
233    */
234   public void deleteDisplay()
235   {
236     this._has_display = false;
237   }
238
239   /**
240    */
241   public void deleteMax()
242   {
243     this._has_max = false;
244   }
245
246   /**
247    */
248   public void deleteMin()
249   {
250     this._has_min = false;
251   }
252
253   /**
254    */
255   public void deleteMincolour()
256   {
257     this._has_mincolour = false;
258   }
259
260   /**
261    */
262   public void deleteOrder()
263   {
264     this._has_order = false;
265   }
266
267   /**
268    */
269   public void deleteThreshold()
270   {
271     this._has_threshold = false;
272   }
273
274   /**
275    */
276   public void deleteThreshstate()
277   {
278     this._has_threshstate = false;
279   }
280
281   /**
282    * Method enumerateAttributeName.
283    * 
284    * @return an Enumeration over all java.lang.String elements
285    */
286   public java.util.Enumeration enumerateAttributeName()
287   {
288     return this._attributeNameList.elements();
289   }
290
291   /**
292    * Method getAttributeName.
293    * 
294    * @param index
295    * @throws java.lang.IndexOutOfBoundsException
296    *           if the index given is outside the bounds of the collection
297    * @return the value of the java.lang.String at the given index
298    */
299   public java.lang.String getAttributeName(final int index)
300           throws java.lang.IndexOutOfBoundsException
301   {
302     // check bounds for index
303     if (index < 0 || index >= this._attributeNameList.size())
304     {
305       throw new IndexOutOfBoundsException("getAttributeName: Index value '"
306               + index + "' not in range [0.."
307               + (this._attributeNameList.size() - 1) + "]");
308     }
309
310     return (java.lang.String) _attributeNameList.get(index);
311   }
312
313   /**
314    * Method getAttributeName.Returns the contents of the collection in an Array.
315    * <p>
316    * Note: Just in case the collection contents are changing in another thread,
317    * we pass a 0-length Array of the correct type into the API call. This way we
318    * <i>know</i> that the Array returned is of exactly the correct length.
319    * 
320    * @return this collection as an Array
321    */
322   public java.lang.String[] getAttributeName()
323   {
324     java.lang.String[] array = new java.lang.String[0];
325     return (java.lang.String[]) this._attributeNameList.toArray(array);
326   }
327
328   /**
329    * Method getAttributeNameCount.
330    * 
331    * @return the size of this collection
332    */
333   public int getAttributeNameCount()
334   {
335     return this._attributeNameList.size();
336   }
337
338   /**
339    * Returns the value of field 'autoScale'.
340    * 
341    * @return the value of field 'AutoScale'.
342    */
343   public boolean getAutoScale()
344   {
345     return this._autoScale;
346   }
347
348   /**
349    * Returns the value of field 'colour'.
350    * 
351    * @return the value of field 'Colour'.
352    */
353   public int getColour()
354   {
355     return this._colour;
356   }
357
358   /**
359    * Returns the value of field 'colourByLabel'.
360    * 
361    * @return the value of field 'ColourByLabel'.
362    */
363   public boolean getColourByLabel()
364   {
365     return this._colourByLabel;
366   }
367
368   /**
369    * Returns the value of field 'display'.
370    * 
371    * @return the value of field 'Display'.
372    */
373   public boolean getDisplay()
374   {
375     return this._display;
376   }
377
378   /**
379    * Returns the value of field 'matcherSet'. The field 'matcherSet' has the
380    * following description: optional filter(s) applied to the feature type
381    * 
382    * @return the value of field 'MatcherSet'.
383    */
384   public jalview.schemabinding.version2.MatcherSet getMatcherSet()
385   {
386     return this._matcherSet;
387   }
388
389   /**
390    * Returns the value of field 'max'.
391    * 
392    * @return the value of field 'Max'.
393    */
394   public float getMax()
395   {
396     return this._max;
397   }
398
399   /**
400    * Returns the value of field 'min'.
401    * 
402    * @return the value of field 'Min'.
403    */
404   public float getMin()
405   {
406     return this._min;
407   }
408
409   /**
410    * Returns the value of field 'mincolour'. The field 'mincolour' has the
411    * following description: Optional minimum colour for graduated feature colour
412    * 
413    * 
414    * @return the value of field 'Mincolour'.
415    */
416   public int getMincolour()
417   {
418     return this._mincolour;
419   }
420
421   /**
422    * Returns the value of field 'noValueColour'.
423    * 
424    * @return the value of field 'NoValueColour'.
425    */
426   public jalview.schemabinding.version2.types.NoValueColour getNoValueColour()
427   {
428     return this._noValueColour;
429   }
430
431   /**
432    * Returns the value of field 'order'.
433    * 
434    * @return the value of field 'Order'.
435    */
436   public float getOrder()
437   {
438     return this._order;
439   }
440
441   /**
442    * Returns the value of field 'threshold'. The field 'threshold' has the
443    * following description: threshold value for graduated feature colour
444    * 
445    * 
446    * @return the value of field 'Threshold'.
447    */
448   public float getThreshold()
449   {
450     return this._threshold;
451   }
452
453   /**
454    * Returns the value of field 'threshstate'. The field 'threshstate' has the
455    * following description: threshold type for graduated feature colour
456    * 
457    * 
458    * @return the value of field 'Threshstate'.
459    */
460   public int getThreshstate()
461   {
462     return this._threshstate;
463   }
464
465   /**
466    * Returns the value of field 'type'.
467    * 
468    * @return the value of field 'Type'.
469    */
470   public java.lang.String getType()
471   {
472     return this._type;
473   }
474
475   /**
476    * Method hasAutoScale.
477    * 
478    * @return true if at least one AutoScale has been added
479    */
480   public boolean hasAutoScale()
481   {
482     return this._has_autoScale;
483   }
484
485   /**
486    * Method hasColour.
487    * 
488    * @return true if at least one Colour has been added
489    */
490   public boolean hasColour()
491   {
492     return this._has_colour;
493   }
494
495   /**
496    * Method hasColourByLabel.
497    * 
498    * @return true if at least one ColourByLabel has been added
499    */
500   public boolean hasColourByLabel()
501   {
502     return this._has_colourByLabel;
503   }
504
505   /**
506    * Method hasDisplay.
507    * 
508    * @return true if at least one Display has been added
509    */
510   public boolean hasDisplay()
511   {
512     return this._has_display;
513   }
514
515   /**
516    * Method hasMax.
517    * 
518    * @return true if at least one Max has been added
519    */
520   public boolean hasMax()
521   {
522     return this._has_max;
523   }
524
525   /**
526    * Method hasMin.
527    * 
528    * @return true if at least one Min has been added
529    */
530   public boolean hasMin()
531   {
532     return this._has_min;
533   }
534
535   /**
536    * Method hasMincolour.
537    * 
538    * @return true if at least one Mincolour has been added
539    */
540   public boolean hasMincolour()
541   {
542     return this._has_mincolour;
543   }
544
545   /**
546    * Method hasOrder.
547    * 
548    * @return true if at least one Order has been added
549    */
550   public boolean hasOrder()
551   {
552     return this._has_order;
553   }
554
555   /**
556    * Method hasThreshold.
557    * 
558    * @return true if at least one Threshold has been added
559    */
560   public boolean hasThreshold()
561   {
562     return this._has_threshold;
563   }
564
565   /**
566    * Method hasThreshstate.
567    * 
568    * @return true if at least one Threshstate has been added
569    */
570   public boolean hasThreshstate()
571   {
572     return this._has_threshstate;
573   }
574
575   /**
576    * Returns the value of field 'autoScale'.
577    * 
578    * @return the value of field 'AutoScale'.
579    */
580   public boolean isAutoScale()
581   {
582     return this._autoScale;
583   }
584
585   /**
586    * Returns the value of field 'colourByLabel'.
587    * 
588    * @return the value of field 'ColourByLabel'.
589    */
590   public boolean isColourByLabel()
591   {
592     return this._colourByLabel;
593   }
594
595   /**
596    * Returns the value of field 'display'.
597    * 
598    * @return the value of field 'Display'.
599    */
600   public boolean isDisplay()
601   {
602     return this._display;
603   }
604
605   /**
606    * Method isValid.
607    * 
608    * @return true if this object is valid according to the schema
609    */
610   public boolean isValid()
611   {
612     try
613     {
614       validate();
615     } catch (org.exolab.castor.xml.ValidationException vex)
616     {
617       return false;
618     }
619     return true;
620   }
621
622   /**
623    * 
624    * 
625    * @param out
626    * @throws org.exolab.castor.xml.MarshalException
627    *           if object is null or if any SAXException is thrown during
628    *           marshaling
629    * @throws org.exolab.castor.xml.ValidationException
630    *           if this object is an invalid instance according to the schema
631    */
632   public void marshal(final java.io.Writer out)
633           throws org.exolab.castor.xml.MarshalException,
634           org.exolab.castor.xml.ValidationException
635   {
636     Marshaller.marshal(this, out);
637   }
638
639   /**
640    * 
641    * 
642    * @param handler
643    * @throws java.io.IOException
644    *           if an IOException occurs during marshaling
645    * @throws org.exolab.castor.xml.ValidationException
646    *           if this object is an invalid instance according to the schema
647    * @throws org.exolab.castor.xml.MarshalException
648    *           if object is null or if any SAXException is thrown during
649    *           marshaling
650    */
651   public void marshal(final org.xml.sax.ContentHandler handler)
652           throws java.io.IOException,
653           org.exolab.castor.xml.MarshalException,
654           org.exolab.castor.xml.ValidationException
655   {
656     Marshaller.marshal(this, handler);
657   }
658
659   /**
660    */
661   public void removeAllAttributeName()
662   {
663     this._attributeNameList.clear();
664   }
665
666   /**
667    * Method removeAttributeName.
668    * 
669    * @param vAttributeName
670    * @return true if the object was removed from the collection.
671    */
672   public boolean removeAttributeName(final java.lang.String vAttributeName)
673   {
674     boolean removed = _attributeNameList.remove(vAttributeName);
675     return removed;
676   }
677
678   /**
679    * Method removeAttributeNameAt.
680    * 
681    * @param index
682    * @return the element removed from the collection
683    */
684   public java.lang.String removeAttributeNameAt(final int index)
685   {
686     java.lang.Object obj = this._attributeNameList.remove(index);
687     return (java.lang.String) obj;
688   }
689
690   /**
691    * 
692    * 
693    * @param index
694    * @param vAttributeName
695    * @throws java.lang.IndexOutOfBoundsException
696    *           if the index given is outside the bounds of the collection
697    */
698   public void setAttributeName(final int index,
699           final java.lang.String vAttributeName)
700           throws java.lang.IndexOutOfBoundsException
701   {
702     // check bounds for index
703     if (index < 0 || index >= this._attributeNameList.size())
704     {
705       throw new IndexOutOfBoundsException("setAttributeName: Index value '"
706               + index + "' not in range [0.."
707               + (this._attributeNameList.size() - 1) + "]");
708     }
709
710     this._attributeNameList.set(index, vAttributeName);
711   }
712
713   /**
714    * 
715    * 
716    * @param vAttributeNameArray
717    */
718   public void setAttributeName(final java.lang.String[] vAttributeNameArray)
719   {
720     // -- copy array
721     _attributeNameList.clear();
722
723     for (int i = 0; i < vAttributeNameArray.length; i++)
724     {
725       this._attributeNameList.add(vAttributeNameArray[i]);
726     }
727   }
728
729   /**
730    * Sets the value of field 'autoScale'.
731    * 
732    * @param autoScale
733    *          the value of field 'autoScale'.
734    */
735   public void setAutoScale(final boolean autoScale)
736   {
737     this._autoScale = autoScale;
738     this._has_autoScale = true;
739   }
740
741   /**
742    * Sets the value of field 'colour'.
743    * 
744    * @param colour
745    *          the value of field 'colour'.
746    */
747   public void setColour(final int colour)
748   {
749     this._colour = colour;
750     this._has_colour = true;
751   }
752
753   /**
754    * Sets the value of field 'colourByLabel'.
755    * 
756    * @param colourByLabel
757    *          the value of field 'colourByLabel'.
758    */
759   public void setColourByLabel(final boolean colourByLabel)
760   {
761     this._colourByLabel = colourByLabel;
762     this._has_colourByLabel = true;
763   }
764
765   /**
766    * Sets the value of field 'display'.
767    * 
768    * @param display
769    *          the value of field 'display'.
770    */
771   public void setDisplay(final boolean display)
772   {
773     this._display = display;
774     this._has_display = true;
775   }
776
777   /**
778    * Sets the value of field 'matcherSet'. The field 'matcherSet' has the
779    * following description: optional filter(s) applied to the feature type
780    * 
781    * @param matcherSet
782    *          the value of field 'matcherSet'.
783    */
784   public void setMatcherSet(
785           final jalview.schemabinding.version2.MatcherSet matcherSet)
786   {
787     this._matcherSet = matcherSet;
788   }
789
790   /**
791    * Sets the value of field 'max'.
792    * 
793    * @param max
794    *          the value of field 'max'.
795    */
796   public void setMax(final float max)
797   {
798     this._max = max;
799     this._has_max = true;
800   }
801
802   /**
803    * Sets the value of field 'min'.
804    * 
805    * @param min
806    *          the value of field 'min'.
807    */
808   public void setMin(final float min)
809   {
810     this._min = min;
811     this._has_min = true;
812   }
813
814   /**
815    * Sets the value of field 'mincolour'. The field 'mincolour' has the
816    * following description: Optional minimum colour for graduated feature colour
817    * 
818    * 
819    * @param mincolour
820    *          the value of field 'mincolour'.
821    */
822   public void setMincolour(final int mincolour)
823   {
824     this._mincolour = mincolour;
825     this._has_mincolour = true;
826   }
827
828   /**
829    * Sets the value of field 'noValueColour'.
830    * 
831    * @param noValueColour
832    *          the value of field 'noValueColour'.
833    */
834   public void setNoValueColour(
835           final jalview.schemabinding.version2.types.NoValueColour noValueColour)
836   {
837     this._noValueColour = noValueColour;
838   }
839
840   /**
841    * Sets the value of field 'order'.
842    * 
843    * @param order
844    *          the value of field 'order'.
845    */
846   public void setOrder(final float order)
847   {
848     this._order = order;
849     this._has_order = true;
850   }
851
852   /**
853    * Sets the value of field 'threshold'. The field 'threshold' has the
854    * following description: threshold value for graduated feature colour
855    * 
856    * 
857    * @param threshold
858    *          the value of field 'threshold'.
859    */
860   public void setThreshold(final float threshold)
861   {
862     this._threshold = threshold;
863     this._has_threshold = true;
864   }
865
866   /**
867    * Sets the value of field 'threshstate'. The field 'threshstate' has the
868    * following description: threshold type for graduated feature colour
869    * 
870    * 
871    * @param threshstate
872    *          the value of field 'threshstate'.
873    */
874   public void setThreshstate(final int threshstate)
875   {
876     this._threshstate = threshstate;
877     this._has_threshstate = true;
878   }
879
880   /**
881    * Sets the value of field 'type'.
882    * 
883    * @param type
884    *          the value of field 'type'.
885    */
886   public void setType(final java.lang.String type)
887   {
888     this._type = type;
889   }
890
891   /**
892    * Method unmarshal.
893    * 
894    * @param reader
895    * @throws org.exolab.castor.xml.MarshalException
896    *           if object is null or if any SAXException is thrown during
897    *           marshaling
898    * @throws org.exolab.castor.xml.ValidationException
899    *           if this object is an invalid instance according to the schema
900    * @return the unmarshaled jalview.schemabinding.version2.Settin
901    */
902   public static jalview.schemabinding.version2.Setting unmarshal(
903           final java.io.Reader reader)
904           throws org.exolab.castor.xml.MarshalException,
905           org.exolab.castor.xml.ValidationException
906   {
907     return (jalview.schemabinding.version2.Setting) Unmarshaller.unmarshal(
908             jalview.schemabinding.version2.Setting.class, reader);
909   }
910
911   /**
912    * 
913    * 
914    * @throws org.exolab.castor.xml.ValidationException
915    *           if this object is an invalid instance according to the schema
916    */
917   public void validate() throws org.exolab.castor.xml.ValidationException
918   {
919     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
920     validator.validate(this);
921   }
922
923 }