2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
3 * Copyright (C) 2014 The Jalview Authors
5 * This file is part of Jalview.
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.
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.
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 * The Jalview Authors are detailed in the 'AUTHORS' file.
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();
153 * @throws java.lang.IndexOutOfBoundsException
154 * if the index given is outside the bounds of the collection
156 public void addSeq(final int vSeq)
157 throws java.lang.IndexOutOfBoundsException
159 this._seqList.addElement(new java.lang.Integer(vSeq));
167 * @throws java.lang.IndexOutOfBoundsException
168 * if the index given is outside the bounds of the collection
170 public void addSeq(final int index, final int vSeq)
171 throws java.lang.IndexOutOfBoundsException
173 this._seqList.add(index, new java.lang.Integer(vSeq));
178 public void deleteColourText()
180 this._has_colourText = false;
185 public void deleteConsThreshold()
187 this._has_consThreshold = false;
192 public void deleteDisplayBoxes()
194 this._has_displayBoxes = false;
199 public void deleteDisplayText()
201 this._has_displayText = false;
206 public void deleteEnd()
208 this._has_end = false;
213 public void deleteOutlineColour()
215 this._has_outlineColour = false;
220 public void deletePidThreshold()
222 this._has_pidThreshold = false;
227 public void deleteStart()
229 this._has_start = false;
233 * Method enumerateSeq.
235 * @return an Enumeration over all int elements
237 public java.util.Enumeration enumerateSeq()
239 return this._seqList.elements();
243 * Returns the value of field 'colour'.
245 * @return the value of field 'Colour'.
247 public java.lang.String getColour()
253 * Returns the value of field 'colourText'.
255 * @return the value of field 'ColourText'.
257 public boolean getColourText()
259 return this._colourText;
263 * Returns the value of field 'consThreshold'.
265 * @return the value of field 'ConsThreshold'.
267 public int getConsThreshold()
269 return this._consThreshold;
273 * Returns the value of field 'displayBoxes'.
275 * @return the value of field 'DisplayBoxes'.
277 public boolean getDisplayBoxes()
279 return this._displayBoxes;
283 * Returns the value of field 'displayText'.
285 * @return the value of field 'DisplayText'.
287 public boolean getDisplayText()
289 return this._displayText;
293 * Returns the value of field 'end'.
295 * @return the value of field 'End'.
303 * Returns the value of field 'name'.
305 * @return the value of field 'Name'.
307 public java.lang.String getName()
313 * Returns the value of field 'outlineColour'.
315 * @return the value of field 'OutlineColour'.
317 public int getOutlineColour()
319 return this._outlineColour;
323 * Returns the value of field 'pidThreshold'.
325 * @return the value of field 'PidThreshold'.
327 public int getPidThreshold()
329 return this._pidThreshold;
336 * @throws java.lang.IndexOutOfBoundsException
337 * if the index given is outside the bounds of the collection
338 * @return the value of the int at the given index
340 public int getSeq(final int index)
341 throws java.lang.IndexOutOfBoundsException
343 // check bounds for index
344 if (index < 0 || index >= this._seqList.size())
346 throw new IndexOutOfBoundsException("getSeq: Index value '" + index
347 + "' 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 Array.
356 * @return this collection as an Array
358 public int[] getSeq()
360 int size = this._seqList.size();
361 int[] array = new int[size];
362 java.util.Iterator iter = _seqList.iterator();
363 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'.
385 public int getStart()
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()
510 } catch (org.exolab.castor.xml.ValidationException vex)
521 * @throws org.exolab.castor.xml.MarshalException
522 * if object is null or if any SAXException is thrown during
524 * @throws org.exolab.castor.xml.ValidationException
525 * if this object is an invalid instance according to the schema
527 public void marshal(final java.io.Writer out)
528 throws org.exolab.castor.xml.MarshalException,
529 org.exolab.castor.xml.ValidationException
531 Marshaller.marshal(this, out);
538 * @throws java.io.IOException
539 * if an IOException occurs during marshaling
540 * @throws org.exolab.castor.xml.ValidationException
541 * if this object is an invalid instance according to the schema
542 * @throws org.exolab.castor.xml.MarshalException
543 * if object is null or if any SAXException is thrown during
546 public void marshal(final org.xml.sax.ContentHandler handler)
547 throws java.io.IOException,
548 org.exolab.castor.xml.MarshalException,
549 org.exolab.castor.xml.ValidationException
551 Marshaller.marshal(this, handler);
556 public void removeAllSeq()
558 this._seqList.clear();
565 * @return true if the object was removed from the collection.
567 public boolean removeSeq(final int vSeq)
569 boolean removed = _seqList.remove(new java.lang.Integer(vSeq));
574 * Method removeSeqAt.
577 * @return the element removed from the collection
579 public int removeSeqAt(final int index)
581 java.lang.Object obj = this._seqList.remove(index);
582 return ((java.lang.Integer) obj).intValue();
586 * Sets the value of field 'colour'.
589 * the value of field 'colour'.
591 public void setColour(final java.lang.String colour)
593 this._colour = colour;
597 * Sets the value of field 'colourText'.
600 * the value of field 'colourText'.
602 public void setColourText(final boolean colourText)
604 this._colourText = colourText;
605 this._has_colourText = true;
609 * Sets the value of field 'consThreshold'.
611 * @param consThreshold
612 * the value of field 'consThreshold'.
614 public void setConsThreshold(final int consThreshold)
616 this._consThreshold = consThreshold;
617 this._has_consThreshold = true;
621 * Sets the value of field 'displayBoxes'.
623 * @param displayBoxes
624 * the value of field 'displayBoxes'.
626 public void setDisplayBoxes(final boolean displayBoxes)
628 this._displayBoxes = displayBoxes;
629 this._has_displayBoxes = true;
633 * Sets the value of field 'displayText'.
636 * the value of field 'displayText'.
638 public void setDisplayText(final boolean displayText)
640 this._displayText = displayText;
641 this._has_displayText = true;
645 * Sets the value of field 'end'.
648 * the value of field 'end'.
650 public void setEnd(final int end)
653 this._has_end = true;
657 * Sets the value of field 'name'.
660 * the value of field 'name'.
662 public void setName(final java.lang.String name)
668 * Sets the value of field 'outlineColour'.
670 * @param outlineColour
671 * the value of field 'outlineColour'.
673 public void setOutlineColour(final int outlineColour)
675 this._outlineColour = outlineColour;
676 this._has_outlineColour = true;
680 * Sets the value of field 'pidThreshold'.
682 * @param pidThreshold
683 * the value of field 'pidThreshold'.
685 public void setPidThreshold(final int pidThreshold)
687 this._pidThreshold = pidThreshold;
688 this._has_pidThreshold = true;
696 * @throws java.lang.IndexOutOfBoundsException
697 * if the index given is outside the bounds of the collection
699 public void setSeq(final int index, final int vSeq)
700 throws java.lang.IndexOutOfBoundsException
702 // check bounds for index
703 if (index < 0 || index >= this._seqList.size())
705 throw new IndexOutOfBoundsException("setSeq: Index value '" + index
706 + "' not in range [0.." + (this._seqList.size() - 1) + "]");
709 this._seqList.set(index, new java.lang.Integer(vSeq));
717 public void setSeq(final int[] vSeqArray)
722 for (int i = 0; i < vSeqArray.length; i++)
724 this._seqList.add(new java.lang.Integer(vSeqArray[i]));
729 * Sets the value of field 'start'.
732 * the value of field 'start'.
734 public void setStart(final int start)
737 this._has_start = true;
744 * @throws org.exolab.castor.xml.MarshalException
745 * if object is null or if any SAXException is thrown during
747 * @throws org.exolab.castor.xml.ValidationException
748 * if this object is an invalid instance according to the schema
749 * @return the unmarshaled jalview.binding.JGroup
751 public static jalview.binding.JGroup unmarshal(final java.io.Reader reader)
752 throws org.exolab.castor.xml.MarshalException,
753 org.exolab.castor.xml.ValidationException
755 return (jalview.binding.JGroup) Unmarshaller.unmarshal(
756 jalview.binding.JGroup.class, reader);
762 * @throws org.exolab.castor.xml.ValidationException
763 * if this object is an invalid instance according to the schema
765 public void validate() throws org.exolab.castor.xml.ValidationException
767 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
768 validator.validate(this);