X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=blobdiff_plain;f=src%2Fjalview%2Fstructure%2FStructureSelectionManager.java;h=a76a27ef3eb4efb36f7465eacab1da3f0ac2fa53;hp=35e0ea528872ec706ed2384ce077ea3ad6c71e5a;hb=b57a02c25e335d033c97f8a6bacd6b54f62bd2b6;hpb=1cc81e06ac2faa5ee4b8879e9fa019956e34259f diff --git a/src/jalview/structure/StructureSelectionManager.java b/src/jalview/structure/StructureSelectionManager.java index 35e0ea5..a76a27e 100644 --- a/src/jalview/structure/StructureSelectionManager.java +++ b/src/jalview/structure/StructureSelectionManager.java @@ -28,37 +28,43 @@ import jalview.datamodel.*; public class StructureSelectionManager { - static IdentityHashMap instances; + static IdentityHashMap instances; StructureMapping[] mappings; /** * debug function - write all mappings to stdout */ - public void reportMapping() { - if (mappings==null) - { - System.err.println("reportMapping: No PDB/Sequence mappings."); - }else{ - System.err.println("reportMapping: There are "+mappings.length+" mappings."); - for (int m=0;m(); + instances = new java.util.IdentityHashMap(); } - StructureSelectionManager instance=instances.get(context); - if (instance==null) + StructureSelectionManager instance = instances.get(context); + if (instance == null) { - instances.put(context, instance=new StructureSelectionManager()); + instances.put(context, instance = new StructureSelectionManager()); } return instance; } @@ -96,6 +102,7 @@ public class StructureSelectionManager /** * register a listener for alignment sequence mouseover events + * * @param svl */ public void addStructureViewerListener(Object svl) @@ -152,7 +159,7 @@ public class StructureSelectionManager ex.printStackTrace(); return null; } - + String targetChain; for (int s = 0; s < sequence.length; s++) { @@ -190,7 +197,8 @@ public class StructureSelectionManager for (int i = 0; i < pdb.chains.size(); i++) { PDBChain chain = ((PDBChain) pdb.chains.elementAt(i)); - if (targetChain.length() > 0 && !targetChain.equals(chain.id) && !infChain) + if (targetChain.length() > 0 && !targetChain.equals(chain.id) + && !infChain) { continue; // don't try to map chains don't match. } @@ -249,7 +257,8 @@ public class StructureSelectionManager // allocate enough slots to store the mapping from positions in // sequence[s] to the associated chain - int[][] mapping = new int[sequence[s].findPosition(sequence[s].getLength()) + 2][2]; + int[][] mapping = new int[sequence[s].findPosition(sequence[s] + .getLength()) + 2][2]; int resNum = -10000; int index = 0; @@ -295,15 +304,16 @@ public class StructureSelectionManager listeners.removeElement(svl); if (svl instanceof SequenceListener) { - for (int i=0;i view_listeners=new Vector(); - public synchronized void sendViewPosition(jalview.api.AlignmentViewPanel source, int startRes, - int endRes, int startSeq, int endSeq) + + Vector view_listeners = new Vector(); + + public synchronized void sendViewPosition( + jalview.api.AlignmentViewPanel source, int startRes, int endRes, + int startSeq, int endSeq) { if (view_listeners != null && view_listeners.size() > 0) { - Enumeration listeners = view_listeners.elements(); + Enumeration listeners = view_listeners + .elements(); while (listeners.hasMoreElements()) { - AlignmentViewPanelListener slis = listeners - .nextElement(); + AlignmentViewPanelListener slis = listeners.nextElement(); if (slis != source) { slis.viewPosition(startRes, endRes, startSeq, endSeq, source); @@ -765,39 +776,41 @@ public class StructureSelectionManager } } } - - public void finalize() throws Throwable { - if (listeners!=null) { + public void finalize() throws Throwable + { + if (listeners != null) + { listeners.clear(); - listeners=null; + listeners = null; } - if (mappingData!=null) + if (mappingData != null) { mappingData.clear(); - mappingData=null; + mappingData = null; } - if (sel_listeners!=null) + if (sel_listeners != null) { sel_listeners.clear(); - sel_listeners=null; + sel_listeners = null; } - if (view_listeners!=null) + if (view_listeners != null) { view_listeners.clear(); - view_listeners=null; + view_listeners = null; } - mappings=null; - seqmappingrefs=null; + mappings = null; + seqmappingrefs = null; } /** * release all references associated with this manager provider + * * @param jalviewLite */ public static void release(StructureSelectionManagerProvider jalviewLite) { -// synchronized (instances) + // synchronized (instances) { if (instances == null) {