3 * Jalview - A Sequence Alignment Editor and Viewer
\r
4 * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
6 * This program is free software; you can redistribute it and/or
\r
7 * modify it under the terms of the GNU General Public License
\r
8 * as published by the Free Software Foundation; either version 2
\r
9 * of the License, or (at your option) any later version.
\r
11 * This program is distributed in the hope that it will be useful,
\r
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 * GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License
\r
17 * along with this program; if not, write to the Free Software
\r
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\r
21 package jalview.commands;
\r
23 import jalview.datamodel.*;
\r
25 public class SlideSequencesCommand extends EditCommand
\r
27 boolean gapsInsertedBegin = false;
\r
29 public SlideSequencesCommand(String description,
\r
30 SequenceI[] seqsLeft,
\r
31 SequenceI[] seqsRight,
\r
35 this.description = description;
\r
37 int lSize = seqsLeft.length;
\r
38 gapsInsertedBegin = false;
\r
40 for (i = 0; i < lSize; i++)
\r
42 for (j = 0; j < slideSize; j++)
\r
43 if (!jalview.util.Comparison.isGap(seqsLeft[i].getCharAt(j)))
\r
45 gapsInsertedBegin = true;
\r
50 if (!gapsInsertedBegin)
\r
52 { new Edit(DELETE_GAP, seqsLeft, 0, slideSize, gapChar)};
\r
55 { new Edit(INSERT_GAP, seqsRight, 0, slideSize, gapChar)};
\r
60 public boolean getGapsInsertedBegin()
\r
62 return gapsInsertedBegin;
\r
65 public boolean appendSlideCommand(SlideSequencesCommand command)
\r
67 boolean same = false;
\r
69 if(command.edits[0].seqs.length==edits[0].seqs.length)
\r
72 for (int i = 0; i < command.edits[0].seqs.length; i++)
\r
74 if (edits[0].seqs[i] != command.edits[0].seqs[i])
\r
83 Edit[] temp = new Edit[command.edits.length + 1];
\r
84 System.arraycopy(command.edits, 0, temp, 0, command.edits.length);
\r
85 command.edits = temp;
\r
86 command.edits[command.edits.length - 1] = edits[0];
\r