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