X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Futil%2FDBRefUtils.java;h=3e0004e0db6f888f4d50a1fabed513ffc473a31d;hb=7000ea3223f2f6a390f56341ba26850d2a137ae0;hp=d3788ea1ead1a96fa555c0956214a805c591f7ba;hpb=0d6e36143a2d7471edb7ef386d0b79095e0cd63e;p=jalview.git diff --git a/src/jalview/util/DBRefUtils.java b/src/jalview/util/DBRefUtils.java index d3788ea..3e0004e 100755 --- a/src/jalview/util/DBRefUtils.java +++ b/src/jalview/util/DBRefUtils.java @@ -1,48 +1,76 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer + * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.util; import java.util.*; import jalview.datamodel.*; - public class DBRefUtils { - /** - * Utilities for handling DBRef objects and their collections. - */ - /** - * - * @param dbrefs Vector of DBRef objects to search - * @param sources String[] array of source DBRef IDs to retrieve - * @return Vector - */ - public static DBRefEntry [] selectRefs(DBRefEntry [] dbrefs, String[] sources) { - if (dbrefs==null) - return null; - if (sources==null) - return dbrefs; - Hashtable srcs = new Hashtable(); - Vector res=new Vector(); + /** + * Utilities for handling DBRef objects and their collections. + */ + /** + * + * @param dbrefs Vector of DBRef objects to search + * @param sources String[] array of source DBRef IDs to retrieve + * @return Vector + */ + public static DBRefEntry[] selectRefs(DBRefEntry[] dbrefs, String[] sources) + { + if (dbrefs == null) + { + return null; + } + if (sources == null) + { + return dbrefs; + } + Hashtable srcs = new Hashtable(); + Vector res = new Vector(); - for (int i=0; i0) + if (res.size() > 0) + { + DBRefEntry[] reply = new DBRefEntry[res.size()]; + for (int i = 0; i < res.size(); i++) { - DBRefEntry [] reply = new DBRefEntry[res.size()]; - for(int i=0; i0) + { + DBRefEntry[] rf = new DBRefEntry[rfs.size()]; + rfs.copyInto(rf); + return rf; + } + return null; + } }