+\r
+ void adjustAnnotations(Edit command, boolean insert)\r
+ {\r
+ AlignmentAnnotation [] annotations = command.al.getAlignmentAnnotation();\r
+ if(annotations!=null)\r
+ {\r
+ if(!insert)\r
+ command.deletedAnnotations = new Hashtable();\r
+\r
+ int aSize, tSize;\r
+ Annotation [] temp;\r
+ for (int a = 0; a < annotations.length; a++)\r
+ {\r
+ if(annotations[a].autoCalculated)\r
+ {\r
+ continue;\r
+ }\r
+\r
+ aSize = annotations[a].annotations.length;\r
+ if(insert)\r
+ tSize = aSize + command.number;\r
+ else\r
+ tSize = aSize - command.number;\r
+\r
+ temp = new Annotation[tSize];\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
+ {\r
+ Annotation [] restore = (Annotation [])\r
+ command.deletedAnnotations.get(annotations[a].annotationId);\r
+\r
+ System.arraycopy(restore,\r
+ 0,\r
+ temp,\r
+ command.position,\r
+ command.number);\r
+\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
+ {\r
+ if(command.position < annotations[a].annotations.length)\r
+ {\r
+ System.arraycopy(annotations[a].annotations,\r
+ 0, temp, 0, command.position);\r
+\r
+ Annotation[] deleted = new Annotation[command.number];\r
+ System.arraycopy(annotations[a].annotations,\r
+ command.position, deleted, 0, command.number);\r
+\r
+ command.deletedAnnotations.put(annotations[a].annotationId,\r
+ deleted);\r
+\r
+ System.arraycopy(annotations[a].annotations,\r
+ command.position + command.number,\r
+ temp, command.position,\r
+ aSize - command.position - command.number);\r
+ }\r
+ else\r
+ temp = annotations[a].annotations;\r
+ }\r
+\r
+ annotations[a].annotations = temp;\r
+ }\r
+ }\r
+ }\r
+\r
+\r