git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'Jalview-JS/develop' of https://source.jalview.org/git/jalview.git into...
[jalview.git]
/
src
/
jalview
/
datamodel
/
AlignmentOrder.java
diff --git
a/src/jalview/datamodel/AlignmentOrder.java
b/src/jalview/datamodel/AlignmentOrder.java
index
7012c76
..
6d09145
100755
(executable)
--- a/
src/jalview/datamodel/AlignmentOrder.java
+++ b/
src/jalview/datamodel/AlignmentOrder.java
@@
-1,6
+1,6
@@
/*
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2b1)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
*
* This file is part of Jalview.
*
@@
-20,7
+20,9
@@
*/
package jalview.datamodel;
*/
package jalview.datamodel;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
public class AlignmentOrder
{
public class AlignmentOrder
{
@@
-51,7
+53,7
@@
public class AlignmentOrder
private String Name;
private String Name;
- private Vector Order = null;
+ private List<SequenceI> Order = null;
/**
* Creates a new AlignmentOrder object.
/**
* Creates a new AlignmentOrder object.
@@
-64,9
+66,8
@@
public class AlignmentOrder
* AlignmentOrder
*
* @param anOrder
* AlignmentOrder
*
* @param anOrder
- * Vector
*/
*/
- public AlignmentOrder(Vector anOrder)
+ public AlignmentOrder(List<SequenceI> anOrder)
{
Order = anOrder;
}
{
Order = anOrder;
}
@@
-79,11
+80,11
@@
public class AlignmentOrder
*/
public AlignmentOrder(AlignmentI orderFrom)
{
*/
public AlignmentOrder(AlignmentI orderFrom)
{
- Order = new Vector();
+ Order = new ArrayList<SequenceI>();
- for (int i = 0, ns = orderFrom.getHeight(); i < ns; i++)
+ for (SequenceI seq : orderFrom.getSequences())
{
{
- Order.addElement(orderFrom.getSequenceAt(i));
+ Order.add(seq);
}
}
}
}
@@
-95,12
+96,7
@@
public class AlignmentOrder
*/
public AlignmentOrder(SequenceI[] orderFrom)
{
*/
public AlignmentOrder(SequenceI[] orderFrom)
{
- Order = new Vector();
-
- for (int i = 0, ns = orderFrom.length; i < ns; i++)
- {
- Order.addElement(orderFrom[i]);
- }
+ Order = new ArrayList<SequenceI>(Arrays.asList(orderFrom));
}
/**
}
/**
@@
-151,7
+147,7
@@
public class AlignmentOrder
* @param Order
* DOCUMENT ME!
*/
* @param Order
* DOCUMENT ME!
*/
- public void setOrder(Vector Order)
+ public void setOrder(List<SequenceI> Order)
{
this.Order = Order;
}
{
this.Order = Order;
}
@@
-161,7
+157,7
@@
public class AlignmentOrder
*
* @return DOCUMENT ME!
*/
*
* @return DOCUMENT ME!
*/
- public Vector getOrder()
+ public List<SequenceI> getOrder()
{
return Order;
}
{
return Order;
}
@@
-178,7
+174,7
@@
public class AlignmentOrder
int found = Order.indexOf(oldref);
if (found > -1)
{
int found = Order.indexOf(oldref);
if (found > -1)
{
- Order.setElementAt(newref, found);
+ Order.set(found, newref);
}
return found > -1;
}
}
return found > -1;
}
@@
-189,9
+185,14
@@
public class AlignmentOrder
* @param o
* @return true if o orders the same sequenceI objects in the same way
*/
* @param o
* @return true if o orders the same sequenceI objects in the same way
*/
- public boolean equals(AlignmentOrder o)
+ @Override
+ public boolean equals(Object o)
{
{
- return equals(o, true);
+ if (o == null || !(o instanceof AlignmentOrder))
+ {
+ return false;
+ }
+ return equals((AlignmentOrder) o, true);
}
/**
}
/**
@@
-217,13
+218,14
@@
public class AlignmentOrder
{
if (!identity)
{
{
if (!identity)
{
- throw new Error("Weak sequenceI equivalence not yet implemented.");
+ throw new Error(
+ "Weak sequenceI equivalence not yet implemented.");
}
else
{
for (int i = 0, j = o.Order.size(); i < j; i++)
{
}
else
{
for (int i = 0, j = o.Order.size(); i < j; i++)
{
- if (Order.elementAt(i) != o.Order.elementAt(i))
+ if (Order.get(i) != o.Order.get(i))
{
return false;
}
{
return false;
}
@@
-271,7
+273,7
@@
public class AlignmentOrder
}
if (Order != null && o.Order != null)
{
}
if (Order != null && o.Order != null)
{
- Vector c, s;
+ List<SequenceI> c, s;
if (o.Order.size() > Order.size())
{
c = o.Order;
if (o.Order.size() > Order.size())
{
c = o.Order;
@@
-284,7
+286,8
@@
public class AlignmentOrder
}
if (!identity)
{
}
if (!identity)
{
- throw new Error("Weak sequenceI equivalence not yet implemented.");
+ throw new Error(
+ "Weak sequenceI equivalence not yet implemented.");
}
else
{
}
else
{
@@
-292,7
+295,7
@@
public class AlignmentOrder
int last = -1;
for (int i = 0, j = s.size(); i < j; i++)
{
int last = -1;
for (int i = 0, j = s.size(); i < j; i++)
{
- int pos = c.indexOf(s.elementAt(i)); // JBPNote - optimize by
+ int pos = c.indexOf(s.get(i)); // JBPNote - optimize by
// incremental position search
if (pos > last)
{
// incremental position search
if (pos > last)
{