From f0fcba68c61bd8eddd6a975168ade951e8d9001d Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Wed, 31 Jan 2007 14:47:57 +0000 Subject: [PATCH] Adjust features when cutting and pasting --- src/jalview/commands/EditCommand.java | 137 ++++++++++++++++++++++++++++++--- 1 file changed, 128 insertions(+), 9 deletions(-) diff --git a/src/jalview/commands/EditCommand.java b/src/jalview/commands/EditCommand.java index 0c833d0..f3b178f 100644 --- a/src/jalview/commands/EditCommand.java +++ b/src/jalview/commands/EditCommand.java @@ -73,7 +73,7 @@ public class EditCommand implements CommandI } - public String getDescription() + final public String getDescription() { return description; } @@ -83,13 +83,13 @@ public class EditCommand implements CommandI return edits==null?0:edits.length; } - public AlignmentI getAlignment() + final public AlignmentI getAlignment() { return edits[0].al; } - public void appendEdit(int command, + final public void appendEdit(int command, SequenceI[] seqs, int position, int number, @@ -117,7 +117,7 @@ public class EditCommand implements CommandI performEdit(edits.length - 1); } - void performEdit(int commandIndex) + final void performEdit(int commandIndex) { int eSize = edits.length; for (int e = commandIndex; e < eSize; e++) @@ -141,12 +141,12 @@ public class EditCommand implements CommandI } } - public void doCommand() + final public void doCommand() { performEdit(0); } - public void undoCommand() + final public void undoCommand() { int e = 0, eSize = edits.length; for (e = eSize-1; e > -1; e--) @@ -170,7 +170,7 @@ public class EditCommand implements CommandI } } - void insertGap(Edit command) + final void insertGap(Edit command) { for(int s=0; s j) + { + sf[s].setBegin(copy.getBegin() - cSize); + sf[s].setEnd(copy.getEnd() - cSize); + continue; + } + + if (sf[s].getBegin() >= i) + sf[s].setBegin(i); + + if (sf[s].getEnd() < j) + sf[s].setEnd(j - 1); + + sf[s].setEnd(sf[s].getEnd() - (cSize)); + + if (sf[s].getBegin() > sf[s].getEnd()) + sequence.deleteFeature(sf[s]); + } + + if (command.editedFeatures == null) + command.editedFeatures = new Hashtable(); + + command.editedFeatures.put(seq, oldsf); + + } + class Edit { boolean fullAlignmentHeight = false; Hashtable deletedAnnotations; + Hashtable editedFeatures; AlignmentI al; int command; char [][] string; -- 1.7.10.2