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