}
// 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++)
{
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++)
{
{
// MAINTAINS ORIGNAL SEQUENCE ORDER,
// ORDERS BY GROUP SIZE
- List<SequenceGroup> groups = new ArrayList<SequenceGroup>();
+ List<SequenceGroup> groups = new ArrayList<>();
if (groups.hashCode() != lastGroupHash)
{
// 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++)
{
// 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 nSeq = align.getHeight();
- List<SequenceI> tmp = new ArrayList<SequenceI>();
+ List<SequenceI> tmp = new ArrayList<>();
tmp = _sortByTree(tree.getTopNode(), tmp, align.getSequences());
*/
public List<String> findXrefSourcesForSequences(boolean dna)
{
- List<String> sources = new ArrayList<String>();
+ List<String> sources = new ArrayList<>();
for (SequenceI seq : fromSeqs)
{
if (seq != null)
* 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
public Alignment findXrefSequences(String source, boolean fromDna)
{
- rseqs = new ArrayList<SequenceI>();
+ rseqs = new ArrayList<>();
AlignedCodonFrame cf = new AlignedCodonFrame();
matcher = new SequenceIdMatcher(dataset.getSequences());
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)
{
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)
{
{
if (components == null)
{
- components = new Hashtable<String, Vector<Component>>();
+ components = new Hashtable<>();
}
if (components.containsKey(seqSetId))
{
// 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]);
}
public abstract Action getUndoAction();
};
- private List<Edit> edits = new ArrayList<Edit>();
+ private List<Edit> edits = new ArrayList<>();
String description;
// 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 (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 (!insert)
{
- command.deletedAnnotations = new Hashtable<String, Annotation[]>();
+ command.deletedAnnotations = new Hashtable<>();
}
int aSize;
return;
}
- List<SequenceFeature> oldsf = new ArrayList<SequenceFeature>();
+ List<SequenceFeature> oldsf = new ArrayList<>();
int cSize = j - i;
if (command.editedFeatures == null)
{
- command.editedFeatures = new Hashtable<SequenceI, List<SequenceFeature>>();
+ command.editedFeatures = new Hashtable<>();
}
command.editedFeatures.put(seq, oldsf);
*/
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;
* 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();
}
else
{
- return new ReverseListIterator<Edit>(getEdits());
+ return new ReverseListIterator<>(getEdits());
}
}
}
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--)
{
*/
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
}
else
{
- List<Component> vcoms = new ArrayList<Component>();
+ List<Component> vcoms = new ArrayList<>();
vcoms.add(comp);
components.put(seqSetId, vcoms);
}
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]);
}
{
return new AlignmentPanel[0];
}
- List<AlignmentPanel> tmp = new ArrayList<AlignmentPanel>();
+ List<AlignmentPanel> tmp = new ArrayList<>();
for (Component comp : comps)
{
if (comp instanceof AlignmentPanel)
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;
// Alignments?
}
- SequenceFeature[] sfs = null;
- List<SequenceI> alsqs;
- synchronized (alsqs = al.getSequences())
+ List<SequenceI> alsqs = al.getSequences();
+ synchronized (alsqs)
{
for (SequenceI sq : alsqs)
{
* @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);
- 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)
{
* - 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);
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;
- List<SequenceGroup> sgs;
- synchronized (sgs = al.getGroups())
+ List<SequenceGroup> sgs = al.getGroups();
+ synchronized (sgs)
{
for (SequenceGroup sg : sgs)
{
else
{
if (p < se[0])
+ {
se[0] = p;
+ }
if (p > se[1])
+ {
se[1] = p;
+ }
}
}
if (se != null)
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];
+ }
jalview.util.QuickSort.sort(srt, vals);
list = false;
int last = vals[0][0] - 1;
@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 + "'");
{
minsize = Integer.valueOf(val);
if (minsize >= 0)
+ {
return true;
+ }
} catch (Exception x)
{