コード例 #1
0
 private void processAction(Action<?> action, UpdatingIterator parentIterator) {
   if (action.act == Action.Act.next || action.act == Action.Act.nextSibling) {
     // do nothing
   } else if (action.act == Action.Act.remove) {
     parentIterator.remove();
   } else if (action.act == Action.Act.replace) {
     AmObject replacement = action.getReplaceWith();
     parentIterator.set(replacement);
   } else throw new AssertionError(action);
 }
コード例 #2
0
 @Nullable
 private AmObject extractWalkObject(AmObject amObject, Action<?> result) {
   if (result.act == Action.Act.next) {
     return amObject;
   } else if (result.act == Action.Act.nextSibling) {
     return null;
   } else if (result.act == Action.Act.remove) {
     return null;
   } else if (result.act == Action.Act.replace) {
     return result.getReplaceWith();
   } else throw new AssertionError(result);
 }