2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
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
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.binding;
23 //---------------------------------/
24 //- Imported classes and packages -/
25 //---------------------------------/
27 import org.exolab.castor.xml.Marshaller;
28 import org.exolab.castor.xml.Unmarshaller;
33 * @version $Revision$ $Date$
35 public class JGroup implements java.io.Serializable
38 // --------------------------/
39 // - Class/Member Variables -/
40 // --------------------------/
48 * keeps track of state for field: _start
50 private boolean _has_start;
58 * keeps track of state for field: _end
60 private boolean _has_end;
65 private java.lang.String _name;
70 private java.lang.String _colour;
73 * Field _consThreshold.
75 private int _consThreshold;
78 * keeps track of state for field: _consThreshold
80 private boolean _has_consThreshold;
83 * Field _pidThreshold.
85 private int _pidThreshold;
88 * keeps track of state for field: _pidThreshold
90 private boolean _has_pidThreshold;
93 * Field _outlineColour.
95 private int _outlineColour;
98 * keeps track of state for field: _outlineColour
100 private boolean _has_outlineColour;
103 * Field _displayBoxes.
105 private boolean _displayBoxes;
108 * keeps track of state for field: _displayBoxes
110 private boolean _has_displayBoxes;
113 * Field _displayText.
115 private boolean _displayText;
118 * keeps track of state for field: _displayText
120 private boolean _has_displayText;
125 private boolean _colourText;
128 * keeps track of state for field: _colourText
130 private boolean _has_colourText;
135 private java.util.Vector _seqList;
144 this._seqList = new java.util.Vector();
155 * @throws java.lang.IndexOutOfBoundsException
156 * if the index given is outside the bounds of the collection
158 public void addSeq(final int vSeq)
159 throws java.lang.IndexOutOfBoundsException
161 this._seqList.addElement(new java.lang.Integer(vSeq));
169 * @throws java.lang.IndexOutOfBoundsException
170 * if the index given is outside the bounds of the collection
172 public void addSeq(final int index, final int vSeq)
173 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
339 * if the index given is outside the bounds of the collection
340 * @return the value of the int at the given index
342 public int getSeq(final int index)
343 throws java.lang.IndexOutOfBoundsException
345 // check bounds for index
346 if (index < 0 || index >= this._seqList.size())
348 throw new IndexOutOfBoundsException("getSeq: Index value '" + index
349 + "' not in range [0.." + (this._seqList.size() - 1) + "]");
352 return ((java.lang.Integer) _seqList.get(index)).intValue();
356 * Method getSeq.Returns the contents of the collection in an Array.
358 * @return this collection as an Array
360 public int[] getSeq()
362 int size = this._seqList.size();
363 int[] array = new int[size];
364 java.util.Iterator iter = _seqList.iterator();
365 for (int index = 0; index < size; index++)
367 array[index] = ((java.lang.Integer) iter.next()).intValue();
373 * Method getSeqCount.
375 * @return the size of this collection
377 public int getSeqCount()
379 return this._seqList.size();
383 * Returns the value of field 'start'.
385 * @return the value of field 'Start'.
387 public int getStart()
393 * Method hasColourText.
395 * @return true if at least one ColourText has been added
397 public boolean hasColourText()
399 return this._has_colourText;
403 * Method hasConsThreshold.
405 * @return true if at least one ConsThreshold has been added
407 public boolean hasConsThreshold()
409 return this._has_consThreshold;
413 * Method hasDisplayBoxes.
415 * @return true if at least one DisplayBoxes has been added
417 public boolean hasDisplayBoxes()
419 return this._has_displayBoxes;
423 * Method hasDisplayText.
425 * @return true if at least one DisplayText has been added
427 public boolean hasDisplayText()
429 return this._has_displayText;
435 * @return true if at least one End has been added
437 public boolean hasEnd()
439 return this._has_end;
443 * Method hasOutlineColour.
445 * @return true if at least one OutlineColour has been added
447 public boolean hasOutlineColour()
449 return this._has_outlineColour;
453 * Method hasPidThreshold.
455 * @return true if at least one PidThreshold has been added
457 public boolean hasPidThreshold()
459 return this._has_pidThreshold;
465 * @return true if at least one Start has been added
467 public boolean hasStart()
469 return this._has_start;
473 * Returns the value of field 'colourText'.
475 * @return the value of field 'ColourText'.
477 public boolean isColourText()
479 return this._colourText;
483 * Returns the value of field 'displayBoxes'.
485 * @return the value of field 'DisplayBoxes'.
487 public boolean isDisplayBoxes()
489 return this._displayBoxes;
493 * Returns the value of field 'displayText'.
495 * @return the value of field 'DisplayText'.
497 public boolean isDisplayText()
499 return this._displayText;
505 * @return true if this object is valid according to the schema
507 public boolean isValid()
512 } catch (org.exolab.castor.xml.ValidationException vex)
523 * @throws org.exolab.castor.xml.MarshalException
524 * if object is null or if any SAXException is thrown during
526 * @throws org.exolab.castor.xml.ValidationException
527 * if this object is an invalid instance according to the schema
529 public void marshal(final java.io.Writer out)
530 throws org.exolab.castor.xml.MarshalException,
531 org.exolab.castor.xml.ValidationException
533 Marshaller.marshal(this, out);
540 * @throws java.io.IOException
541 * if an IOException occurs during marshaling
542 * @throws org.exolab.castor.xml.ValidationException
543 * if this object is an invalid instance according to the schema
544 * @throws org.exolab.castor.xml.MarshalException
545 * if object is null or if any SAXException is thrown during
548 public void marshal(final org.xml.sax.ContentHandler handler)
549 throws java.io.IOException,
550 org.exolab.castor.xml.MarshalException,
551 org.exolab.castor.xml.ValidationException
553 Marshaller.marshal(this, handler);
558 public void removeAllSeq()
560 this._seqList.clear();
567 * @return true if the object was removed from the collection.
569 public boolean removeSeq(final int vSeq)
571 boolean removed = _seqList.remove(new java.lang.Integer(vSeq));
576 * Method removeSeqAt.
579 * @return the element removed from the collection
581 public int removeSeqAt(final int index)
583 java.lang.Object obj = this._seqList.remove(index);
584 return ((java.lang.Integer) obj).intValue();
588 * Sets the value of field 'colour'.
591 * the value of field 'colour'.
593 public void setColour(final java.lang.String colour)
595 this._colour = colour;
599 * Sets the value of field 'colourText'.
602 * the value of field 'colourText'.
604 public void setColourText(final boolean colourText)
606 this._colourText = colourText;
607 this._has_colourText = true;
611 * Sets the value of field 'consThreshold'.
613 * @param consThreshold
614 * the value of field 'consThreshold'.
616 public void setConsThreshold(final int consThreshold)
618 this._consThreshold = consThreshold;
619 this._has_consThreshold = true;
623 * Sets the value of field 'displayBoxes'.
625 * @param displayBoxes
626 * the value of field 'displayBoxes'.
628 public void setDisplayBoxes(final boolean displayBoxes)
630 this._displayBoxes = displayBoxes;
631 this._has_displayBoxes = true;
635 * Sets the value of field 'displayText'.
638 * the value of field 'displayText'.
640 public void setDisplayText(final boolean displayText)
642 this._displayText = displayText;
643 this._has_displayText = true;
647 * Sets the value of field 'end'.
650 * the value of field 'end'.
652 public void setEnd(final int end)
655 this._has_end = true;
659 * Sets the value of field 'name'.
662 * the value of field 'name'.
664 public void setName(final java.lang.String name)
670 * Sets the value of field 'outlineColour'.
672 * @param outlineColour
673 * the value of field 'outlineColour'.
675 public void setOutlineColour(final int outlineColour)
677 this._outlineColour = outlineColour;
678 this._has_outlineColour = true;
682 * Sets the value of field 'pidThreshold'.
684 * @param pidThreshold
685 * the value of field 'pidThreshold'.
687 public void setPidThreshold(final int pidThreshold)
689 this._pidThreshold = pidThreshold;
690 this._has_pidThreshold = true;
698 * @throws java.lang.IndexOutOfBoundsException
699 * if the index given is outside the bounds of the collection
701 public void setSeq(final int index, final int vSeq)
702 throws java.lang.IndexOutOfBoundsException
704 // check bounds for index
705 if (index < 0 || index >= this._seqList.size())
707 throw new IndexOutOfBoundsException("setSeq: Index value '" + index
708 + "' not in range [0.." + (this._seqList.size() - 1) + "]");
711 this._seqList.set(index, new java.lang.Integer(vSeq));
719 public void setSeq(final int[] vSeqArray)
724 for (int i = 0; i < vSeqArray.length; i++)
726 this._seqList.add(new java.lang.Integer(vSeqArray[i]));
731 * Sets the value of field 'start'.
734 * the value of field 'start'.
736 public void setStart(final int start)
739 this._has_start = true;
746 * @throws org.exolab.castor.xml.MarshalException
747 * if object is null or if any SAXException is thrown during
749 * @throws org.exolab.castor.xml.ValidationException
750 * if this object is an invalid instance according to the schema
751 * @return the unmarshaled jalview.binding.JGroup
753 public static jalview.binding.JGroup unmarshal(final java.io.Reader reader)
754 throws org.exolab.castor.xml.MarshalException,
755 org.exolab.castor.xml.ValidationException
757 return (jalview.binding.JGroup) Unmarshaller.unmarshal(
758 jalview.binding.JGroup.class, reader);
764 * @throws org.exolab.castor.xml.ValidationException
765 * if this object is an invalid instance according to the schema
767 public void validate() throws org.exolab.castor.xml.ValidationException
769 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
770 validator.validate(this);