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:
628abf4
)
JAL-3032 avoid assignments on the same line as synchronized
author
gmungoc
<g.m.carstairs@dundee.ac.uk>
Fri, 22 Jun 2018 15:06:37 +0000
(16:06 +0100)
committer
gmungoc
<g.m.carstairs@dundee.ac.uk>
Fri, 22 Jun 2018 15:06:37 +0000
(16:06 +0100)
src/jalview/analysis/AlignmentSorter.java
patch
|
blob
|
history
src/jalview/analysis/CrossRef.java
patch
|
blob
|
history
src/jalview/appletgui/PaintRefresher.java
patch
|
blob
|
history
src/jalview/commands/EditCommand.java
patch
|
blob
|
history
src/jalview/datamodel/HiddenSequences.java
patch
|
blob
|
history
src/jalview/gui/PaintRefresher.java
patch
|
blob
|
history
src/jalview/gui/SequenceFetcher.java
patch
|
blob
|
history
src/jalview/io/vamsas/Tree.java
patch
|
blob
|
history
src/jalview/ws/rest/params/SeqGroupIndexVector.java
patch
|
blob
|
history
diff --git
a/src/jalview/analysis/AlignmentSorter.java
b/src/jalview/analysis/AlignmentSorter.java
index
b5cefe0
..
7ecce49
100755
(executable)
--- a/
src/jalview/analysis/AlignmentSorter.java
+++ b/
src/jalview/analysis/AlignmentSorter.java
@@
-143,8
+143,8
@@
public class AlignmentSorter
}
// NOTE: DO NOT USE align.setSequenceAt() here - it will NOT work
}
// NOTE: DO NOT USE align.setSequenceAt() here - it will NOT work
- List<SequenceI> asq;
- synchronized (asq = align.getSequences())
+ List<SequenceI> asq = align.getSequences();
+ synchronized (asq)
{
for (int i = 0; i < len; i++)
{
{
for (int i = 0; i < len; i++)
{
@@
-179,10
+179,10
@@
public class AlignmentSorter
public static void setOrder(AlignmentI align, SequenceI[] seqs)
{
// NOTE: DO NOT USE align.setSequenceAt() here - it will NOT work
public static void setOrder(AlignmentI align, SequenceI[] seqs)
{
// NOTE: DO NOT USE align.setSequenceAt() here - it will NOT work
- List<SequenceI> algn;
- synchronized (algn = align.getSequences())
+ List<SequenceI> algn = align.getSequences();
+ synchronized (algn)
{
{
- List<SequenceI> tmp = new ArrayList<SequenceI>();
+ List<SequenceI> tmp = new ArrayList<>();
for (int i = 0; i < seqs.length; i++)
{
for (int i = 0; i < seqs.length; i++)
{
@@
-279,7
+279,7
@@
public class AlignmentSorter
{
// MAINTAINS ORIGNAL SEQUENCE ORDER,
// ORDERS BY GROUP SIZE
{
// MAINTAINS ORIGNAL SEQUENCE ORDER,
// ORDERS BY GROUP SIZE
- List<SequenceGroup> groups = new ArrayList<SequenceGroup>();
+ List<SequenceGroup> groups = new ArrayList<>();
if (groups.hashCode() != lastGroupHash)
{
if (groups.hashCode() != lastGroupHash)
{
@@
-315,7
+315,7
@@
public class AlignmentSorter
// NOW ADD SEQUENCES MAINTAINING ALIGNMENT ORDER
// /////////////////////////////////////////////
// NOW ADD SEQUENCES MAINTAINING ALIGNMENT ORDER
// /////////////////////////////////////////////
- List<SequenceI> seqs = new ArrayList<SequenceI>();
+ List<SequenceI> seqs = new ArrayList<>();
for (int i = 0; i < groups.size(); i++)
{
for (int i = 0; i < groups.size(); i++)
{
@@
-357,7
+357,7
@@
public class AlignmentSorter
// tmp2 = tmp.retainAll(mask);
// return tmp2.addAll(mask.removeAll(tmp2))
// tmp2 = tmp.retainAll(mask);
// return tmp2.addAll(mask.removeAll(tmp2))
- ArrayList<SequenceI> seqs = new ArrayList<SequenceI>();
+ ArrayList<SequenceI> seqs = new ArrayList<>();
int i, idx;
boolean[] tmask = new boolean[mask.size()];
int i, idx;
boolean[] tmask = new boolean[mask.size()];
@@
-436,7
+436,7
@@
public class AlignmentSorter
{
int nSeq = align.getHeight();
{
int nSeq = align.getHeight();
- List<SequenceI> tmp = new ArrayList<SequenceI>();
+ List<SequenceI> tmp = new ArrayList<>();
tmp = _sortByTree(tree.getTopNode(), tmp, align.getSequences());
tmp = _sortByTree(tree.getTopNode(), tmp, align.getSequences());
diff --git
a/src/jalview/analysis/CrossRef.java
b/src/jalview/analysis/CrossRef.java
index
e6bae9b
..
0e7662b
100644
(file)
--- a/
src/jalview/analysis/CrossRef.java
+++ b/
src/jalview/analysis/CrossRef.java
@@
-99,7
+99,7
@@
public class CrossRef
*/
public List<String> findXrefSourcesForSequences(boolean dna)
{
*/
public List<String> findXrefSourcesForSequences(boolean dna)
{
- List<String> sources = new ArrayList<String>();
+ List<String> sources = new ArrayList<>();
for (SequenceI seq : fromSeqs)
{
if (seq != null)
for (SequenceI seq : fromSeqs)
{
if (seq != null)
@@
-151,7
+151,7
@@
public class CrossRef
* find sequence's direct (dna-to-dna, peptide-to-peptide) xrefs
*/
DBRefEntry[] lrfs = DBRefUtils.selectDbRefs(fromDna, seq.getDBRefs());
* find sequence's direct (dna-to-dna, peptide-to-peptide) xrefs
*/
DBRefEntry[] lrfs = DBRefUtils.selectDbRefs(fromDna, seq.getDBRefs());
- List<SequenceI> foundSeqs = new ArrayList<SequenceI>();
+ List<SequenceI> foundSeqs = new ArrayList<>();
/*
* find sequences in the alignment which xref one of these DBRefs
/*
* find sequences in the alignment which xref one of these DBRefs
@@
-218,7
+218,7
@@
public class CrossRef
public Alignment findXrefSequences(String source, boolean fromDna)
{
public Alignment findXrefSequences(String source, boolean fromDna)
{
- rseqs = new ArrayList<SequenceI>();
+ rseqs = new ArrayList<>();
AlignedCodonFrame cf = new AlignedCodonFrame();
matcher = new SequenceIdMatcher(dataset.getSequences());
AlignedCodonFrame cf = new AlignedCodonFrame();
matcher = new SequenceIdMatcher(dataset.getSequences());
@@
-430,8
+430,8
@@
public class CrossRef
if (retrieved != null)
{
boolean addedXref = false;
if (retrieved != null)
{
boolean addedXref = false;
- List<SequenceI> newDsSeqs = new ArrayList<SequenceI>(),
- doNotAdd = new ArrayList<SequenceI>();
+ List<SequenceI> newDsSeqs = new ArrayList<>(),
+ doNotAdd = new ArrayList<>();
for (SequenceI retrievedSequence : retrieved)
{
for (SequenceI retrievedSequence : retrieved)
{
@@
-1008,8
+1008,8
@@
public class CrossRef
System.err.println("Empty dataset sequence set - NO VECTOR");
return false;
}
System.err.println("Empty dataset sequence set - NO VECTOR");
return false;
}
- List<SequenceI> ds;
- synchronized (ds = dataset.getSequences())
+ List<SequenceI> ds = dataset.getSequences();
+ synchronized (ds)
{
for (SequenceI nxt : ds)
{
{
for (SequenceI nxt : ds)
{
diff --git
a/src/jalview/appletgui/PaintRefresher.java
b/src/jalview/appletgui/PaintRefresher.java
index
fe99187
..
ddf590e
100755
(executable)
--- a/
src/jalview/appletgui/PaintRefresher.java
+++ b/
src/jalview/appletgui/PaintRefresher.java
@@
-52,7
+52,7
@@
public class PaintRefresher
{
if (components == null)
{
{
if (components == null)
{
- components = new Hashtable<String, Vector<Component>>();
+ components = new Hashtable<>();
}
if (components.containsKey(seqSetId))
}
if (components.containsKey(seqSetId))
@@
-191,8
+191,8
@@
public class PaintRefresher
{
// TODO: the following does not trigger any recalculation of
// height/etc, or maintain the dataset
{
// TODO: the following does not trigger any recalculation of
// height/etc, or maintain the dataset
- List<SequenceI> alsq;
- synchronized (alsq = comp.getSequences())
+ List<SequenceI> alsq = comp.getSequences();
+ synchronized (alsq)
{
alsq.add(i, a1[i]);
}
{
alsq.add(i, a1[i]);
}
diff --git
a/src/jalview/commands/EditCommand.java
b/src/jalview/commands/EditCommand.java
index
cac843f
..
b813dcf
100644
(file)
--- a/
src/jalview/commands/EditCommand.java
+++ b/
src/jalview/commands/EditCommand.java
@@
-114,7
+114,7
@@
public class EditCommand implements CommandI
public abstract Action getUndoAction();
};
public abstract Action getUndoAction();
};
- private List<Edit> edits = new ArrayList<Edit>();
+ private List<Edit> edits = new ArrayList<>();
String description;
String description;
@@
-605,8
+605,8
@@
public class EditCommand implements CommandI
// readd it to the alignment
if (command.alIndex[i] < command.al.getHeight())
{
// readd it to the alignment
if (command.alIndex[i] < command.al.getHeight())
{
- List<SequenceI> sequences;
- synchronized (sequences = command.al.getSequences())
+ List<SequenceI> sequences = command.al.getSequences();
+ synchronized (sequences)
{
if (!(command.alIndex[i] < 0))
{
{
if (!(command.alIndex[i] < 0))
{
@@
-789,7
+789,7
@@
public class EditCommand implements CommandI
if (modifyVisibility && !insert)
{
// only occurs if a sequence was added or deleted.
if (modifyVisibility && !insert)
{
// only occurs if a sequence was added or deleted.
- command.deletedAnnotationRows = new Hashtable<SequenceI, AlignmentAnnotation[]>();
+ command.deletedAnnotationRows = new Hashtable<>();
}
if (command.fullAlignmentHeight)
{
}
if (command.fullAlignmentHeight)
{
@@
-948,7
+948,7
@@
public class EditCommand implements CommandI
if (!insert)
{
if (!insert)
{
- command.deletedAnnotations = new Hashtable<String, Annotation[]>();
+ command.deletedAnnotations = new Hashtable<>();
}
int aSize;
}
int aSize;
@@
-1138,7
+1138,7
@@
public class EditCommand implements CommandI
return;
}
return;
}
- List<SequenceFeature> oldsf = new ArrayList<SequenceFeature>();
+ List<SequenceFeature> oldsf = new ArrayList<>();
int cSize = j - i;
int cSize = j - i;
@@
-1196,7
+1196,7
@@
public class EditCommand implements CommandI
if (command.editedFeatures == null)
{
if (command.editedFeatures == null)
{
- command.editedFeatures = new Hashtable<SequenceI, List<SequenceFeature>>();
+ command.editedFeatures = new Hashtable<>();
}
command.editedFeatures.put(seq, oldsf);
}
command.editedFeatures.put(seq, oldsf);
@@
-1233,7
+1233,7
@@
public class EditCommand implements CommandI
*/
public Map<SequenceI, SequenceI> priorState(boolean forUndo)
{
*/
public Map<SequenceI, SequenceI> priorState(boolean forUndo)
{
- Map<SequenceI, SequenceI> result = new HashMap<SequenceI, SequenceI>();
+ Map<SequenceI, SequenceI> result = new HashMap<>();
if (getEdits() == null)
{
return result;
if (getEdits() == null)
{
return result;
@@
-1266,7
+1266,7
@@
public class EditCommand implements CommandI
* Work backwards through the edit list, deriving the sequences before each
* was applied. The final result is the sequence set before any edits.
*/
* Work backwards through the edit list, deriving the sequences before each
* was applied. The final result is the sequence set before any edits.
*/
- Iterator<Edit> editList = new ReverseListIterator<Edit>(getEdits());
+ Iterator<Edit> editList = new ReverseListIterator<>(getEdits());
while (editList.hasNext())
{
Edit oldEdit = editList.next();
while (editList.hasNext())
{
Edit oldEdit = editList.next();
@@
-1427,7
+1427,7
@@
public class EditCommand implements CommandI
}
else
{
}
else
{
- return new ReverseListIterator<Edit>(getEdits());
+ return new ReverseListIterator<>(getEdits());
}
}
}
}
}
}
diff --git
a/src/jalview/datamodel/HiddenSequences.java
b/src/jalview/datamodel/HiddenSequences.java
index
c9dce08
..
b5efeb4
100755
(executable)
--- a/
src/jalview/datamodel/HiddenSequences.java
+++ b/
src/jalview/datamodel/HiddenSequences.java
@@
-222,8
+222,8
@@
public class HiddenSequences
end = hiddenSequences.length - 1;
}
end = hiddenSequences.length - 1;
}
- List<SequenceI> asequences;
- synchronized (asequences = alignment.getSequences())
+ List<SequenceI> asequences = alignment.getSequences();
+ synchronized (asequences)
{
for (int index = end; index > start; index--)
{
{
for (int index = end; index > start; index--)
{
diff --git
a/src/jalview/gui/PaintRefresher.java
b/src/jalview/gui/PaintRefresher.java
index
ced5544
..
54fe488
100755
(executable)
--- a/
src/jalview/gui/PaintRefresher.java
+++ b/
src/jalview/gui/PaintRefresher.java
@@
-39,7
+39,7
@@
import java.util.Map;
*/
public class PaintRefresher
{
*/
public class PaintRefresher
{
- static Map<String, List<Component>> components = new HashMap<String, List<Component>>();
+ static Map<String, List<Component>> components = new HashMap<>();
/**
* Add the given component to those registered under the given sequence set
/**
* Add the given component to those registered under the given sequence set
@@
-60,7
+60,7
@@
public class PaintRefresher
}
else
{
}
else
{
- List<Component> vcoms = new ArrayList<Component>();
+ List<Component> vcoms = new ArrayList<>();
vcoms.add(comp);
components.put(seqSetId, vcoms);
}
vcoms.add(comp);
components.put(seqSetId, vcoms);
}
@@
-186,8
+186,8
@@
public class PaintRefresher
System.err.println(
"IMPLEMENTATION PROBLEM: DATASET out of sync due to an insert whilst calling PaintRefresher.validateSequences(AlignmentI, ALignmentI)");
}
System.err.println(
"IMPLEMENTATION PROBLEM: DATASET out of sync due to an insert whilst calling PaintRefresher.validateSequences(AlignmentI, ALignmentI)");
}
- List<SequenceI> alsq;
- synchronized (alsq = comp.getSequences())
+ List<SequenceI> alsq = comp.getSequences();
+ synchronized (alsq)
{
alsq.add(i, a1[i]);
}
{
alsq.add(i, a1[i]);
}
@@
-240,7
+240,7
@@
public class PaintRefresher
{
return new AlignmentPanel[0];
}
{
return new AlignmentPanel[0];
}
- List<AlignmentPanel> tmp = new ArrayList<AlignmentPanel>();
+ List<AlignmentPanel> tmp = new ArrayList<>();
for (Component comp : comps)
{
if (comp instanceof AlignmentPanel)
for (Component comp : comps)
{
if (comp instanceof AlignmentPanel)
diff --git
a/src/jalview/gui/SequenceFetcher.java
b/src/jalview/gui/SequenceFetcher.java
index
f545e70
..
0a51c7f
100755
(executable)
--- a/
src/jalview/gui/SequenceFetcher.java
+++ b/
src/jalview/gui/SequenceFetcher.java
@@
-24,7
+24,6
@@
import jalview.api.FeatureSettingsModelI;
import jalview.bin.Cache;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.DBRefEntry;
import jalview.bin.Cache;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.DBRefEntry;
-import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.fts.core.GFTSPanel;
import jalview.fts.service.pdb.PDBFTSPanel;
import jalview.datamodel.SequenceI;
import jalview.fts.core.GFTSPanel;
import jalview.fts.service.pdb.PDBFTSPanel;
@@
-1027,9
+1026,8
@@
public class SequenceFetcher extends JPanel implements Runnable
// Alignments?
}
// Alignments?
}
- SequenceFeature[] sfs = null;
- List<SequenceI> alsqs;
- synchronized (alsqs = al.getSequences())
+ List<SequenceI> alsqs = al.getSequences();
+ synchronized (alsqs)
{
for (SequenceI sq : alsqs)
{
{
for (SequenceI sq : alsqs)
{
diff --git
a/src/jalview/io/vamsas/Tree.java
b/src/jalview/io/vamsas/Tree.java
index
aa130cc
..
c0f65c4
100644
(file)
--- a/
src/jalview/io/vamsas/Tree.java
+++ b/
src/jalview/io/vamsas/Tree.java
@@
-271,14
+271,14
@@
public class Tree extends DatastoreItem
* @return vector of alignment sequences in order of SeqCigar array (but
* missing unfound seqcigars)
*/
* @return vector of alignment sequences in order of SeqCigar array (but
* missing unfound seqcigars)
*/
- private Vector findAlignmentSequences(AlignmentI jal,
+ private Vector<SequenceI> findAlignmentSequences(AlignmentI jal,
SeqCigar[] sequences)
{
SeqCigar[] tseqs = new SeqCigar[sequences.length];
System.arraycopy(sequences, 0, tseqs, 0, sequences.length);
SeqCigar[] sequences)
{
SeqCigar[] tseqs = new SeqCigar[sequences.length];
System.arraycopy(sequences, 0, tseqs, 0, sequences.length);
- Vector alsq = new Vector();
- List<SequenceI> jalsqs;
- synchronized (jalsqs = jal.getSequences())
+ Vector<SequenceI> alsq = new Vector<>();
+ List<SequenceI> jalsqs = jal.getSequences();
+ synchronized (jalsqs)
{
for (SequenceI asq : jalsqs)
{
{
for (SequenceI asq : jalsqs)
{
diff --git
a/src/jalview/ws/rest/params/SeqGroupIndexVector.java
b/src/jalview/ws/rest/params/SeqGroupIndexVector.java
index
dcb7fab
..
9210414
100644
(file)
--- a/
src/jalview/ws/rest/params/SeqGroupIndexVector.java
+++ b/
src/jalview/ws/rest/params/SeqGroupIndexVector.java
@@
-75,6
+75,7
@@
public class SeqGroupIndexVector extends InputType
* - alignment to be processed
* @return al or a new alignment with appropriate attributes/order for input
*/
* - alignment to be processed
* @return al or a new alignment with appropriate attributes/order for input
*/
+ @Override
public AlignmentI prepareAlignment(AlignmentI al)
{
jalview.analysis.AlignmentSorter.sortByGroup(al);
public AlignmentI prepareAlignment(AlignmentI al)
{
jalview.analysis.AlignmentSorter.sortByGroup(al);
@@
-90,10
+91,10
@@
public class SeqGroupIndexVector extends InputType
AlignmentI al = rj.getAlignmentForInput(token, type);
// assume that alignment is properly ordered so groups form consecutive
// blocks
AlignmentI al = rj.getAlignmentForInput(token, type);
// assume that alignment is properly ordered so groups form consecutive
// blocks
- ArrayList<int[]> gl = new ArrayList<int[]>();
+ ArrayList<int[]> gl = new ArrayList<>();
int p = 0, lowest = al.getHeight(), highest = 0;
int p = 0, lowest = al.getHeight(), highest = 0;
- List<SequenceGroup> sgs;
- synchronized (sgs = al.getGroups())
+ List<SequenceGroup> sgs = al.getGroups();
+ synchronized (sgs)
{
for (SequenceGroup sg : sgs)
{
{
for (SequenceGroup sg : sgs)
{
@@
-125,9
+126,13
@@
public class SeqGroupIndexVector extends InputType
else
{
if (p < se[0])
else
{
if (p < se[0])
+ {
se[0] = p;
se[0] = p;
+ }
if (p > se[1])
if (p > se[1])
+ {
se[1] = p;
se[1] = p;
+ }
}
}
if (se != null)
}
}
if (se != null)
@@
-168,7
+173,9
@@
public class SeqGroupIndexVector extends InputType
int[][] vals = gl.toArray(new int[gl.size()][]);
int[] srt = new int[gl.size()];
for (int i = 0; i < vals.length; i++)
int[][] vals = gl.toArray(new int[gl.size()][]);
int[] srt = new int[gl.size()];
for (int i = 0; i < vals.length; i++)
+ {
srt[i] = vals[i][0];
srt[i] = vals[i][0];
+ }
jalview.util.QuickSort.sort(srt, vals);
list = false;
int last = vals[0][0] - 1;
jalview.util.QuickSort.sort(srt, vals);
list = false;
int last = vals[0][0] - 1;
@@
-210,7
+217,7
@@
public class SeqGroupIndexVector extends InputType
@Override
public List<String> getURLEncodedParameter()
{
@Override
public List<String> getURLEncodedParameter()
{
- ArrayList<String> prms = new ArrayList<String>();
+ ArrayList<String> prms = new ArrayList<>();
super.addBaseParams(prms);
prms.add("minsize='" + minsize + "'");
prms.add("sep='" + sep + "'");
super.addBaseParams(prms);
prms.add("minsize='" + minsize + "'");
prms.add("sep='" + sep + "'");
@@
-243,7
+250,9
@@
public class SeqGroupIndexVector extends InputType
{
minsize = Integer.valueOf(val);
if (minsize >= 0)
{
minsize = Integer.valueOf(val);
if (minsize >= 0)
+ {
return true;
return true;
+ }
} catch (Exception x)
{
} catch (Exception x)
{