*/
package jalview.analysis;
+import java.util.Locale;
+
import jalview.datamodel.DBRefEntry;
import jalview.datamodel.SequenceI;
dbseq = dbseq.getDatasetSequence();
}
// add in any interesting identifiers
- if (dbseq.getDBRefs() != null)
+ List<DBRefEntry> dbr = dbseq.getDBRefs();
+ if (dbr != null)
{
- DBRefEntry dbr[] = dbseq.getDBRefs();
SeqIdName sid = null;
- for (int r = 0; r < dbr.length; r++)
+ for (int r = 0, nr = dbr.size(); r < nr; r++)
{
- sid = new SeqIdName(dbr[r].getAccessionId());
+ sid = new SeqIdName(dbr.get(r).getAccessionId());
if (!names.containsKey(sid))
{
names.put(sid, seq);
names.put(new SeqIdName(cand.getName()), cand);
int q, w, candlen = cand.getName().length();
// keep the one with an id 'closer' to the given seqnam string
- if ((q = Math.abs(matchlen - namlen)) > (w = Math.abs(candlen
- - namlen))
- && candlen > matchlen)
+ if ((q = Math.abs(matchlen - namlen)) > (w = Math
+ .abs(candlen - namlen)) && candlen > matchlen)
{
best.clear();
match = cand;
{
if (s != null)
{
- id = new String(s.toLowerCase());
+ id = s.toLowerCase(Locale.ROOT);
}
else
{
@Override
public int hashCode()
{
- return ((id.length() >= 4) ? id.substring(0, 4).hashCode() : id
- .hashCode());
+ return ((id.length() >= 4) ? id.substring(0, 4).hashCode()
+ : id.hashCode());
}
@Override
{
if (s instanceof String)
{
- return this.stringequals(((String) s).toLowerCase());
+ return this.stringequals(((String) s).toLowerCase(Locale.ROOT));
}
}
{
if (id.length() > s.length())
{
- return id.startsWith(s) ? (WORD_SEP.indexOf(id.charAt(s.length())) > -1)
+ return id.startsWith(s)
+ ? (WORD_SEP.indexOf(id.charAt(s.length())) > -1)
: false;
}
else
{
- return s.startsWith(id) ? (s.equals(id) ? true : (WORD_SEP
- .indexOf(s.charAt(id.length())) > -1)) : false;
+ return s.startsWith(id)
+ ? (s.equals(id) ? true
+ : (WORD_SEP.indexOf(s.charAt(id.length())) > -1))
+ : false;
}
}
+
+ /**
+ * toString method returns the wrapped sequence id. For debugging purposes
+ * only, behaviour not guaranteed not to change.
+ */
+ @Override
+ public String toString()
+ {
+ return id;
+ }
}
}