2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5.1)
3 * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
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/>.
18 package jalview.binding;
20 //---------------------------------/
21 //- Imported classes and packages -/
22 //---------------------------------/
24 import org.exolab.castor.xml.Marshaller;
25 import org.exolab.castor.xml.Unmarshaller;
30 * @version $Revision$ $Date$
32 public class JGroup implements java.io.Serializable
35 // --------------------------/
36 // - Class/Member Variables -/
37 // --------------------------/
45 * keeps track of state for field: _start
47 private boolean _has_start;
55 * keeps track of state for field: _end
57 private boolean _has_end;
62 private java.lang.String _name;
67 private java.lang.String _colour;
70 * Field _consThreshold.
72 private int _consThreshold;
75 * keeps track of state for field: _consThreshold
77 private boolean _has_consThreshold;
80 * Field _pidThreshold.
82 private int _pidThreshold;
85 * keeps track of state for field: _pidThreshold
87 private boolean _has_pidThreshold;
90 * Field _outlineColour.
92 private int _outlineColour;
95 * keeps track of state for field: _outlineColour
97 private boolean _has_outlineColour;
100 * Field _displayBoxes.
102 private boolean _displayBoxes;
105 * keeps track of state for field: _displayBoxes
107 private boolean _has_displayBoxes;
110 * Field _displayText.
112 private boolean _displayText;
115 * keeps track of state for field: _displayText
117 private boolean _has_displayText;
122 private boolean _colourText;
125 * keeps track of state for field: _colourText
127 private boolean _has_colourText;
132 private java.util.Vector _seqList;
141 this._seqList = new java.util.Vector();
152 * @throws java.lang.IndexOutOfBoundsException
153 * if the index given is outside the bounds of the collection
155 public void addSeq(final int vSeq)
156 throws java.lang.IndexOutOfBoundsException
158 this._seqList.addElement(new java.lang.Integer(vSeq));
166 * @throws java.lang.IndexOutOfBoundsException
167 * if the index given is outside the bounds of the collection
169 public void addSeq(final int index, final int vSeq)
170 throws java.lang.IndexOutOfBoundsException
172 this._seqList.add(index, new java.lang.Integer(vSeq));
177 public void deleteColourText()
179 this._has_colourText = false;
184 public void deleteConsThreshold()
186 this._has_consThreshold = false;
191 public void deleteDisplayBoxes()
193 this._has_displayBoxes = false;
198 public void deleteDisplayText()
200 this._has_displayText = false;
205 public void deleteEnd()
207 this._has_end = false;
212 public void deleteOutlineColour()
214 this._has_outlineColour = false;
219 public void deletePidThreshold()
221 this._has_pidThreshold = false;
226 public void deleteStart()
228 this._has_start = false;
232 * Method enumerateSeq.
234 * @return an Enumeration over all int elements
236 public java.util.Enumeration enumerateSeq()
238 return this._seqList.elements();
242 * Returns the value of field 'colour'.
244 * @return the value of field 'Colour'.
246 public java.lang.String getColour()
252 * Returns the value of field 'colourText'.
254 * @return the value of field 'ColourText'.
256 public boolean getColourText()
258 return this._colourText;
262 * Returns the value of field 'consThreshold'.
264 * @return the value of field 'ConsThreshold'.
266 public int getConsThreshold()
268 return this._consThreshold;
272 * Returns the value of field 'displayBoxes'.
274 * @return the value of field 'DisplayBoxes'.
276 public boolean getDisplayBoxes()
278 return this._displayBoxes;
282 * Returns the value of field 'displayText'.
284 * @return the value of field 'DisplayText'.
286 public boolean getDisplayText()
288 return this._displayText;
292 * Returns the value of field 'end'.
294 * @return the value of field 'End'.
302 * Returns the value of field 'name'.
304 * @return the value of field 'Name'.
306 public java.lang.String getName()
312 * Returns the value of field 'outlineColour'.
314 * @return the value of field 'OutlineColour'.
316 public int getOutlineColour()
318 return this._outlineColour;
322 * Returns the value of field 'pidThreshold'.
324 * @return the value of field 'PidThreshold'.
326 public int getPidThreshold()
328 return this._pidThreshold;
335 * @throws java.lang.IndexOutOfBoundsException
336 * if the index given is outside the bounds of the collection
337 * @return the value of the int at the given index
339 public int getSeq(final int index)
340 throws java.lang.IndexOutOfBoundsException
342 // check bounds for index
343 if (index < 0 || index >= this._seqList.size())
345 throw new IndexOutOfBoundsException("getSeq: Index value '" + index
346 + "' not in range [0.." + (this._seqList.size() - 1) + "]");
349 return ((java.lang.Integer) _seqList.get(index)).intValue();
353 * Method getSeq.Returns the contents of the collection in an Array.
355 * @return this collection as an Array
357 public int[] getSeq()
359 int size = this._seqList.size();
360 int[] array = new int[size];
361 java.util.Iterator iter = _seqList.iterator();
362 for (int index = 0; index < size; index++)
364 array[index] = ((java.lang.Integer) iter.next()).intValue();
370 * Method getSeqCount.
372 * @return the size of this collection
374 public int getSeqCount()
376 return this._seqList.size();
380 * Returns the value of field 'start'.
382 * @return the value of field 'Start'.
384 public int getStart()
390 * Method hasColourText.
392 * @return true if at least one ColourText has been added
394 public boolean hasColourText()
396 return this._has_colourText;
400 * Method hasConsThreshold.
402 * @return true if at least one ConsThreshold has been added
404 public boolean hasConsThreshold()
406 return this._has_consThreshold;
410 * Method hasDisplayBoxes.
412 * @return true if at least one DisplayBoxes has been added
414 public boolean hasDisplayBoxes()
416 return this._has_displayBoxes;
420 * Method hasDisplayText.
422 * @return true if at least one DisplayText has been added
424 public boolean hasDisplayText()
426 return this._has_displayText;
432 * @return true if at least one End has been added
434 public boolean hasEnd()
436 return this._has_end;
440 * Method hasOutlineColour.
442 * @return true if at least one OutlineColour has been added
444 public boolean hasOutlineColour()
446 return this._has_outlineColour;
450 * Method hasPidThreshold.
452 * @return true if at least one PidThreshold has been added
454 public boolean hasPidThreshold()
456 return this._has_pidThreshold;
462 * @return true if at least one Start has been added
464 public boolean hasStart()
466 return this._has_start;
470 * Returns the value of field 'colourText'.
472 * @return the value of field 'ColourText'.
474 public boolean isColourText()
476 return this._colourText;
480 * Returns the value of field 'displayBoxes'.
482 * @return the value of field 'DisplayBoxes'.
484 public boolean isDisplayBoxes()
486 return this._displayBoxes;
490 * Returns the value of field 'displayText'.
492 * @return the value of field 'DisplayText'.
494 public boolean isDisplayText()
496 return this._displayText;
502 * @return true if this object is valid according to the schema
504 public boolean isValid()
509 } catch (org.exolab.castor.xml.ValidationException vex)
520 * @throws org.exolab.castor.xml.MarshalException
521 * if object is null or if any SAXException is thrown during
523 * @throws org.exolab.castor.xml.ValidationException
524 * if this object is an invalid instance according to the schema
526 public void marshal(final java.io.Writer out)
527 throws org.exolab.castor.xml.MarshalException,
528 org.exolab.castor.xml.ValidationException
530 Marshaller.marshal(this, out);
537 * @throws java.io.IOException
538 * if an IOException occurs during marshaling
539 * @throws org.exolab.castor.xml.ValidationException
540 * if this object is an invalid instance according to the schema
541 * @throws org.exolab.castor.xml.MarshalException
542 * if object is null or if any SAXException is thrown during
545 public void marshal(final org.xml.sax.ContentHandler handler)
546 throws java.io.IOException,
547 org.exolab.castor.xml.MarshalException,
548 org.exolab.castor.xml.ValidationException
550 Marshaller.marshal(this, handler);
555 public void removeAllSeq()
557 this._seqList.clear();
564 * @return true if the object was removed from the collection.
566 public boolean removeSeq(final int vSeq)
568 boolean removed = _seqList.remove(new java.lang.Integer(vSeq));
573 * Method removeSeqAt.
576 * @return the element removed from the collection
578 public int removeSeqAt(final int index)
580 java.lang.Object obj = this._seqList.remove(index);
581 return ((java.lang.Integer) obj).intValue();
585 * Sets the value of field 'colour'.
588 * the value of field 'colour'.
590 public void setColour(final java.lang.String colour)
592 this._colour = colour;
596 * Sets the value of field 'colourText'.
599 * the value of field 'colourText'.
601 public void setColourText(final boolean colourText)
603 this._colourText = colourText;
604 this._has_colourText = true;
608 * Sets the value of field 'consThreshold'.
610 * @param consThreshold
611 * the value of field 'consThreshold'.
613 public void setConsThreshold(final int consThreshold)
615 this._consThreshold = consThreshold;
616 this._has_consThreshold = true;
620 * Sets the value of field 'displayBoxes'.
622 * @param displayBoxes
623 * the value of field 'displayBoxes'.
625 public void setDisplayBoxes(final boolean displayBoxes)
627 this._displayBoxes = displayBoxes;
628 this._has_displayBoxes = true;
632 * Sets the value of field 'displayText'.
635 * the value of field 'displayText'.
637 public void setDisplayText(final boolean displayText)
639 this._displayText = displayText;
640 this._has_displayText = true;
644 * Sets the value of field 'end'.
647 * the value of field 'end'.
649 public void setEnd(final int end)
652 this._has_end = true;
656 * Sets the value of field 'name'.
659 * the value of field 'name'.
661 public void setName(final java.lang.String name)
667 * Sets the value of field 'outlineColour'.
669 * @param outlineColour
670 * the value of field 'outlineColour'.
672 public void setOutlineColour(final int outlineColour)
674 this._outlineColour = outlineColour;
675 this._has_outlineColour = true;
679 * Sets the value of field 'pidThreshold'.
681 * @param pidThreshold
682 * the value of field 'pidThreshold'.
684 public void setPidThreshold(final int pidThreshold)
686 this._pidThreshold = pidThreshold;
687 this._has_pidThreshold = true;
695 * @throws java.lang.IndexOutOfBoundsException
696 * if the index given is outside the bounds of the collection
698 public void setSeq(final int index, final int vSeq)
699 throws java.lang.IndexOutOfBoundsException
701 // check bounds for index
702 if (index < 0 || index >= this._seqList.size())
704 throw new IndexOutOfBoundsException("setSeq: Index value '" + index
705 + "' not in range [0.." + (this._seqList.size() - 1) + "]");
708 this._seqList.set(index, new java.lang.Integer(vSeq));
716 public void setSeq(final int[] vSeqArray)
721 for (int i = 0; i < vSeqArray.length; i++)
723 this._seqList.add(new java.lang.Integer(vSeqArray[i]));
728 * Sets the value of field 'start'.
731 * the value of field 'start'.
733 public void setStart(final int start)
736 this._has_start = true;
743 * @throws org.exolab.castor.xml.MarshalException
744 * if object is null or if any SAXException is thrown during
746 * @throws org.exolab.castor.xml.ValidationException
747 * if this object is an invalid instance according to the schema
748 * @return the unmarshaled jalview.binding.JGroup
750 public static jalview.binding.JGroup unmarshal(final java.io.Reader reader)
751 throws org.exolab.castor.xml.MarshalException,
752 org.exolab.castor.xml.ValidationException
754 return (jalview.binding.JGroup) Unmarshaller.unmarshal(
755 jalview.binding.JGroup.class, reader);
761 * @throws org.exolab.castor.xml.ValidationException
762 * if this object is an invalid instance according to the schema
764 public void validate() throws org.exolab.castor.xml.ValidationException
766 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
767 validator.validate(this);