From 90add82a33c05e218a92eb1cdb2c345da05465f8 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 12 Dec 2016 22:01:47 +0000 Subject: [PATCH] JAL-2360 simplify nucleotide flag, remove setter --- src/jalview/datamodel/Alignment.java | 41 +++++---------------------------- src/jalview/datamodel/AlignmentI.java | 6 ----- 2 files changed, 6 insertions(+), 41 deletions(-) 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 -- 1.7.10.2