From: Mateusz Warowny Date: Thu, 14 Sep 2023 14:36:16 +0000 (+0200) Subject: JAL-4241 Add SequenceI.setSequence(char[]) method X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=1b355b40b6f8db41ced6a05a9eab76b44089f7f1;p=jalview.git JAL-4241 Add SequenceI.setSequence(char[]) method --- diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index 4230366..89c55e6 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -594,6 +594,14 @@ public class Sequence extends ASequence implements SequenceI return this.sequence.length; } + @Override + public void setSequence(char[] seq) + { + this.sequence = Arrays.copyOf(seq, seq.length); + checkValidRange(); + sequenceChanged(); + } + /** * DOCUMENT ME! * diff --git a/src/jalview/datamodel/SequenceI.java b/src/jalview/datamodel/SequenceI.java index 11aa4e6..82575ec 100755 --- a/src/jalview/datamodel/SequenceI.java +++ b/src/jalview/datamodel/SequenceI.java @@ -101,6 +101,14 @@ public interface SequenceI extends ASequenceI public int getLength(); /** + * Replace the sequence with the given characters + * + * @param sequence + * new sequence characters + */ + public void setSequence(char[] sequence); + + /** * Replace the sequence with the given string * * @param sequence