command.gapChar);\r
}\r
\r
- if (command.fullAlignmentHeight)\r
- {\r
- adjustAnnotations(command, true);\r
- }\r
+ adjustAnnotations(command, true);\r
}\r
\r
void deleteGap(Edit command)\r
command.seqs[s].deleteChars(command.position, command.position+command.number);\r
}\r
\r
- if (command.fullAlignmentHeight)\r
- {\r
- adjustAnnotations(command, false);\r
- }\r
+ adjustAnnotations(command, false);\r
}\r
\r
void cut(Edit command)\r
}\r
}\r
\r
- if (command.fullAlignmentHeight)\r
- {\r
- adjustAnnotations(command, false);\r
- }\r
-\r
+ adjustAnnotations(command, false);\r
}\r
\r
void paste(Edit command)\r
command.seqs[i].setSequence(tmp.toString());\r
}\r
\r
- if (command.fullAlignmentHeight)\r
- {\r
- adjustAnnotations(command, true);\r
- }\r
+\r
+ adjustAnnotations(command, true);\r
\r
command.string = null;\r
}\r
\r
void adjustAnnotations(Edit command, boolean insert)\r
{\r
- AlignmentAnnotation [] annotations = command.al.getAlignmentAnnotation();\r
- if(annotations!=null)\r
+\r
+ AlignmentAnnotation [] annotations = null;\r
+\r
+ if (command.fullAlignmentHeight)\r
+ {\r
+ annotations = command.al.getAlignmentAnnotation();\r
+ }\r
+ else\r
{\r
+ int aSize = 0;\r
+ AlignmentAnnotation [] tmp;\r
+ for(int s=0; s<command.seqs.length; s++)\r
+ {\r
+ if(command.seqs[s].getAnnotation()==null)\r
+ continue;\r
+\r
+ if (aSize == 0)\r
+ annotations = command.seqs[s].getAnnotation();\r
+ else\r
+ {\r
+ tmp = new AlignmentAnnotation\r
+ [aSize + command.seqs[s].getAnnotation().length];\r
+\r
+ System.arraycopy(annotations,0,tmp,0,aSize);\r
+\r
+ System.arraycopy(command.seqs[s].getAnnotation(),\r
+ 0,tmp,aSize,command.seqs[s].getAnnotation().length);\r
+\r
+ annotations = tmp;\r
+ }\r
+\r
+\r
+ aSize = annotations.length;\r
+ }\r
+ }\r
+\r
+ if(annotations==null)\r
+ return;\r
+\r
+\r
if(!insert)\r
command.deletedAnnotations = new Hashtable();\r
\r
\r
if(insert)\r
{\r
- System.arraycopy(annotations[a].annotations,\r
- 0, temp, 0, command.position);\r
-\r
- if(command.deletedAnnotations!=null\r
- && command.deletedAnnotations.containsKey(annotations[a].annotationId))\r
+ if(command.position < annotations[a].annotations.length)\r
{\r
- Annotation [] restore = (Annotation [])\r
- command.deletedAnnotations.get(annotations[a].annotationId);\r
+ System.arraycopy(annotations[a].annotations,\r
+ 0, temp, 0, command.position);\r
\r
- System.arraycopy(restore,\r
- 0,\r
- temp,\r
- command.position,\r
- command.number);\r
+ if (command.deletedAnnotations != null\r
+ &&\r
+ command.deletedAnnotations.containsKey(annotations[a].annotationId))\r
+ {\r
+ Annotation[] restore = (Annotation[])\r
+ command.deletedAnnotations.get(annotations[a].annotationId);\r
\r
- }\r
+ System.arraycopy(restore,\r
+ 0,\r
+ temp,\r
+ command.position,\r
+ command.number);\r
\r
- System.arraycopy(annotations[a].annotations,\r
- command.position, temp,\r
- command.position+command.number,\r
- aSize - command.position);\r
+ }\r
+\r
+ System.arraycopy(annotations[a].annotations,\r
+ command.position, temp,\r
+ command.position + command.number,\r
+ aSize - command.position);\r
+ }\r
+ else\r
+ temp = annotations[a].annotations;\r
}\r
else\r
{\r
\r
annotations[a].annotations = temp;\r
}\r
- }\r
}\r
\r
\r
\r
alIndex = new int[seqs.length];\r
for(int i=0; i<seqs.length; i++)\r
+ {\r
alIndex[i] = al.findIndex(seqs[i]);\r
+ }\r
\r
fullAlignmentHeight = (al.getHeight()==seqs.length);\r
-\r
}\r
-\r
}\r
\r
}\r