if ((replacedText.length() > 0) && (text.length() == 0)) {
return new DeleteOperation(offset, replacedText);
}
// insert activityDataObject
if ((replacedText.length() == 0) && (text.length() > 0)) {
return new InsertOperation(offset, text);
}
// replace operation has to be split into delete and insert operation
if ((replacedText.length() > 0) && (text.length() > 0)) {
return new SplitOperation(
new DeleteOperation(offset, replacedText), new InsertOperation(
offset, text));
}
// Cannot happen
assert false;