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
JAL-3680 merged description of individual cursor key actions
[jalview.git]
/
src
/
jalview
/
datamodel
/
Alignment.java
diff --git
a/src/jalview/datamodel/Alignment.java
b/src/jalview/datamodel/Alignment.java
index
3ba35b6
..
c4098e2
100755
(executable)
--- a/
src/jalview/datamodel/Alignment.java
+++ b/
src/jalview/datamodel/Alignment.java
@@
-47,7
+47,7
@@
import java.util.Vector;
* @author JimP
*
*/
* @author JimP
*
*/
-public class Alignment implements AlignmentI
+public class Alignment implements AlignmentI, AutoCloseable
{
private Alignment dataset;
{
private Alignment dataset;
@@
-195,6
+195,7
@@
public class Alignment implements AlignmentI
{
synchronized (sequences)
{
{
synchronized (sequences)
{
+
if (i > -1 && i < sequences.size())
{
return sequences.get(i);
if (i > -1 && i < sequences.size())
{
return sequences.get(i);
@@
-302,15
+303,20
@@
public class Alignment implements AlignmentI
}
@Override
}
@Override
- public void finalize() throws Throwable
+ public void close()
{
if (getDataset() != null)
{
{
if (getDataset() != null)
{
- getDataset().removeAlignmentRef();
+ try
+ {
+ getDataset().removeAlignmentRef();
+ } catch (Throwable e)
+ {
+ e.printStackTrace();
+ }
}
nullReferences();
}
nullReferences();
- super.finalize();
}
/**
}
/**
@@
-589,11
+595,12
@@
public class Alignment implements AlignmentI
int i = 0;
SequenceI sq = null;
String sqname = null;
int i = 0;
SequenceI sq = null;
String sqname = null;
+ int nseq = sequences.size();
if (startAfter != null)
{
// try to find the sequence in the alignment
boolean matched = false;
if (startAfter != null)
{
// try to find the sequence in the alignment
boolean matched = false;
- while (i < sequences.size())
+ while (i < nseq)
{
if (getSequenceAt(i++) == startAfter)
{
{
if (getSequenceAt(i++) == startAfter)
{
@@
-606,7
+613,7
@@
public class Alignment implements AlignmentI
i = 0;
}
}
i = 0;
}
}
- while (i < sequences.size())
+ while (i < nseq)
{
sq = getSequenceAt(i);
sqname = sq.getName();
{
sq = getSequenceAt(i);
sqname = sq.getName();
@@
-712,39
+719,21
@@
public class Alignment implements AlignmentI
for (int i = 0; i < sequences.size(); i++)
{
for (int i = 0; i < sequences.size(); i++)
{
- if (getSequenceAt(i).getLength() > maxLength)
- {
- maxLength = getSequenceAt(i).getLength();
- }
+ maxLength = Math.max(maxLength, getSequenceAt(i).getLength());
}
}
-
return maxLength;
}
return maxLength;
}
- /*
+
@Override
@Override
- public int getWidth()
+ public int getVisibleWidth()
{
{
- final Wrapper temp = new Wrapper();
-
- forEachSequence(new Consumer<SequenceI>()
+ int w = getWidth();
+ if (hiddenCols != null)
{
{
- @Override
- public void accept(SequenceI s)
- {
- if (s.getLength() > temp.inner)
- {
- temp.inner = s.getLength();
- }
- }
- }, 0, sequences.size() - 1);
-
- return temp.inner;
+ w -= hiddenCols.getSize();
+ }
+ return w;
}
}
-
- public static class Wrapper
- {
- public int inner;
- }*/
/**
* DOCUMENT ME!
/**
* DOCUMENT ME!
@@
-1206,7
+1195,8
@@
public class Alignment implements AlignmentI
int maxLength = -1;
SequenceI current;
int maxLength = -1;
SequenceI current;
- for (int i = 0; i < sequences.size(); i++)
+ int nseq = sequences.size();
+ for (int i = 0; i < nseq; i++)
{
current = getSequenceAt(i);
for (int j = current.getLength(); j > maxLength; j--)
{
current = getSequenceAt(i);
for (int j = current.getLength(); j > maxLength; j--)
@@
-1223,7
+1213,7
@@
public class Alignment implements AlignmentI
maxLength++;
int cLength;
maxLength++;
int cLength;
- for (int i = 0; i < sequences.size(); i++)
+ for (int i = 0; i < nseq; i++)
{
current = getSequenceAt(i);
cLength = current.getLength();
{
current = getSequenceAt(i);
cLength = current.getLength();
@@
-1922,9
+1912,12
@@
public class Alignment implements AlignmentI
}
@Override
}
@Override
- public void setHiddenColumns(HiddenColumns cols)
+ public boolean setHiddenColumns(HiddenColumns cols)
{
{
+ boolean changed = cols == null ? hiddenCols != null
+ : !cols.equals(hiddenCols);
hiddenCols = cols;
hiddenCols = cols;
+ return changed;
}
@Override
}
@Override