if (rootObject != null) stack.push(Chain.root(rootObject));
while (!stack.isEmpty()) {
Chain chain = stack.pop();
//the only place where the return value of visit() is considered
Traversal traversal = visitor.visit(chain);
switch (traversal) {
case SKIP: continue;
case EXPLORE: break;
default: throw new AssertionError();
}