Dispatches, based on type to specialised builders
550761
static public function build_plan($controller) {

        $plan = $controller->get_plan();

        // Add the root task, responsible for
        // preparing everything, creating the
        // needed structures (users, roles),
        // preloading information to temp table
        // and other init tasks
        $plan->add_task(new restore_root_task('root_task'));
        $controller->get_progress()->progress();

        switch ($controller->get_type()) {
            case backup::TYPE_1ACTIVITY:
                self::build_activity_plan($controller, key($controller->get_info()->activities));
                break;
            case backup::TYPE_1SECTION:
                self::build_section_plan($controller, key($controller->get_info()->sections));
                break;
            case backup::TYPE_1COURSE:
                self::build_course_plan($controller, $controller->get_courseid());
                break;
        }

        // Add the final task, responsible for closing
        // all the pending bits (remapings, inter-links
        // conversion...)
        // and perform other various final actions.
        $plan->add_task(new restore_final_task('final_task'));
        $controller->get_progress()->progress();
    }
52307
def prepare_dispatches():
    
    dispatches = []
    target_messages = Message.get_without_dispatches()

    cache = {}

    for message_model in target_messages:

        if message_model.cls not in cache:
            message_cls = get_registered_message_type(message_model.cls)
            subscribers = message_cls.get_subscribers()
            cache[message_model.cls] = (message_cls, subscribers)
        else:
            message_cls, subscribers = cache[message_model.cls]

        dispatches.extend(message_cls.prepare_dispatches(message_model))

    return dispatches
1002532
@Nonnull
	public static IntUnaryOperator intUnaryOperatorFrom(Consumer<IntUnaryOperatorBuilder> buildingFunction) {
		IntUnaryOperatorBuilder builder = new IntUnaryOperatorBuilder();
		buildingFunction.accept(builder);
		return builder.build();
	}
253820
def _class_dispatch(args, kwargs):
    """"""
    _ = kwargs
    if not args:
        raise ValueError(
            "Multimethods must be passed at least one positional arg.")

    if not isinstance(args[0], type):
        raise TypeError(
            "class_multimethod must be called with a type, not instance.")

    return args[0]
1355071
@Nonnull
	public static <T> LObjIntLongPredicate<T> objIntLongPredicateFrom(Consumer<LObjIntLongPredicateBuilder<T>> buildingFunction) {
		LObjIntLongPredicateBuilder builder = new LObjIntLongPredicateBuilder();
		buildingFunction.accept(builder);
		return builder.build();
	}
41161
@Nonnull
	public static <T> LTieIntConsumer<T> tieIntConsumerFrom(Consumer<LTieIntConsumerBuilder<T>> buildingFunction) {
		LTieIntConsumerBuilder builder = new LTieIntConsumerBuilder();
		buildingFunction.accept(builder);
		return builder.build();
	}
792077
@Nonnull
	public static <T> LTieByteConsumer<T> tieByteConsumerFrom(Consumer<LTieByteConsumerBuilder<T>> buildingFunction) {
		LTieByteConsumerBuilder builder = new LTieByteConsumerBuilder();
		buildingFunction.accept(builder);
		return builder.build();
	}
627124
@Nonnull
	public static <T> LObjCharPredicate<T> objCharPredicateFrom(Consumer<LObjCharPredicateBuilder<T>> buildingFunction) {
		LObjCharPredicateBuilder builder = new LObjCharPredicateBuilder();
		buildingFunction.accept(builder);
		return builder.build();
	}
1272505
def types(cls, **kwargs):
    """"""
    named = {name: factory(Arguments._fields.index(name), name)
             for name, factory in six.iteritems(kwargs)}
    return cls(**named)
727177
def structure(self, obj, cl):
        # type: (Any, Type[T]) -> T
        """"""

        return self._structure_func.dispatch(cl)(obj, cl)
486364
def local_build(native, *args, **kwargs):
    
    method = 'native_build' if native else 'build'
    logging.debug(_('build type: %s'), method)
    return getattr(Builder(), method)(*args, **kwargs)
317411
function dobrodcast( /* ...types*/ ) {
		gui.Array.make(arguments).forEach(function(type) {
			gui.Broadcast.dispatch(type);
		});
	}
325316
private static <L> Map<Name, TypeSet<ResourceType<L>>> buildTypeMapForConstructor(
            Collection<ResourceType<L>> allTypes) {
        TypeSetBuilder<ResourceType<L>> bldr = TypeSet.<ResourceType<L>> builder();
        bldr.enabled(true);
        bldr.name(new Name("all"));
        for (ResourceType<L> type : allTypes) {
            bldr.type(type);
        }
        TypeSet<ResourceType<L>> typeSet = bldr.build();

        return Collections.singletonMap(typeSet.getName(), typeSet);
    }
202860
function defineRootTokenBuilder(Type) {
    return (node, _parentToken, html, sourceCodeStore, lastIndex) => {
        const token = new Type(html, 0, lastIndex, sourceCodeStore)
        token.children = buildChildTokens(
            node,
            token,
            html,
            sourceCodeStore,
            lastIndex
        )
        return token
    }
}
1007793
@Nonnull
	public static <T> LObjBiIntPredicate<T> objBiIntPredicateFrom(Consumer<LObjBiIntPredicateBuilder<T>> buildingFunction) {
		LObjBiIntPredicateBuilder builder = new LObjBiIntPredicateBuilder();
		buildingFunction.accept(builder);
		return builder.build();
	}
334391
function bundler(entry, options, callback) {
  make_sure(options, 'pkg')
  make_sure(options, 'cwd')

  if (Object(options.babel) !== options.babel && options.babel !== false) {
    options.babel = {}
  }

  options.babel = mix({
    presets: ['es2015']
  }, options.babel, false)

  return new Builder(options).parse(entry, callback)
}
778573
@Nonnull
	public static LBiCharPredicate biCharPredicateFrom(Consumer<LBiCharPredicateBuilder> buildingFunction) {
		LBiCharPredicateBuilder builder = new LBiCharPredicateBuilder();
		buildingFunction.accept(builder);
		return builder.build();
	}