/** * Deletes data. * * @param start * the start offset. * @param end * the end offset+1. */ public void delete(final int start, final int end) { replace(start, end, null); }
public static void applyChanges(AlignedString as, List<SofaChangeAnnotation> changes) { // If we remove or add stuff all offsets right of the change location // will change and thus the offsets in the change annotation are no // longer valid. If we move from right to left it works better because // the left offsets remain stable. Collections.reverse(changes); for (SofaChangeAnnotation c : changes) { if (OP_INSERT.equals(c.getOperation())) { // getContext().getLogger().log(INFO, // "Performing insert: "+a.getBegin()+"-"+a.getEnd()); as.insert(c.getBegin(), c.getValue()); } if (OP_DELETE.equals(c.getOperation())) { // getContext().getLogger().log(INFO, // "Performing delete: "+a.getBegin()+"-"+a.getEnd()); as.delete(c.getBegin(), c.getEnd()); } if (OP_REPLACE.equals(c.getOperation())) { // getContext().getLogger().log(INFO, // "Performing replace: "+a.getBegin()+"-"+a.getEnd()); as.replace(c.getBegin(), c.getEnd(), c.getValue()); } } } }
alignmentState.replace(a.getBegin(), a.getEnd(), a.getValue());
break; case REPLACE: alignedString.replace(change.getStart(), change.getEnd(), change.getText()); break; default: