f7679f1b014b5fbc9137a71deae1eb428561b4d1
[jalview.git] / src / jalview / binding / Tree.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
3  * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
4  * 
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  * 
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  * 
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
18  */
19 package jalview.binding;
20
21 // ---------------------------------/
22 // - Imported classes and packages -/
23 // ---------------------------------/
24
25 import org.exolab.castor.xml.Marshaller;
26 import org.exolab.castor.xml.Unmarshaller;
27
28 /**
29  * Class Tree.
30  * 
31  * @version $Revision$ $Date$
32  */
33 public class Tree implements java.io.Serializable
34 {
35
36   // --------------------------/
37   // - Class/Member Variables -/
38   // --------------------------/
39
40   /**
41    * Field _width.
42    */
43   private int _width;
44
45   /**
46    * keeps track of state for field: _width
47    */
48   private boolean _has_width;
49
50   /**
51    * Field _height.
52    */
53   private int _height;
54
55   /**
56    * keeps track of state for field: _height
57    */
58   private boolean _has_height;
59
60   /**
61    * Field _xpos.
62    */
63   private int _xpos;
64
65   /**
66    * keeps track of state for field: _xpos
67    */
68   private boolean _has_xpos;
69
70   /**
71    * Field _ypos.
72    */
73   private int _ypos;
74
75   /**
76    * keeps track of state for field: _ypos
77    */
78   private boolean _has_ypos;
79
80   /**
81    * Field _fontName.
82    */
83   private java.lang.String _fontName;
84
85   /**
86    * Field _fontSize.
87    */
88   private int _fontSize;
89
90   /**
91    * keeps track of state for field: _fontSize
92    */
93   private boolean _has_fontSize;
94
95   /**
96    * Field _fontStyle.
97    */
98   private int _fontStyle;
99
100   /**
101    * keeps track of state for field: _fontStyle
102    */
103   private boolean _has_fontStyle;
104
105   /**
106    * Field _threshold.
107    */
108   private float _threshold;
109
110   /**
111    * keeps track of state for field: _threshold
112    */
113   private boolean _has_threshold;
114
115   /**
116    * Field _showBootstrap.
117    */
118   private boolean _showBootstrap;
119
120   /**
121    * keeps track of state for field: _showBootstrap
122    */
123   private boolean _has_showBootstrap;
124
125   /**
126    * Field _showDistances.
127    */
128   private boolean _showDistances;
129
130   /**
131    * keeps track of state for field: _showDistances
132    */
133   private boolean _has_showDistances;
134
135   /**
136    * Field _markUnlinked.
137    */
138   private boolean _markUnlinked;
139
140   /**
141    * keeps track of state for field: _markUnlinked
142    */
143   private boolean _has_markUnlinked;
144
145   /**
146    * Field _fitToWindow.
147    */
148   private boolean _fitToWindow;
149
150   /**
151    * keeps track of state for field: _fitToWindow
152    */
153   private boolean _has_fitToWindow;
154
155   /**
156    * Field _currentTree.
157    */
158   private boolean _currentTree;
159
160   /**
161    * keeps track of state for field: _currentTree
162    */
163   private boolean _has_currentTree;
164
165   /**
166    * Field _title.
167    */
168   private java.lang.String _title;
169
170   /**
171    * Field _newick.
172    */
173   private java.lang.String _newick;
174
175   // ----------------/
176   // - Constructors -/
177   // ----------------/
178
179   public Tree()
180   {
181     super();
182   }
183
184   // -----------/
185   // - Methods -/
186   // -----------/
187
188   /**
189    */
190   public void deleteCurrentTree()
191   {
192     this._has_currentTree = false;
193   }
194
195   /**
196    */
197   public void deleteFitToWindow()
198   {
199     this._has_fitToWindow = false;
200   }
201
202   /**
203    */
204   public void deleteFontSize()
205   {
206     this._has_fontSize = false;
207   }
208
209   /**
210    */
211   public void deleteFontStyle()
212   {
213     this._has_fontStyle = false;
214   }
215
216   /**
217    */
218   public void deleteHeight()
219   {
220     this._has_height = false;
221   }
222
223   /**
224    */
225   public void deleteMarkUnlinked()
226   {
227     this._has_markUnlinked = false;
228   }
229
230   /**
231    */
232   public void deleteShowBootstrap()
233   {
234     this._has_showBootstrap = false;
235   }
236
237   /**
238    */
239   public void deleteShowDistances()
240   {
241     this._has_showDistances = false;
242   }
243
244   /**
245    */
246   public void deleteThreshold()
247   {
248     this._has_threshold = false;
249   }
250
251   /**
252    */
253   public void deleteWidth()
254   {
255     this._has_width = false;
256   }
257
258   /**
259    */
260   public void deleteXpos()
261   {
262     this._has_xpos = false;
263   }
264
265   /**
266    */
267   public void deleteYpos()
268   {
269     this._has_ypos = false;
270   }
271
272   /**
273    * Returns the value of field 'currentTree'.
274    * 
275    * @return the value of field 'CurrentTree'.
276    */
277   public boolean getCurrentTree()
278   {
279     return this._currentTree;
280   }
281
282   /**
283    * Returns the value of field 'fitToWindow'.
284    * 
285    * @return the value of field 'FitToWindow'.
286    */
287   public boolean getFitToWindow()
288   {
289     return this._fitToWindow;
290   }
291
292   /**
293    * Returns the value of field 'fontName'.
294    * 
295    * @return the value of field 'FontName'.
296    */
297   public java.lang.String getFontName()
298   {
299     return this._fontName;
300   }
301
302   /**
303    * Returns the value of field 'fontSize'.
304    * 
305    * @return the value of field 'FontSize'.
306    */
307   public int getFontSize()
308   {
309     return this._fontSize;
310   }
311
312   /**
313    * Returns the value of field 'fontStyle'.
314    * 
315    * @return the value of field 'FontStyle'.
316    */
317   public int getFontStyle()
318   {
319     return this._fontStyle;
320   }
321
322   /**
323    * Returns the value of field 'height'.
324    * 
325    * @return the value of field 'Height'.
326    */
327   public int getHeight()
328   {
329     return this._height;
330   }
331
332   /**
333    * Returns the value of field 'markUnlinked'.
334    * 
335    * @return the value of field 'MarkUnlinked'.
336    */
337   public boolean getMarkUnlinked()
338   {
339     return this._markUnlinked;
340   }
341
342   /**
343    * Returns the value of field 'newick'.
344    * 
345    * @return the value of field 'Newick'.
346    */
347   public java.lang.String getNewick()
348   {
349     return this._newick;
350   }
351
352   /**
353    * Returns the value of field 'showBootstrap'.
354    * 
355    * @return the value of field 'ShowBootstrap'.
356    */
357   public boolean getShowBootstrap()
358   {
359     return this._showBootstrap;
360   }
361
362   /**
363    * Returns the value of field 'showDistances'.
364    * 
365    * @return the value of field 'ShowDistances'.
366    */
367   public boolean getShowDistances()
368   {
369     return this._showDistances;
370   }
371
372   /**
373    * Returns the value of field 'threshold'.
374    * 
375    * @return the value of field 'Threshold'.
376    */
377   public float getThreshold()
378   {
379     return this._threshold;
380   }
381
382   /**
383    * Returns the value of field 'title'.
384    * 
385    * @return the value of field 'Title'.
386    */
387   public java.lang.String getTitle()
388   {
389     return this._title;
390   }
391
392   /**
393    * Returns the value of field 'width'.
394    * 
395    * @return the value of field 'Width'.
396    */
397   public int getWidth()
398   {
399     return this._width;
400   }
401
402   /**
403    * Returns the value of field 'xpos'.
404    * 
405    * @return the value of field 'Xpos'.
406    */
407   public int getXpos()
408   {
409     return this._xpos;
410   }
411
412   /**
413    * Returns the value of field 'ypos'.
414    * 
415    * @return the value of field 'Ypos'.
416    */
417   public int getYpos()
418   {
419     return this._ypos;
420   }
421
422   /**
423    * Method hasCurrentTree.
424    * 
425    * @return true if at least one CurrentTree has been added
426    */
427   public boolean hasCurrentTree()
428   {
429     return this._has_currentTree;
430   }
431
432   /**
433    * Method hasFitToWindow.
434    * 
435    * @return true if at least one FitToWindow has been added
436    */
437   public boolean hasFitToWindow()
438   {
439     return this._has_fitToWindow;
440   }
441
442   /**
443    * Method hasFontSize.
444    * 
445    * @return true if at least one FontSize has been added
446    */
447   public boolean hasFontSize()
448   {
449     return this._has_fontSize;
450   }
451
452   /**
453    * Method hasFontStyle.
454    * 
455    * @return true if at least one FontStyle has been added
456    */
457   public boolean hasFontStyle()
458   {
459     return this._has_fontStyle;
460   }
461
462   /**
463    * Method hasHeight.
464    * 
465    * @return true if at least one Height has been added
466    */
467   public boolean hasHeight()
468   {
469     return this._has_height;
470   }
471
472   /**
473    * Method hasMarkUnlinked.
474    * 
475    * @return true if at least one MarkUnlinked has been added
476    */
477   public boolean hasMarkUnlinked()
478   {
479     return this._has_markUnlinked;
480   }
481
482   /**
483    * Method hasShowBootstrap.
484    * 
485    * @return true if at least one ShowBootstrap has been added
486    */
487   public boolean hasShowBootstrap()
488   {
489     return this._has_showBootstrap;
490   }
491
492   /**
493    * Method hasShowDistances.
494    * 
495    * @return true if at least one ShowDistances has been added
496    */
497   public boolean hasShowDistances()
498   {
499     return this._has_showDistances;
500   }
501
502   /**
503    * Method hasThreshold.
504    * 
505    * @return true if at least one Threshold has been added
506    */
507   public boolean hasThreshold()
508   {
509     return this._has_threshold;
510   }
511
512   /**
513    * Method hasWidth.
514    * 
515    * @return true if at least one Width has been added
516    */
517   public boolean hasWidth()
518   {
519     return this._has_width;
520   }
521
522   /**
523    * Method hasXpos.
524    * 
525    * @return true if at least one Xpos has been added
526    */
527   public boolean hasXpos()
528   {
529     return this._has_xpos;
530   }
531
532   /**
533    * Method hasYpos.
534    * 
535    * @return true if at least one Ypos has been added
536    */
537   public boolean hasYpos()
538   {
539     return this._has_ypos;
540   }
541
542   /**
543    * Returns the value of field 'currentTree'.
544    * 
545    * @return the value of field 'CurrentTree'.
546    */
547   public boolean isCurrentTree()
548   {
549     return this._currentTree;
550   }
551
552   /**
553    * Returns the value of field 'fitToWindow'.
554    * 
555    * @return the value of field 'FitToWindow'.
556    */
557   public boolean isFitToWindow()
558   {
559     return this._fitToWindow;
560   }
561
562   /**
563    * Returns the value of field 'markUnlinked'.
564    * 
565    * @return the value of field 'MarkUnlinked'.
566    */
567   public boolean isMarkUnlinked()
568   {
569     return this._markUnlinked;
570   }
571
572   /**
573    * Returns the value of field 'showBootstrap'.
574    * 
575    * @return the value of field 'ShowBootstrap'.
576    */
577   public boolean isShowBootstrap()
578   {
579     return this._showBootstrap;
580   }
581
582   /**
583    * Returns the value of field 'showDistances'.
584    * 
585    * @return the value of field 'ShowDistances'.
586    */
587   public boolean isShowDistances()
588   {
589     return this._showDistances;
590   }
591
592   /**
593    * Method isValid.
594    * 
595    * @return true if this object is valid according to the schema
596    */
597   public boolean isValid()
598   {
599     try
600     {
601       validate();
602     } catch (org.exolab.castor.xml.ValidationException vex)
603     {
604       return false;
605     }
606     return true;
607   }
608
609   /**
610    * 
611    * 
612    * @param out
613    * @throws org.exolab.castor.xml.MarshalException
614    *                 if object is null or if any SAXException is thrown during
615    *                 marshaling
616    * @throws org.exolab.castor.xml.ValidationException
617    *                 if this object is an invalid instance according to the
618    *                 schema
619    */
620   public void marshal(final java.io.Writer out)
621           throws org.exolab.castor.xml.MarshalException,
622           org.exolab.castor.xml.ValidationException
623   {
624     Marshaller.marshal(this, out);
625   }
626
627   /**
628    * 
629    * 
630    * @param handler
631    * @throws java.io.IOException
632    *                 if an IOException occurs during marshaling
633    * @throws org.exolab.castor.xml.ValidationException
634    *                 if this object is an invalid instance according to the
635    *                 schema
636    * @throws org.exolab.castor.xml.MarshalException
637    *                 if object is null or if any SAXException is thrown during
638    *                 marshaling
639    */
640   public void marshal(final org.xml.sax.ContentHandler handler)
641           throws java.io.IOException,
642           org.exolab.castor.xml.MarshalException,
643           org.exolab.castor.xml.ValidationException
644   {
645     Marshaller.marshal(this, handler);
646   }
647
648   /**
649    * Sets the value of field 'currentTree'.
650    * 
651    * @param currentTree
652    *                the value of field 'currentTree'.
653    */
654   public void setCurrentTree(final boolean currentTree)
655   {
656     this._currentTree = currentTree;
657     this._has_currentTree = true;
658   }
659
660   /**
661    * Sets the value of field 'fitToWindow'.
662    * 
663    * @param fitToWindow
664    *                the value of field 'fitToWindow'.
665    */
666   public void setFitToWindow(final boolean fitToWindow)
667   {
668     this._fitToWindow = fitToWindow;
669     this._has_fitToWindow = true;
670   }
671
672   /**
673    * Sets the value of field 'fontName'.
674    * 
675    * @param fontName
676    *                the value of field 'fontName'.
677    */
678   public void setFontName(final java.lang.String fontName)
679   {
680     this._fontName = fontName;
681   }
682
683   /**
684    * Sets the value of field 'fontSize'.
685    * 
686    * @param fontSize
687    *                the value of field 'fontSize'.
688    */
689   public void setFontSize(final int fontSize)
690   {
691     this._fontSize = fontSize;
692     this._has_fontSize = true;
693   }
694
695   /**
696    * Sets the value of field 'fontStyle'.
697    * 
698    * @param fontStyle
699    *                the value of field 'fontStyle'.
700    */
701   public void setFontStyle(final int fontStyle)
702   {
703     this._fontStyle = fontStyle;
704     this._has_fontStyle = true;
705   }
706
707   /**
708    * Sets the value of field 'height'.
709    * 
710    * @param height
711    *                the value of field 'height'.
712    */
713   public void setHeight(final int height)
714   {
715     this._height = height;
716     this._has_height = true;
717   }
718
719   /**
720    * Sets the value of field 'markUnlinked'.
721    * 
722    * @param markUnlinked
723    *                the value of field 'markUnlinked'.
724    */
725   public void setMarkUnlinked(final boolean markUnlinked)
726   {
727     this._markUnlinked = markUnlinked;
728     this._has_markUnlinked = true;
729   }
730
731   /**
732    * Sets the value of field 'newick'.
733    * 
734    * @param newick
735    *                the value of field 'newick'.
736    */
737   public void setNewick(final java.lang.String newick)
738   {
739     this._newick = newick;
740   }
741
742   /**
743    * Sets the value of field 'showBootstrap'.
744    * 
745    * @param showBootstrap
746    *                the value of field 'showBootstrap'.
747    */
748   public void setShowBootstrap(final boolean showBootstrap)
749   {
750     this._showBootstrap = showBootstrap;
751     this._has_showBootstrap = true;
752   }
753
754   /**
755    * Sets the value of field 'showDistances'.
756    * 
757    * @param showDistances
758    *                the value of field 'showDistances'.
759    */
760   public void setShowDistances(final boolean showDistances)
761   {
762     this._showDistances = showDistances;
763     this._has_showDistances = true;
764   }
765
766   /**
767    * Sets the value of field 'threshold'.
768    * 
769    * @param threshold
770    *                the value of field 'threshold'.
771    */
772   public void setThreshold(final float threshold)
773   {
774     this._threshold = threshold;
775     this._has_threshold = true;
776   }
777
778   /**
779    * Sets the value of field 'title'.
780    * 
781    * @param title
782    *                the value of field 'title'.
783    */
784   public void setTitle(final java.lang.String title)
785   {
786     this._title = title;
787   }
788
789   /**
790    * Sets the value of field 'width'.
791    * 
792    * @param width
793    *                the value of field 'width'.
794    */
795   public void setWidth(final int width)
796   {
797     this._width = width;
798     this._has_width = true;
799   }
800
801   /**
802    * Sets the value of field 'xpos'.
803    * 
804    * @param xpos
805    *                the value of field 'xpos'.
806    */
807   public void setXpos(final int xpos)
808   {
809     this._xpos = xpos;
810     this._has_xpos = true;
811   }
812
813   /**
814    * Sets the value of field 'ypos'.
815    * 
816    * @param ypos
817    *                the value of field 'ypos'.
818    */
819   public void setYpos(final int ypos)
820   {
821     this._ypos = ypos;
822     this._has_ypos = true;
823   }
824
825   /**
826    * Method unmarshal.
827    * 
828    * @param reader
829    * @throws org.exolab.castor.xml.MarshalException
830    *                 if object is null or if any SAXException is thrown during
831    *                 marshaling
832    * @throws org.exolab.castor.xml.ValidationException
833    *                 if this object is an invalid instance according to the
834    *                 schema
835    * @return the unmarshaled jalview.binding.Tree
836    */
837   public static jalview.binding.Tree unmarshal(final java.io.Reader reader)
838           throws org.exolab.castor.xml.MarshalException,
839           org.exolab.castor.xml.ValidationException
840   {
841     return (jalview.binding.Tree) Unmarshaller.unmarshal(
842             jalview.binding.Tree.class, reader);
843   }
844
845   /**
846    * 
847    * 
848    * @throws org.exolab.castor.xml.ValidationException
849    *                 if this object is an invalid instance according to the
850    *                 schema
851    */
852   public void validate() throws org.exolab.castor.xml.ValidationException
853   {
854     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
855     validator.validate(this);
856   }
857
858 }