From: gmungoc Date: Mon, 12 Dec 2016 22:01:47 +0000 (+0000) Subject: JAL-2360 simplify nucleotide flag, remove setter X-Git-Tag: Release_2_10_3b1~357^2~61 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=90add82a33c05e218a92eb1cdb2c345da05465f8;hp=00aed8811670315564760783c836eca4b47521eb;p=jalview.git JAL-2360 simplify nucleotide flag, remove setter --- diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index d651c1d..290707d 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -54,11 +54,7 @@ public class Alignment implements AlignmentI protected char gapCharacter = '-'; - protected int type = NUCLEOTIDE; - - public static final int PROTEIN = 0; - - public static final int NUCLEOTIDE = 1; + private boolean nucleotide = true; public boolean hasRNAStructure = false; @@ -76,14 +72,7 @@ public class Alignment implements AlignmentI hiddenSequences = new HiddenSequences(this); codonFrameList = new ArrayList(); - if (Comparison.isNucleotide(seqs)) - { - type = NUCLEOTIDE; - } - else - { - type = PROTEIN; - } + nucleotide = Comparison.isNucleotide(seqs); sequences = Collections.synchronizedList(new ArrayList()); @@ -218,7 +207,9 @@ public class Alignment implements AlignmentI } /** - * Adds a sequence to the alignment. Recalculates maxLength and size. + * Adds a sequence to the alignment. Recalculates maxLength and size. Note + * this currently does not recalculate whether or not the alignment is + * nucleotide, so mixed alignments may have undefined behaviour. * * @param snew */ @@ -977,29 +968,9 @@ public class Alignment implements AlignmentI } @Override - public void setNucleotide(boolean b) - { - if (b) - { - type = NUCLEOTIDE; - } - else - { - type = PROTEIN; - } - } - - @Override public boolean isNucleotide() { - if (type == NUCLEOTIDE) - { - return true; - } - else - { - return false; - } + return nucleotide; } @Override diff --git a/src/jalview/datamodel/AlignmentI.java b/src/jalview/datamodel/AlignmentI.java index 7274e5f..1b5cc0b 100755 --- a/src/jalview/datamodel/AlignmentI.java +++ b/src/jalview/datamodel/AlignmentI.java @@ -298,12 +298,6 @@ public interface AlignmentI extends AnnotatedCollectionI boolean hasRNAStructure(); /** - * Set alignment to be a nucleotide sequence - * - */ - void setNucleotide(boolean b); - - /** * Get the associated dataset for the alignment. * * @return Alignment containing dataset sequences or null of this is a