- throw new Error(MessageManager.formatMessage("error.implementation_error_cannot_duplicate_colour_scheme", new String[]{getClass().getName()}), q);
+ throw new Error(MessageManager.formatMessage(
+ "error.implementation_error_cannot_duplicate_colour_scheme",
+ new String[] { getClass().getName() }), q);
+ }
+ }
+
+ /**
+ * Answers false if the colour scheme is nucleotide or peptide specific, and
+ * the data does not match, else false. Override to modify or extend this test
+ * as required.
+ */
+ @Override
+ public boolean isApplicableTo(AnnotatedCollectionI ac)
+ {
+ if (!isPeptideSpecific() && !isNucleotideSpecific())
+ {
+ return true;
+ }
+
+ /*
+ * inspect the data context (alignment dataset) for residue type
+ */
+ boolean nucleotide = false;
+ AnnotatedCollectionI context = ac.getContext();
+ if (context != null)
+ {
+ if (context instanceof AlignmentI)
+ {
+ nucleotide = ((AlignmentI) context).isNucleotide();
+ }
+ else
+ {
+ // not sure what's going on, play safe
+ return true;
+ }
+ }
+ else if (ac instanceof AlignmentI)
+ {
+ nucleotide = ((AlignmentI) ac).isNucleotide();