/*
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
PDBChain mainchain;
- Vector highlightRes;
+ Vector<String> highlightRes;
boolean pdbAction = false;
{
mappingDetails.append("\n\nPDB Sequence is :\nSequence = "
- + pdb.chains.elementAt(i).sequence
- .getSequenceAsString());
+ + pdb.chains.elementAt(i).sequence.getSequenceAsString());
mappingDetails.append("\nNo of residues = "
- + pdb.chains.elementAt(i).residues.size()
- + "\n\n");
+ + pdb.chains.elementAt(i).residues.size() + "\n\n");
// Now lets compare the sequences to get
// the start and end points.
ToolTipManager.sharedInstance().setDismissDelay(10000);
}
- Vector visiblebonds;
+ Vector<Bond> visiblebonds;
void setupBonds()
{
seqColoursReady = false;
// Sort the bonds by z coord
- visiblebonds = new Vector();
+ visiblebonds = new Vector<Bond>();
- for (int ii = 0; ii < pdb.chains.size(); ii++)
+ for (PDBChain chain : pdb.chains)
{
- if (pdb.chains.elementAt(ii).isVisible)
+ if (chain.isVisible)
{
- Vector tmp = pdb.chains.elementAt(ii).bonds;
-
- for (int i = 0; i < tmp.size(); i++)
+ for (Bond bond : chain.bonds)
{
- visiblebonds.addElement(tmp.elementAt(i));
+ visiblebonds.addElement(bond);
}
}
}
min[1] = (float) 1e30;
min[2] = (float) 1e30;
- for (int ii = 0; ii < pdb.chains.size(); ii++)
+ for (PDBChain chain : pdb.chains)
{
- if (pdb.chains.elementAt(ii).isVisible)
+ if (chain.isVisible)
{
- Vector bonds = pdb.chains.elementAt(ii).bonds;
-
- for (int i = 0; i < bonds.size(); i++)
+ for (Bond tmp : chain.bonds)
{
- Bond tmp = (Bond) bonds.elementAt(i);
-
if (tmp.start[0] >= max[0])
{
max[0] = tmp.start[0];
int bsize = 0;
// Find centre coordinate
- for (int ii = 0; ii < pdb.chains.size(); ii++)
+ for (PDBChain chain : pdb.chains)
{
- if (pdb.chains.elementAt(ii).isVisible)
+ if (chain.isVisible)
{
- Vector bonds = pdb.chains.elementAt(ii).bonds;
-
- bsize += bonds.size();
+ bsize += chain.bonds.size();
- for (int i = 0; i < bonds.size(); i++)
+ for (Bond bond : chain.bonds)
{
- xtot = xtot + ((Bond) bonds.elementAt(i)).start[0]
- + ((Bond) bonds.elementAt(i)).end[0];
-
- ytot = ytot + ((Bond) bonds.elementAt(i)).start[1]
- + ((Bond) bonds.elementAt(i)).end[1];
-
- ztot = ztot + ((Bond) bonds.elementAt(i)).start[2]
- + ((Bond) bonds.elementAt(i)).end[2];
+ xtot = xtot + bond.start[0] + bond.end[0];
+ ytot = ytot + bond.start[1] + bond.end[1];
+ ztot = ztot + bond.start[2] + bond.end[2];
}
}
}
for (int i = 0; i < chain.bonds.size(); i++)
{
- Bond tmp = (Bond) chain.bonds.elementAt(i);
+ Bond tmp = chain.bonds.elementAt(i);
tmp.startCol = Color.lightGray;
tmp.endCol = Color.lightGray;
if (chain != mainchain)
zsort = new Zsort();
}
- zsort.Zsort(visiblebonds);
+ zsort.sort(visiblebonds);
}
Bond tmpBond = null;
for (int i = 0; i < visiblebonds.size(); i++)
{
- tmpBond = (Bond) visiblebonds.elementAt(i);
+ tmpBond = visiblebonds.elementAt(i);
xstart = (int) (((tmpBond.start[0] - centre[0]) * scale) + (getWidth() / 2));
ystart = (int) (((centre[1] - tmpBond.start[1]) * scale) + (getHeight() / 2));
{
if (highlightRes == null)
{
- highlightRes = new Vector();
+ highlightRes = new Vector<String>();
}
- if (highlightRes.contains(fatom.alignmentMapping + ""))
+ final String atomString = Integer
+ .toString(fatom.alignmentMapping);
+ if (highlightRes.contains(atomString))
{
- highlightRes.remove(fatom.alignmentMapping + "");
+ highlightRes.remove(atomString);
}
else
{
- highlightRes.add(fatom.alignmentMapping + "");
+ highlightRes.add(atomString);
}
}
}
}
// Alter the bonds
- for (int ii = 0; ii < pdb.chains.size(); ii++)
+ for (PDBChain chain : pdb.chains)
{
- Vector bonds = pdb.chains.elementAt(ii).bonds;
-
- for (int i = 0; i < bonds.size(); i++)
+ for (Bond tmpBond : chain.bonds)
{
- Bond tmpBond = (Bond) bonds.elementAt(i);
-
// Translate the bond so the centre is 0,0,0
tmpBond.translate(-centre[0], -centre[1], -centre[2]);
void drawLabels(Graphics g)
{
- for (int ii = 0; ii < pdb.chains.size(); ii++)
+ for (PDBChain chain : pdb.chains)
{
- PDBChain chain = pdb.chains.elementAt(ii);
-
if (chain.isVisible)
{
- Vector bonds = pdb.chains.elementAt(ii).bonds;
-
- for (int i = 0; i < bonds.size(); i++)
+ for (Bond tmpBond : chain.bonds)
{
- Bond tmpBond = (Bond) bonds.elementAt(i);
-
if (tmpBond.at1.isSelected)
{
labelAtom(g, tmpBond, 1);
if (tmpBond.at2.isSelected)
{
-
labelAtom(g, tmpBond, 2);
}
}
if (chain.isVisible)
{
- Vector bonds = pdb.chains.elementAt(ii).bonds;
-
- for (int i = 0; i < bonds.size(); i++)
+ for (Bond bond : chain.bonds)
{
- tmpBond = (Bond) bonds.elementAt(i);
+ tmpBond = bond;
truex = (int) (((tmpBond.start[0] - centre[0]) * scale) + (getWidth() / 2));
}
if (fatom != null) // )&& chain.ds != null)
- {
+ { // dead code? value of chain is either overwritten or discarded
chain = pdb.chains.elementAt(foundchain);
}
}
Bond tmpBond;
for (index = 0; index < mainchain.bonds.size(); index++)
{
- tmpBond = (Bond) mainchain.bonds.elementAt(index);
+ tmpBond = mainchain.bonds.elementAt(index);
if (tmpBond.at1.alignmentMapping == ii - 1)
{
if (highlightBond1 != null)
if (index > 0)
{
- highlightBond1 = (Bond) mainchain.bonds.elementAt(index - 1);
+ highlightBond1 = mainchain.bonds.elementAt(index - 1);
highlightBond1.at2.isSelected = true;
}
if (index != mainchain.bonds.size())
{
- highlightBond2 = (Bond) mainchain.bonds.elementAt(index);
+ highlightBond2 = mainchain.bonds.elementAt(index);
highlightBond2.at1.isSelected = true;
}
// /StructureListener
public String[] getPdbFile()
{
- return new String[]
- { pdbentry.getFile() };
+ return new String[] { pdbentry.getFile() };
}
String lastMessage;
Bond tmpBond;
for (index = 0; index < mainchain.bonds.size(); index++)
{
- tmpBond = (Bond) mainchain.bonds.elementAt(index);
+ tmpBond = mainchain.bonds.elementAt(index);
if (tmpBond.at1.atomIndex == atomIndex)
{
if (highlightBond1 != null)
if (index > 0)
{
- highlightBond1 = (Bond) mainchain.bonds.elementAt(index - 1);
+ highlightBond1 = mainchain.bonds.elementAt(index - 1);
highlightBond1.at2.isSelected = true;
}
if (index != mainchain.bonds.size())
{
- highlightBond2 = (Bond) mainchain.bonds.elementAt(index);
+ highlightBond2 = mainchain.bonds.elementAt(index);
highlightBond2.at1.isSelected = true;
}
}
+ @Override
+ public boolean isListeningFor(SequenceI seq)
+ {
+ if (sequence != null)
+ {
+ for (SequenceI s : sequence)
+ {
+ if (s == seq)
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
}