}
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; i<ref.length;i++)
+ {
+ if (entry.getSource()==null || ref[i].getSource().equals(entry.getSource()))
+ {
+ if (entry.getVersion()==null || ref[i].getVersion().equals(entry.getVersion()))
+ {
+ if (entry.getAccessionId()==null || ref[i].getAccessionId().equals(entry.getAccessionId()))
+ {
+ if (entry.getMap()==null || (ref[i].getMap()!=null && ref[i].getMap().equals(entry.getMap())))
+ {
+ rfs.addElement(ref[i]);
+ }
+ }
+ }
+ }
+ }
+ // TODO Auto-generated method stub
+ if (rfs.size()>0)
+ {
+ DBRefEntry[] rf = new DBRefEntry[rfs.size()];
+ rfs.copyInto(rf);
+ return rf;
+ }
+ return null;
+ }
}