GPL license added
[jalview.git] / src / jalview / datamodel / SuperGroup.java
1 /*\r
2 * Jalview - A Sequence Alignment Editor and Viewer\r
3 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
4 *\r
5 * This program is free software; you can redistribute it and/or\r
6 * modify it under the terms of the GNU General Public License\r
7 * as published by the Free Software Foundation; either version 2\r
8 * of the License, or (at your option) any later version.\r
9 *\r
10 * This program is distributed in the hope that it will be useful,\r
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13 * GNU General Public License for more details.\r
14 *\r
15 * You should have received a copy of the GNU General Public License\r
16 * along with this program; if not, write to the Free Software\r
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
18 */\r
19 \r
20 package jalview.datamodel;\r
21 \r
22 import jalview.schemes.*;\r
23 import jalview.analysis.*;\r
24 import jalview.datamodel.*;\r
25 import java.util.*;\r
26 \r
27 public class SuperGroup\r
28 {\r
29   String groupName;\r
30   boolean displayBoxes;\r
31   boolean displayText;\r
32   boolean colourText;\r
33   public ColourSchemeI cs;\r
34   Vector sequenceGroups = new Vector();\r
35 \r
36   public SuperGroup()\r
37   {\r
38     groupName = "Super group";\r
39     this.displayBoxes = true;\r
40     this.displayText = true;\r
41     this.colourText = false;\r
42     cs = null;\r
43   }\r
44 \r
45 \r
46   public SuperGroup(String groupName, ColourSchemeI scheme,\r
47                        boolean displayBoxes, boolean displayText,\r
48                        boolean colourText)\r
49      {\r
50        this.groupName = groupName;\r
51        this.displayBoxes = displayBoxes;\r
52        this.displayText = displayText;\r
53        this.colourText = colourText;\r
54        this.cs = scheme;\r
55      }\r
56 \r
57   public String getName()\r
58   {\r
59     return groupName;\r
60   }\r
61 \r
62   public void setName(String name)\r
63   {\r
64     groupName = name;\r
65   }\r
66 \r
67 \r
68   public void addGroup(SequenceGroup sg)\r
69   {\r
70     if(!sequenceGroups.contains(sg))\r
71       sequenceGroups.addElement(sg);\r
72   }\r
73 \r
74   public void addOrRemove(SequenceGroup sg)\r
75   {\r
76     if(sequenceGroups.contains(sg))\r
77       deleteGroup(sg);\r
78     else\r
79       addGroup(sg);\r
80   }\r
81 \r
82   public void deleteGroup(SequenceGroup sg)\r
83   {\r
84     sequenceGroups.removeElement(sg);\r
85   }\r
86 \r
87   public void setSuperGroupProperties(SequenceGroup sg)\r
88   {\r
89     cs = sg.cs;\r
90     colourText = sg.colourText;\r
91     displayText = sg.displayText;\r
92     displayBoxes = sg.displayBoxes;\r
93 \r
94     for(int i=0; i<sequenceGroups.size(); i++)\r
95     {\r
96       SequenceGroup temp = (SequenceGroup)sequenceGroups.elementAt(i);\r
97       temp.cs = sg.cs;\r
98       temp.colourText = sg.colourText;\r
99       temp.displayText = sg.displayText;\r
100       temp.displayBoxes = sg.displayBoxes;\r
101     }\r
102   }\r
103 \r
104 \r
105   public int getSize()\r
106   {\r
107     return sequenceGroups.size();\r
108   }\r
109 \r
110   public SequenceGroup getGroupeAt(int i)\r
111   {\r
112     return (SequenceGroup) sequenceGroups.elementAt(i);\r
113   }\r
114 }\r