if (listener.onVisit(parentLayer, root, depth)) {
return true;
}
if (root instanceof Movie) {
Movie movie = (Movie) root;
depth ++;
for (String layer : movie.namedLayers().keySet()) {
for (Instance instance : movie.getInstances(layer)) {
if (applyToHierarchy0(layer, instance, listener, depth)) {
return true;
}
}
}