GPL license added
[jalview.git] / src / jalview / datamodel / AlignmentOrder.java
1 /*
2 * Jalview - A Sequence Alignment Editor and Viewer
3 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
4 *
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.
9 *
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.
14 *
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
18 */
19
20 package jalview.datamodel;
21
22 import java.util.*;
23
24 /**
25  * <p>Title: </p>
26  *
27  * <p>Description: </p>
28  *
29  * <p>Copyright: Copyright (c) 2004</p>
30  *
31  * <p>Company: Dundee University</p>
32  *
33  * @author not attributable
34  * @version 1.0
35  */
36 public class AlignmentOrder
37 {
38   public AlignmentOrder()
39   {
40   }
41
42   public void setType(int Type)
43   {
44     this.Type = Type;
45   }
46
47   public int getType()
48   {
49     return Type;
50   }
51
52   public void setName(String Name)
53   {
54     this.Name = Name;
55   }
56
57   public String getName()
58   {
59     return Name;
60   }
61
62   public void setOrder(Vector Order)
63   {
64     this.Order = Order;
65   }
66
67   public Vector getOrder()
68   {
69
70     return Order;
71   }
72 // JBPNote : this method would return a vector containing all sequences in seqset
73 // with those also contained in order at the beginning of the vector in the order
74 // given by order. AlignmentSorter.vectorSubsetToArray already does this, but that method
75 // should be here for completeness.
76
77 /*  public Vector getOrder(AlignmentI seqset)
78   {
79     Vector perm = new Vector(seqset.getHeight());
80     for (i=0, o = 0, n=seqset.getHeight(), p = Order.size(); i<n; i++)
81       perm.setElement(i,...).
82     return Order;
83   }
84  */
85   public static final int FILE = 0;
86   public static final int MSA = 1;
87   public static final int USER = 2;
88
89   private int Type = 0;
90   private String Name;
91   private Vector Order = null;
92
93   /**
94    * AlignmentOrder
95    *
96    * @param anOrder Vector
97    */
98   public AlignmentOrder(Vector anOrder)
99   {
100     Order = anOrder;
101   }
102
103   /**
104    * AlignmentOrder
105    *
106    * @param orderFrom AlignmentI
107    */
108   public AlignmentOrder(AlignmentI orderFrom)
109   {
110     Order = new Vector();
111
112     for (int i=0,ns=orderFrom.getHeight(); i<ns; i++)
113       Order.addElement(orderFrom.getSequenceAt(i));
114   }
115   public AlignmentOrder(SequenceI[] orderFrom) {
116     Order = new Vector();
117     for (int i=0,ns=orderFrom.length; i<ns; i++)
118       Order.addElement(orderFrom[i]);
119   }
120
121
122
123   /**
124    * AlignmentOrder
125    *
126    * @param orderThis AlignmentI
127    * @param byThat AlignmentI
128    */
129   /* public AlignmentOrder(AlignmentI orderThis, AlignmentI byThat)
130   {
131     // Vector is an ordering of this alignment using the order of sequence objects in byThat,
132     // where ids and unaligned sequences must match
133
134   } */
135
136 }