Clover icon

Coverage Report

  1. Project Clover database Fri Dec 6 2024 13:47:14 GMT
  2. Package jalview.commands

File SlideSequencesCommand.java

 

Coverage histogram

../../img/srcFileCovDistChart0.png
60% of files have more coverage

Code metrics

16
26
3
1
93
61
11
0.42
8.67
3
3.67

Classes

Class Line # Actions
SlideSequencesCommand 25 26 11
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ The Jalview Authors
4    *
5    * This file is part of Jalview.
6    *
7    * Jalview is free software: you can redistribute it and/or
8    * modify it under the terms of the GNU General Public License
9    * as published by the Free Software Foundation, either version 3
10    * of the License, or (at your option) any later version.
11    *
12    * Jalview is distributed in the hope that it will be useful, but
13    * WITHOUT ANY WARRANTY; without even the implied warranty
14    * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15    * PURPOSE. See the GNU General Public License for more details.
16    *
17    * You should have received a copy of the GNU General Public License
18    * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19    * The Jalview Authors are detailed in the 'AUTHORS' file.
20    */
21    package jalview.commands;
22   
23    import jalview.datamodel.SequenceI;
24   
 
25    public class SlideSequencesCommand extends EditCommand
26    {
27    boolean gapsInsertedBegin = false;
28   
 
29  0 toggle public SlideSequencesCommand(String description, SequenceI[] seqsLeft,
30    SequenceI[] seqsRight, int slideSize, char gapChar)
31    {
32  0 this.description = description;
33   
34  0 int lSize = seqsLeft.length;
35  0 gapsInsertedBegin = false;
36  0 int i, j;
37  0 for (i = 0; i < lSize; i++)
38    {
39  0 for (j = 0; j < slideSize; j++)
40    {
41  0 if (!jalview.util.Comparison.isGap(seqsLeft[i].getCharAt(j)))
42    {
43  0 gapsInsertedBegin = true;
44  0 break;
45    }
46    }
47    }
48   
49  0 Edit e = null;
50   
51  0 if (!gapsInsertedBegin)
52    {
53  0 e = new Edit(Action.DELETE_GAP, seqsLeft, 0, slideSize, gapChar);
54  0 setEdit(e);
55    }
56    else
57    {
58  0 e = new Edit(Action.INSERT_GAP, seqsRight, 0, slideSize, gapChar);
59  0 setEdit(e);
60    }
61   
62  0 performEdit(e, null);
63    }
64   
 
65  0 toggle public boolean getGapsInsertedBegin()
66    {
67  0 return gapsInsertedBegin;
68    }
69   
 
70  0 toggle public boolean appendSlideCommand(SlideSequencesCommand command)
71    {
72  0 boolean same = false;
73   
74  0 if (command.getEdit(0).seqs.length == getEdit(0).seqs.length)
75    {
76  0 same = true;
77  0 for (int i = 0; i < command.getEdit(0).seqs.length; i++)
78    {
79  0 if (getEdit(0).seqs[i] != command.getEdit(0).seqs[i])
80    {
81  0 same = false;
82    }
83    }
84    }
85   
86  0 if (same)
87    {
88  0 command.addEdit(getEdit(0));
89    }
90   
91  0 return same;
92    }
93    }