2 * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
3 * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
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.
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.
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
19 package jalview.binding;
21 //---------------------------------/
22 //- Imported classes and packages -/
23 //---------------------------------/
25 import org.exolab.castor.xml.Marshaller;
26 import org.exolab.castor.xml.Unmarshaller;
31 * @version $Revision$ $Date$
33 public class JGroup implements java.io.Serializable {
36 //--------------------------/
37 //- Class/Member Variables -/
38 //--------------------------/
46 * keeps track of state for field: _start
48 private boolean _has_start;
56 * keeps track of state for field: _end
58 private boolean _has_end;
63 private java.lang.String _name;
68 private java.lang.String _colour;
71 * Field _consThreshold.
73 private int _consThreshold;
76 * keeps track of state for field: _consThreshold
78 private boolean _has_consThreshold;
81 * Field _pidThreshold.
83 private int _pidThreshold;
86 * keeps track of state for field: _pidThreshold
88 private boolean _has_pidThreshold;
91 * Field _outlineColour.
93 private int _outlineColour;
96 * keeps track of state for field: _outlineColour
98 private boolean _has_outlineColour;
101 * Field _displayBoxes.
103 private boolean _displayBoxes;
106 * keeps track of state for field: _displayBoxes
108 private boolean _has_displayBoxes;
111 * Field _displayText.
113 private boolean _displayText;
116 * keeps track of state for field: _displayText
118 private boolean _has_displayText;
123 private boolean _colourText;
126 * keeps track of state for field: _colourText
128 private boolean _has_colourText;
133 private java.util.Vector _seqList;
142 this._seqList = new java.util.Vector();
154 * @throws java.lang.IndexOutOfBoundsException if the index
155 * given is outside the bounds of the collection
159 throws java.lang.IndexOutOfBoundsException {
160 this._seqList.addElement(new java.lang.Integer(vSeq));
168 * @throws java.lang.IndexOutOfBoundsException if the index
169 * given is outside the bounds of the collection
174 throws java.lang.IndexOutOfBoundsException {
175 this._seqList.add(index, new java.lang.Integer(vSeq));
180 public void deleteColourText(
182 this._has_colourText= false;
187 public void deleteConsThreshold(
189 this._has_consThreshold= false;
194 public void deleteDisplayBoxes(
196 this._has_displayBoxes= false;
201 public void deleteDisplayText(
203 this._has_displayText= false;
208 public void deleteEnd(
210 this._has_end= false;
215 public void deleteOutlineColour(
217 this._has_outlineColour= false;
222 public void deletePidThreshold(
224 this._has_pidThreshold= false;
229 public void deleteStart(
231 this._has_start= false;
235 * Method enumerateSeq.
237 * @return an Enumeration over all int elements
239 public java.util.Enumeration enumerateSeq(
241 return this._seqList.elements();
245 * Returns the value of field 'colour'.
247 * @return the value of field 'Colour'.
249 public java.lang.String getColour(
255 * Returns the value of field 'colourText'.
257 * @return the value of field 'ColourText'.
259 public boolean getColourText(
261 return this._colourText;
265 * Returns the value of field 'consThreshold'.
267 * @return the value of field 'ConsThreshold'.
269 public int getConsThreshold(
271 return this._consThreshold;
275 * Returns the value of field 'displayBoxes'.
277 * @return the value of field 'DisplayBoxes'.
279 public boolean getDisplayBoxes(
281 return this._displayBoxes;
285 * Returns the value of field 'displayText'.
287 * @return the value of field 'DisplayText'.
289 public boolean getDisplayText(
291 return this._displayText;
295 * Returns the value of field 'end'.
297 * @return the value of field 'End'.
305 * Returns the value of field 'name'.
307 * @return the value of field 'Name'.
309 public java.lang.String getName(
315 * Returns the value of field 'outlineColour'.
317 * @return the value of field 'OutlineColour'.
319 public int getOutlineColour(
321 return this._outlineColour;
325 * Returns the value of field 'pidThreshold'.
327 * @return the value of field 'PidThreshold'.
329 public int getPidThreshold(
331 return this._pidThreshold;
338 * @throws java.lang.IndexOutOfBoundsException if the index
339 * given is outside the bounds of the collection
340 * @return the value of the int at the given index
344 throws java.lang.IndexOutOfBoundsException {
345 // check bounds for index
346 if (index < 0 || index >= this._seqList.size()) {
347 throw new IndexOutOfBoundsException("getSeq: Index value '" + index + "' not in range [0.." + (this._seqList.size() - 1) + "]");
350 return ((java.lang.Integer) _seqList.get(index)).intValue();
354 * Method getSeq.Returns the contents of the collection in an
357 * @return this collection as an Array
361 int size = this._seqList.size();
362 int[] array = new int[size];
363 java.util.Iterator iter = _seqList.iterator();
364 for (int index = 0; index < size; index++) {
365 array[index] = ((java.lang.Integer) iter.next()).intValue();
371 * Method getSeqCount.
373 * @return the size of this collection
375 public int getSeqCount(
377 return this._seqList.size();
381 * Returns the value of field 'start'.
383 * @return the value of field 'Start'.
391 * Method hasColourText.
393 * @return true if at least one ColourText has been added
395 public boolean hasColourText(
397 return this._has_colourText;
401 * Method hasConsThreshold.
403 * @return true if at least one ConsThreshold has been added
405 public boolean hasConsThreshold(
407 return this._has_consThreshold;
411 * Method hasDisplayBoxes.
413 * @return true if at least one DisplayBoxes has been added
415 public boolean hasDisplayBoxes(
417 return this._has_displayBoxes;
421 * Method hasDisplayText.
423 * @return true if at least one DisplayText has been added
425 public boolean hasDisplayText(
427 return this._has_displayText;
433 * @return true if at least one End has been added
435 public boolean hasEnd(
437 return this._has_end;
441 * Method hasOutlineColour.
443 * @return true if at least one OutlineColour has been added
445 public boolean hasOutlineColour(
447 return this._has_outlineColour;
451 * Method hasPidThreshold.
453 * @return true if at least one PidThreshold has been added
455 public boolean hasPidThreshold(
457 return this._has_pidThreshold;
463 * @return true if at least one Start has been added
465 public boolean hasStart(
467 return this._has_start;
471 * Returns the value of field 'colourText'.
473 * @return the value of field 'ColourText'.
475 public boolean isColourText(
477 return this._colourText;
481 * Returns the value of field 'displayBoxes'.
483 * @return the value of field 'DisplayBoxes'.
485 public boolean isDisplayBoxes(
487 return this._displayBoxes;
491 * Returns the value of field 'displayText'.
493 * @return the value of field 'DisplayText'.
495 public boolean isDisplayText(
497 return this._displayText;
503 * @return true if this object is valid according to the schema
505 public boolean isValid(
509 } catch (org.exolab.castor.xml.ValidationException vex) {
519 * @throws org.exolab.castor.xml.MarshalException if object is
520 * null or if any SAXException is thrown during marshaling
521 * @throws org.exolab.castor.xml.ValidationException if this
522 * object is an invalid instance according to the schema
525 final java.io.Writer out)
526 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
527 Marshaller.marshal(this, out);
534 * @throws java.io.IOException if an IOException occurs during
536 * @throws org.exolab.castor.xml.ValidationException if this
537 * object is an invalid instance according to the schema
538 * @throws org.exolab.castor.xml.MarshalException if object is
539 * null or if any SAXException is thrown during marshaling
542 final org.xml.sax.ContentHandler handler)
543 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
544 Marshaller.marshal(this, handler);
549 public void removeAllSeq(
551 this._seqList.clear();
558 * @return true if the object was removed from the collection.
560 public boolean removeSeq(
562 boolean removed = _seqList.remove(new java.lang.Integer(vSeq));
567 * Method removeSeqAt.
570 * @return the element removed from the collection
572 public int removeSeqAt(
574 java.lang.Object obj = this._seqList.remove(index);
575 return ((java.lang.Integer) obj).intValue();
579 * Sets the value of field 'colour'.
581 * @param colour the value of field 'colour'.
583 public void setColour(
584 final java.lang.String colour) {
585 this._colour = colour;
589 * Sets the value of field 'colourText'.
591 * @param colourText the value of field 'colourText'.
593 public void setColourText(
594 final boolean colourText) {
595 this._colourText = colourText;
596 this._has_colourText = true;
600 * Sets the value of field 'consThreshold'.
602 * @param consThreshold the value of field 'consThreshold'.
604 public void setConsThreshold(
605 final int consThreshold) {
606 this._consThreshold = consThreshold;
607 this._has_consThreshold = true;
611 * Sets the value of field 'displayBoxes'.
613 * @param displayBoxes the value of field 'displayBoxes'.
615 public void setDisplayBoxes(
616 final boolean displayBoxes) {
617 this._displayBoxes = displayBoxes;
618 this._has_displayBoxes = true;
622 * Sets the value of field 'displayText'.
624 * @param displayText the value of field 'displayText'.
626 public void setDisplayText(
627 final boolean displayText) {
628 this._displayText = displayText;
629 this._has_displayText = true;
633 * Sets the value of field 'end'.
635 * @param end the value of field 'end'.
640 this._has_end = true;
644 * Sets the value of field 'name'.
646 * @param name the value of field 'name'.
649 final java.lang.String name) {
654 * Sets the value of field 'outlineColour'.
656 * @param outlineColour the value of field 'outlineColour'.
658 public void setOutlineColour(
659 final int outlineColour) {
660 this._outlineColour = outlineColour;
661 this._has_outlineColour = true;
665 * Sets the value of field 'pidThreshold'.
667 * @param pidThreshold the value of field 'pidThreshold'.
669 public void setPidThreshold(
670 final int pidThreshold) {
671 this._pidThreshold = pidThreshold;
672 this._has_pidThreshold = true;
680 * @throws java.lang.IndexOutOfBoundsException if the index
681 * given is outside the bounds of the collection
686 throws java.lang.IndexOutOfBoundsException {
687 // check bounds for index
688 if (index < 0 || index >= this._seqList.size()) {
689 throw new IndexOutOfBoundsException("setSeq: Index value '" + index + "' not in range [0.." + (this._seqList.size() - 1) + "]");
692 this._seqList.set(index, new java.lang.Integer(vSeq));
701 final int[] vSeqArray) {
705 for (int i = 0; i < vSeqArray.length; i++) {
706 this._seqList.add(new java.lang.Integer(vSeqArray[i]));
711 * Sets the value of field 'start'.
713 * @param start the value of field 'start'.
715 public void setStart(
718 this._has_start = true;
725 * @throws org.exolab.castor.xml.MarshalException if object is
726 * null or if any SAXException is thrown during marshaling
727 * @throws org.exolab.castor.xml.ValidationException if this
728 * object is an invalid instance according to the schema
729 * @return the unmarshaled jalview.binding.JGroup
731 public static jalview.binding.JGroup unmarshal(
732 final java.io.Reader reader)
733 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
734 return (jalview.binding.JGroup) Unmarshaller.unmarshal(jalview.binding.JGroup.class, reader);
740 * @throws org.exolab.castor.xml.ValidationException if this
741 * object is an invalid instance according to the schema
743 public void validate(
745 throws org.exolab.castor.xml.ValidationException {
746 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
747 validator.validate(this);