From 606758592f2aa33b342ad7c641d02a67411f11dd Mon Sep 17 00:00:00 2001 From: jprocter Date: Fri, 13 Jul 2007 14:55:21 +0000 Subject: [PATCH] new search method for finding references like other references. --- src/jalview/util/DBRefUtils.java | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/jalview/util/DBRefUtils.java b/src/jalview/util/DBRefUtils.java index 3ea47f2..f016fe6 100755 --- a/src/jalview/util/DBRefUtils.java +++ b/src/jalview/util/DBRefUtils.java @@ -127,4 +127,41 @@ public class DBRefUtils } return canonical; } + /** + * find RefEntry corresponding to a particular pattern + * the equals method of each entry is used, from String attributes right down to Mapping attributes. + * @param ref Set of references to search + * @param entry pattern to collect - null any entry for wildcard match + * @return + */ + public static DBRefEntry[] searchRefs(DBRefEntry[] ref, DBRefEntry entry) + { + if (ref==null || entry==null) + return null; + Vector rfs = new Vector(); + for (int i=0; i0) + { + DBRefEntry[] rf = new DBRefEntry[rfs.size()]; + rfs.copyInto(rf); + return rf; + } + return null; + } } -- 1.7.10.2