From: amwaterhouse Date: Mon, 2 Apr 2007 12:51:14 +0000 (+0000) Subject: getAllFeaturesAtRes replace by findFeaturesAtRes X-Git-Tag: Release_2_3~284 X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=commitdiff_plain;h=9994e7c95d2c0dd8e585f838ce31fac7ceb0a94b getAllFeaturesAtRes replace by findFeaturesAtRes --- diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 0b9af01..a5ffb80 100755 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -213,36 +213,11 @@ public class SeqPanel } features = new SequenceFeature[tmp.size()]; - for (int i = 0; i < tmp.size(); i++) - { - features[i] = (SequenceFeature) tmp.elementAt(i); - } + tmp.copyInto(features); return features; } - Vector getAllFeaturesAtRes(SequenceI seq, int res) - { - Vector allFeatures = new Vector(); - int index = 0; - if (seq.getSequenceFeatures() != null && av.featuresDisplayed != null) - { - while (index < seq.getSequenceFeatures().length) - { - SequenceFeature sf = seq.getSequenceFeatures()[index]; - if (sf.getBegin() <= res && - sf.getEnd() >= res) - { - if (av.featuresDisplayed.containsKey(sf.getType())) - { - allFeatures.addElement(sf); - } - } - index++; - } - } - return allFeatures; - } void endEditing() { @@ -1486,17 +1461,16 @@ public class SeqPanel if (javax.swing.SwingUtilities.isRightMouseButton(evt)) { - Vector allFeatures = getAllFeaturesAtRes(sequence.getDatasetSequence(), + SequenceFeature [] allFeatures = findFeaturesAtRes(sequence.getDatasetSequence(), sequence.findPosition(res)); Vector links = new Vector(); - for (int i = 0; i < allFeatures.size(); i++) + for (int i = 0; i < allFeatures.length; i++) { - SequenceFeature sf = (SequenceFeature) allFeatures.elementAt(i); - if (sf.links != null) + if (allFeatures[i].links != null) { - for (int j = 0; j < sf.links.size(); j++) + for (int j = 0; j < allFeatures[i].links.size(); j++) { - links.addElement(sf.links.elementAt(j)); + links.addElement(allFeatures[i].links.elementAt(j)); } } }