+
+ @Override
+ public boolean isPrimaryCandidate()
+ {
+ /*
+ * if a map is present, unless it is 1:1 and has no SequenceI mate, it cannot be a primary reference.
+ */
+ if (map != null)
+ {
+ SequenceI mto = map.getTo();
+ if (mto != null)
+ {
+ return false;
+ }
+ MapList ml = map.getMap();
+ if (ml.getFromRatio() != ml.getToRatio() || ml.getFromRatio() != 1)
+ {
+ return false;
+ }
+ // check map is between identical single contiguous ranges
+ List<int[]> fromRanges, toRanges;
+ if ((fromRanges = ml.getFromRanges()).size() != 1
+ || (toRanges = ml.getToRanges()).size() != 1)
+ {
+ return false;
+ }
+ if (fromRanges.get(0)[0] != toRanges.get(0)[0]
+ || fromRanges.get(0)[1] != toRanges.get(0)[1])
+ {
+ return false;
+ }
+ }
+ if (version == null)
+ {
+ // no version string implies the reference has not been verified at all.
+ return false;
+ }
+
+ return DBRefSource.isPrimaryCandidate(ucversion);
+ }
+
+ /**
+ * stores the upper-case canonical name of the source for use in
+ * Sequence.getPrimaryDBRefs().
+ *
+ * @author Bob Hanson
+ *
+ * @return
+ */
+ public String getCanonicalSourceName()
+ {
+ return (canonicalSourceName == null
+ ? (canonicalSourceName = DBRefUtils
+ .getCanonicalName(this.source))
+ : canonicalSourceName);
+ }
+
+ /**
+ *
+ * @param canonical
+ */
+ public void setCanonical(boolean canonical)
+ {
+ isCanonicalAccession = canonical;
+ }
+
+ /**
+ *
+ * @return true if this is the primary canonical accession for the database
+ * source
+ */
+ public boolean isCanonical()
+ {
+ // TODO Auto-generated method stub
+ return isCanonicalAccession;
+ }