// Likewise, with cursorBias = RIGHT, as all that's used & tested so far is cursorBias = LEFT
// calculate annotation maps before and after
final StringMap<Object> before = CollectionUtils.createStringMap();
final StringMap<Object> after = CollectionUtils.createStringMap();
annotationSet.knownKeys().each(new Proc() {
@Override
public void apply(String key) {
if (position > 0) {
Object beforeV = annotationSet.getAnnotation(position - 1, key);
if (beforeV != null) {
before.put(key, beforeV);
}
}
if (position< annotationSet.size()) {
Object afterV = annotationSet.getAnnotation(position, key);
if (afterV != null) {
after.put(key, afterV);
}
}
}
});
// assign them to inside/outside the cursor based on bias:
final StringMap<Object> inside = (cursorBias == BiasDirection.RIGHT ? after : before);
final StringMap<Object> outside = (cursorBias == BiasDirection.RIGHT ? before : after);
final StringMap<String> changedAnnotations = CollectionUtils.createStringMap();
annotationSet.knownKeys().each(new Proc() {
@Override
public void apply(String key) {
interpretReplace(key, type, builder, inside, outside, before, changedAnnotations);
}
});