*/\r
public class EditCommand implements CommandI\r
{\r
- public static String INSERT_GAP = "InsertGap";\r
- public static String DELETE_GAP = "DeleteGap";\r
- public static String CUT = "Cut";\r
- public static String PASTE = "Paste";\r
+ public static final int INSERT_GAP = 0;\r
+ public static final int DELETE_GAP = 1;\r
+ public static final int CUT = 2;\r
+ public static final int PASTE = 3;\r
\r
Edit[] edits;\r
\r
}\r
\r
public EditCommand(String description,\r
- String command,\r
+ int command,\r
SequenceI[] seqs,\r
int position,\r
int number,\r
{\r
this.description = description;\r
\r
- if (command.equalsIgnoreCase(INSERT_GAP)\r
- || command.equalsIgnoreCase(DELETE_GAP))\r
+ if (command==INSERT_GAP || command==DELETE_GAP)\r
{\r
edits = new Edit[] { new Edit(command, seqs, position, number, gapChar)};\r
}\r
}\r
\r
public EditCommand( String description,\r
- String command,\r
+ int command,\r
SequenceI[] seqs,\r
int position,\r
int number,\r
AlignmentI al)\r
{\r
this.description = description;\r
- if ( command.equalsIgnoreCase(CUT) || command.equalsIgnoreCase(PASTE))\r
+ if ( command==CUT || command==PASTE)\r
{\r
edits = new Edit[]{new Edit(command, seqs, position, number, al)};\r
}\r
}\r
\r
\r
- public void appendEdit(String command,\r
+ public void appendEdit(int command,\r
SequenceI[] seqs,\r
int position,\r
int number,\r
int eSize = edits.length;\r
for (int e = commandIndex; e < eSize; e++)\r
{\r
- if (edits[e].command.equals(INSERT_GAP))\r
+ if (edits[e].command==INSERT_GAP)\r
{\r
insertGap(edits[e]);\r
}\r
- else if (edits[e].command.equals(DELETE_GAP))\r
+ else if (edits[e].command==DELETE_GAP)\r
{\r
deleteGap(edits[e]);\r
}\r
- else if(edits[e].command.equals(CUT))\r
+ else if(edits[e].command==CUT)\r
{\r
cut(edits[e]);\r
}\r
- else if(edits[e].command.equals(PASTE))\r
+ else if(edits[e].command==PASTE)\r
{\r
paste(edits[e]);\r
}\r
int e = 0, eSize = edits.length;\r
for (e = eSize-1; e > -1; e--)\r
{\r
- if (edits[e].command.equals(INSERT_GAP))\r
+ if (edits[e].command==INSERT_GAP)\r
{\r
deleteGap(edits[e]);\r
}\r
- else if (edits[e].command.equals(DELETE_GAP))\r
+ else if (edits[e].command==DELETE_GAP)\r
{\r
insertGap(edits[e]);\r
}\r
- else if (edits[e].command.equals(CUT))\r
+ else if (edits[e].command==CUT)\r
{\r
paste(edits[e]);\r
}\r
- else if (edits[e].command.equals(PASTE))\r
+ else if (edits[e].command==PASTE)\r
{\r
cut(edits[e]);\r
}\r
\r
void cut(Edit command)\r
{\r
- command.string = new String [command.seqs.length];\r
+ command.string = new char [command.seqs.length][];\r
\r
for(int i=0; i<command.seqs.length; i++)\r
{\r
if(command.seqs[i].getLength()>command.position)\r
{\r
command.string[i] = command.seqs[i].getSequence(command.position,\r
- command.position + command.number);\r
+ command.position + command.number).toCharArray();\r
\r
command.seqs[i].deleteChars(command.position,\r
command.position + command.number);\r
class Edit\r
{\r
AlignmentI al;\r
- String command;\r
- String [] string;\r
+ int command;\r
+ char [][] string;\r
SequenceI[] seqs;\r
int [] alIndex;\r
int position, number;\r
char gapChar;\r
\r
- Edit(String command,\r
+ Edit(int command,\r
SequenceI[] seqs,\r
int position,\r
int number,\r
}\r
\r
\r
- Edit(String command,\r
+ Edit(int command,\r
SequenceI[] seqs,\r
int position,\r
int number,\r