git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cc56c66
)
JAL-2788 possible adjustments to sequence accesses
author
kiramt
<k.mourao@dundee.ac.uk>
Mon, 5 Feb 2018 13:41:52 +0000
(13:41 +0000)
committer
kiramt
<k.mourao@dundee.ac.uk>
Mon, 5 Feb 2018 13:41:52 +0000
(13:41 +0000)
src/jalview/datamodel/Alignment.java
patch
|
blob
|
history
diff --git
a/src/jalview/datamodel/Alignment.java
b/src/jalview/datamodel/Alignment.java
index
baa8e83
..
c564618
100755
(executable)
--- a/
src/jalview/datamodel/Alignment.java
+++ b/
src/jalview/datamodel/Alignment.java
@@
-49,7
+49,7
@@
public class Alignment implements AlignmentI
{
private Alignment dataset;
{
private Alignment dataset;
- protected List<SequenceI> sequences;
+ private List<SequenceI> sequences;
protected List<SequenceGroup> groups;
protected List<SequenceGroup> groups;
@@
-191,10
+191,12
@@
public class Alignment implements AlignmentI
@Override
public SequenceI getSequenceAt(int i)
{
@Override
public SequenceI getSequenceAt(int i)
{
- // don't need to synchronise here as sequences is a synchronizedList
- if (i > -1 && i < sequences.size())
+ synchronized (sequences)
{
{
- return sequences.get(i);
+ if (i > -1 && i < sequences.size())
+ {
+ return sequences.get(i);
+ }
}
return null;
}
return null;
@@
-705,7
+707,7
@@
public class Alignment implements AlignmentI
public int getWidth()
{
int maxLength = -1;
public int getWidth()
{
int maxLength = -1;
-
+
for (int i = 0; i < sequences.size(); i++)
{
if (getSequenceAt(i).getLength() > maxLength)
for (int i = 0; i < sequences.size(); i++)
{
if (getSequenceAt(i).getLength() > maxLength)
@@
-713,9
+715,34
@@
public class Alignment implements AlignmentI
maxLength = getSequenceAt(i).getLength();
}
}
maxLength = getSequenceAt(i).getLength();
}
}
-
+
return maxLength;
}
return maxLength;
}
+ /*
+ @Override
+ public int getWidth()
+ {
+ final Wrapper temp = new Wrapper();
+
+ forEachSequence(new Consumer<SequenceI>()
+ {
+ @Override
+ public void accept(SequenceI s)
+ {
+ if (s.getLength() > temp.inner)
+ {
+ temp.inner = s.getLength();
+ }
+ }
+ }, 0, sequences.size() - 1);
+
+ return temp.inner;
+ }
+
+ public static class Wrapper
+ {
+ public int inner;
+ }*/
/**
* DOCUMENT ME!
/**
* DOCUMENT ME!
@@
-1917,7
+1944,10
@@
public class Alignment implements AlignmentI
@Override
public void forEachSequence(Consumer<SequenceI> c, int start, int end)
{
@Override
public void forEachSequence(Consumer<SequenceI> c, int start, int end)
{
- sequences.subList(start, end).forEach(c);
+ synchronized (sequences)
+ {
+ sequences.subList(start, end).forEach(c);
+ }
}
}
}
}