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