{
private Alignment dataset;
- protected List<SequenceI> sequences;
+ private List<SequenceI> sequences;
protected List<SequenceGroup> groups;
@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;
public int getWidth()
{
int maxLength = -1;
-
+
for (int i = 0; i < sequences.size(); i++)
{
if (getSequenceAt(i).getLength() > maxLength)
maxLength = getSequenceAt(i).getLength();
}
}
-
+
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!
@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);
+ }
}
}