Outputs code to invoke the given child's initialize*() routines via its
member variable.
490762
private void outputSubInitialize(GinjectorBindings child, String childGetterName,
      StringBuilder initializeEagerSingletonsBody, StringBuilder initializeStaticInjectionsBody) {

    if (child.hasEagerSingletonBindingInSubtree()) {
      initializeEagerSingletonsBody
          .append(childGetterName)
          .append("().initializeEagerSingletons();\n");
    }

    if (child.hasStaticInjectionRequestInSubtree()) {
      initializeStaticInjectionsBody
          .append(childGetterName)
          .append("().initializeStaticInjections();\n");
    }
  }
1063965
public static void println(PrintWriter self, Object value) {
        self.println(InvokerHelper.toString(value));
    }
553290
function invoke() {
        parent::invoke();

        $result = true;

        // Set own core attributes
        //$this->does_generate = ACTION_NONE;
        $this->does_generate = ACTION_GENERATE_HTML;

        // These are always here
        global $CFG, $XMLDB;

        // Do the job, setting result as needed

        if (!data_submitted()) { // Basic prevention
            print_error('wrongcall', 'error');
        }

        // Get parameters
        $dirpath = required_param('dir', PARAM_PATH);
        $dirpath = $CFG->dirroot . $dirpath;

        $tableparam = strtolower(required_param('table', PARAM_PATH));
        $fieldparam = strtolower(required_param('field', PARAM_PATH));
        $name = substr(trim(strtolower(optional_param('name', $fieldparam, PARAM_PATH))),0,xmldb_field::NAME_MAX_LENGTH);

        $comment = required_param('comment', PARAM_CLEAN);
        $comment = trim($comment);

        $type       = required_param('type', PARAM_INT);
        $length     = strtolower(optional_param('length', NULL, PARAM_ALPHANUM));
        $decimals   = optional_param('decimals', NULL, PARAM_INT);
        $notnull    = optional_param('notnull', false, PARAM_BOOL);
        $sequence   = optional_param('sequence', false, PARAM_BOOL);
        $default    = optional_param('default', NULL, PARAM_PATH);
        $default    = trim($default);

        $editeddir = $XMLDB->editeddirs[$dirpath];
        $structure = $editeddir->xml_file->getStructure();
        $table = $structure->getTable($tableparam);
        $field = $table->getField($fieldparam);
        $oldhash = $field->getHash();

        $errors = array(); // To store all the errors found

        // Perform some automatic assumptions
        if ($sequence) {
            $notnull  = true;
            $default  = NULL;
        }
        if ($type != XMLDB_TYPE_NUMBER && $type != XMLDB_TYPE_FLOAT) {
            $decimals = NULL;
        }
        if ($type == XMLDB_TYPE_BINARY) {
            $default = NULL;
        }
        if ($default === '') {
            $default = NULL;
        }

        // Perform some checks
        // Check empty name
        if (empty($name)) {
            $errors[] = $this->str['fieldnameempty'];
        }
        // Check incorrect name
        if ($name == 'changeme') {
            $errors[] = $this->str['incorrectfieldname'];
        }
        // Check duplicate name
        if ($fieldparam != $name && $table->getField($name)) {
            $errors[] = $this->str['duplicatefieldname'];
        }
        // Integer checks
        if ($type == XMLDB_TYPE_INTEGER) {
            if (!(is_numeric($length) && !empty($length) && intval($length)==floatval($length) &&
                  $length > 0 && $length <= xmldb_field::INTEGER_MAX_LENGTH)) {
                $errors[] = $this->str['integerincorrectlength'];
            }
            if (!(empty($default) || (is_numeric($default) &&
                                       !empty($default) &&
                                       intval($default)==floatval($default)))) {
                $errors[] = $this->str['defaultincorrect'];
            }
        }
        // Number checks
        if ($type == XMLDB_TYPE_NUMBER) {
            if (!(is_numeric($length) && !empty($length) && intval($length)==floatval($length) &&
                  $length > 0 && $length <= xmldb_field::NUMBER_MAX_LENGTH)) {
                $errors[] = $this->str['numberincorrectlength'];
            }
            if (!(empty($decimals) || (is_numeric($decimals) &&
                                       !empty($decimals) &&
                                       intval($decimals)==floatval($decimals) &&
                                       $decimals >= 0 &&
                                       $decimals < $length))) {
                $errors[] = $this->str['numberincorrectdecimals'];
            }
            if (!empty($decimals) && ($length - $decimals > xmldb_field::INTEGER_MAX_LENGTH)) {
                $errors[] = $this->str['numberincorrectwholepart'];
            }
            if (!(empty($default) || (is_numeric($default) &&
                                       !empty($default)))) {
                $errors[] = $this->str['defaultincorrect'];
            }
        }
        // Float checks
        if ($type == XMLDB_TYPE_FLOAT) {
            if (!(empty($length) || (is_numeric($length) &&
                                     !empty($length) &&
                                     intval($length)==floatval($length) &&
                                     $length > 0 &&
                                     $length <= xmldb_field::FLOAT_MAX_LENGTH))) {
                $errors[] = $this->str['floatincorrectlength'];
            }
            if (!(empty($decimals) || (is_numeric($decimals) &&
                                       !empty($decimals) &&
                                       intval($decimals)==floatval($decimals) &&
                                       $decimals >= 0 &&
                                       $decimals < $length))) {
                $errors[] = $this->str['floatincorrectdecimals'];
            }
            if (!(empty($default) || (is_numeric($default) &&
                                       !empty($default)))) {
                $errors[] = $this->str['defaultincorrect'];
            }
        }
        // Char checks
        if ($type == XMLDB_TYPE_CHAR) {
            if (!(is_numeric($length) && !empty($length) && intval($length)==floatval($length) &&
                  $length > 0 && $length <= xmldb_field::CHAR_MAX_LENGTH)) {
                $errors[] = $this->str['charincorrectlength'];
            }
            if ($default !== NULL && $default !== '') {
                if (substr($default, 0, 1) == "'" ||
                    substr($default, -1, 1) == "'") {
                    $errors[] = $this->str['defaultincorrect'];
                }
            }
        }
        // No text checks
        // No binary checks

        if (!empty($errors)) {
            $tempfield = new xmldb_field($name);
            $tempfield->setType($type);
            $tempfield->setLength($length);
            $tempfield->setDecimals($decimals);
            $tempfield->setNotNull($notnull);
            $tempfield->setSequence($sequence);
            $tempfield->setDefault($default);
            // Prepare the output
            $o = '<p>' .implode(', ', $errors) . '</p>
                  <p>' . $name . ': ' . $tempfield->readableInfo() . '</p>';
            $o.= '<a href="index.php?action=edit_field&amp;field=' . $field->getName() . '&amp;table=' . $table->getName() .
                 '&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['back'] . ']</a>';
            $this->output = $o;
        }

        // Continue if we aren't under errors
        if (empty($errors)) {
            // If there is one name change, do it, changing the prev and next
            // atributes of the adjacent fields
            if ($fieldparam != $name) {
                $field->setName($name);
                if ($field->getPrevious()) {
                    $prev = $table->getField($field->getPrevious());
                    $prev->setNext($name);
                    $prev->setChanged(true);
                }
                if ($field->getNext()) {
                    $next = $table->getField($field->getNext());
                    $next->setPrevious($name);
                    $next->setChanged(true);
                }
            }

            // Set comment
            $field->setComment($comment);

            // Set the rest of fields
            $field->setType($type);
            $field->setLength($length);
            $field->setDecimals($decimals);
            $field->setNotNull($notnull);
            $field->setSequence($sequence);
            $field->setDefault($default);

            // If the hash has changed from the old one, change the version
            // and mark the structure as changed
            $field->calculateHash(true);
            if ($oldhash != $field->getHash()) {
                $field->setChanged(true);
                $table->setChanged(true);
                // Recalculate the structure hash
                $structure->calculateHash(true);
                $structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
                // Mark as changed
                $structure->setChanged(true);
            }

            // Launch postaction if exists (leave this here!)
            if ($this->getPostAction() && $result) {
                return $this->launch($this->getPostAction());
            }
        }

        // Return ok if arrived here
        return $result;
    }
1241173
public void init(VariableScope el, Parameter[] parameters) {
        if (!clear) throw new GroovyBugError("CompileStack#init called without calling clear before");
        clear=false;
        pushVariableScope(el);
        defineMethodVariables(parameters,el.isInStaticContext());
        this.className = BytecodeHelper.getTypeDescription(controller.getClassNode());
    }
295145
protected void initOutputs() throws Exception {
		this.chainedTasks = new ArrayList<ChainedDriver<?, ?>>();
		this.eventualOutputs = new ArrayList<RecordWriter<?>>();

		ClassLoader userCodeClassLoader = getUserCodeClassLoader();

		this.accumulatorMap = getEnvironment().getAccumulatorRegistry().getUserMap();

		this.output = initOutputs(this, userCodeClassLoader, this.config, this.chainedTasks, this.eventualOutputs,
				this.getExecutionConfig(), this.accumulatorMap);
	}
120742
@Override
    public void init(final String scope) throws InitializationException, InterruptedException {
        try {
            init(ScopeProcessor.generateScope(scope));
        } catch (CouldNotPerformException | NullPointerException ex) {
            throw new InitializationException(this, ex);
        }
    }
154634
function process( $tpl, &$textElements, $functionName, $functionChildren, $functionParameters, $functionPlacement, $rootNamespace, $currentNamespace )
    {
        switch ( $functionName )
        {
            case $this->TimingPointName:
            {
                $children = $functionChildren;
                $parameters = $functionParameters;

                $id = false;
                if ( isset( $parameters["id"] ) )
                {
                    $id = $tpl->elementValue( $parameters["id"], $rootNamespace, $currentNamespace, $functionPlacement );
                }


                $startDescription = "debug-timing-point START: $id";
                eZDebug::addTimingPoint( $startDescription );

                if ( is_array( $children ) )
                {
                    foreach ( array_keys( $children ) as $childKey )
                    {
                        $child =& $children[$childKey];
                        $tpl->processNode( $child, $textElements, $rootNamespace, $currentNamespace );
                    }
                }

                $endDescription = "debug-timing-point END: $id";
                eZDebug::addTimingPoint( $endDescription );

            } break;

            case $this->AccumulatorName:
            {
                $children = $functionChildren;
                $parameters = $functionParameters;

                $id = false;
                if ( isset( $parameters["id"] ) )
                {
                    $id = $tpl->elementValue( $parameters["id"], $rootNamespace, $currentNamespace, $functionPlacement );
                }

                $name = false;
                if ( isset( $parameters["name"] ) )
                {
                    $name = $tpl->elementValue( $parameters["name"], $rootNamespace, $currentNamespace, $functionPlacement );
                }

                // Assign a name (as $functionName) which will be used in the debug output.
                $name = ( $name === false and $id === false ) ?  $functionName : $name;
                // To uniquely identify this accumulator.
                $id = $id === false ? uniqID( $functionName . '_' ): $id;

                eZDebug::accumulatorStart( $id, 'Debug-Accumulator', $name );

                if ( is_array( $children ) )
                {
                    foreach ( array_keys( $children ) as $childKey )
                    {
                        $child =& $children[$childKey];
                        $tpl->processNode( $child, $textElements, $rootNamespace, $currentNamespace );
                    }
                }

                eZDebug::accumulatorStop( $id );

            } break;

            case $this->LogName:
            {
                $parameters = $functionParameters;

                if ( isset( $parameters['var'] ) )
                    $var = $tpl->elementValue( $parameters['var'], $rootNamespace, $currentNamespace, $functionPlacement );
                if ( isset( $parameters['msg'] ) )
                    $msg = $tpl->elementValue( $parameters['msg'], $rootNamespace, $currentNamespace, $functionPlacement );

                if ( isset( $var ) && isset( $msg ) )
                    eZDebug::writeDebug( $var, $msg );
                elseif ( isset( $msg ) )
                    eZDebug::writeDebug( $msg );
                elseif ( isset( $var ) )
                    eZDebug::writeDebug( $var );
            } break;

            case $this->TraceName:
            {
                $children = $functionChildren;

                $id = false;
                // If we have XDebug we start the trace, execute children and stop it
                // if not we just execute the children as normal
                if ( extension_loaded( 'xdebug' ) )
                {
                    $parameters = $functionParameters;
                    if ( isset( $parameters["id"] ) )
                    {
                        $id = $tpl->elementValue( $parameters["id"], $rootNamespace, $currentNamespace, $functionPlacement );
                    }

                    if ( !$id )
                        $id = 'template-debug';

                    // If we already have a file, make sure it is truncated
                    if ( file_exists( $id . '.xt' ) )
                    {
                        $fd = fopen( $id, '.xt', 'w' ); fclose( $fd );
                    }
                    xdebug_start_trace( $id );

                    if ( is_array( $children ) )
                    {
                        foreach ( array_keys( $children ) as $childKey )
                        {
                            $child =& $children[$childKey];
                            $tpl->processNode( $child, $textElements, $rootNamespace, $currentNamespace );
                        }
                    }

                    xdebug_stop_trace();
                }
                elseif ( is_array( $children ) )
                {
                    foreach ( array_keys( $children ) as $childKey )
                    {
                        $child =& $children[$childKey];
                        $tpl->processNode( $child, $textElements, $rootNamespace, $currentNamespace );
                    }
                }

            } break;
        }
    }
1182271
private void initTemplates() throws Exception {
        if (templates != null && templates.length > 0) {
            for (String template : templates) {
                Assert.hasText(template, "Can not read template in ["
                        + template
                        + "]. Check that templates is not empty.");
                createTemplate(client.getLowLevelClient(), classpathRoot, template, forceTemplate);
            }
        }
    }
366589
def augment_init_method(cls):
    

    orig_init = cls.__init__

    def new_init(self, *args, **kwargs):
        super(CustomGenerator, self).__init__()  # TODO: does this behave correctly with longer inheritance chains?

        orig_init(self, *args, **kwargs)

        self.orig_args = args
        self.orig_kwargs = kwargs

        self.ns_gen_templates = TohuNamespace()
        self.ns_gen_templates.update_from_dict(self.__class__.__dict__)
        self.ns_gen_templates.update_from_dict(self.__dict__)
        self.ns_gen_templates.set_owner(self.__class__)
        self._mark_field_generator_templates()

        self.ns_gens = self.ns_gen_templates.spawn()
        self.ns_gens.set_owner(self)

        self._update_namespace_with_field_generators()
        self._set_field_names()
        self._set_tohu_items_name()
        self._set_tohu_items_cls()

    cls.__init__ = new_init
403926
def _children(self):
        """"""
        if self.method_of:
            yield self.method_of
        for codeobj in self.arguments:
            if isinstance(codeobj, CodeExpression):
                yield codeobj
938319
def _generate_struct_class_init(self, data_type):
        

        args = ['self']
        for field in data_type.all_fields:
            field_name_reserved_check = fmt_var(field.name, True)
            args.append('%s=None' % field_name_reserved_check)

        self.generate_multiline_list(args, before='def __init__', after=':')

        with self.indent():
            lineno = self.lineno

            # Call the parent constructor if a super type exists
            if data_type.parent_type:
                class_name = class_name_for_data_type(data_type)
                all_parent_fields = [fmt_func(f.name, check_reserved=True)
                              for f in data_type.parent_type.all_fields]
                self.generate_multiline_list(
                    all_parent_fields,
                    before='super({}, self).__init__'.format(class_name))

            # initialize each field
            for field in data_type.fields:
                field_var_name = fmt_var(field.name)
                self.emit('self._{}_value = None'.format(field_var_name))
                self.emit('self._{}_present = False'.format(field_var_name))

            # handle arguments that were set
            for field in data_type.fields:
                field_var_name = fmt_var(field.name, True)
                self.emit('if {} is not None:'.format(field_var_name))
                with self.indent():
                    self.emit('self.{0} = {0}'.format(field_var_name))

            if lineno == self.lineno:
                self.emit('pass')
            self.emit()
1122101
def init():
    
    loop = asyncio.get_event_loop()
    if loop.is_running():
        raise Exception("You must initialize the Ray async API by calling "
                        "async_api.init() or async_api.as_future(obj) before "
                        "the event loop starts.")
    else:
        asyncio.get_event_loop().run_until_complete(_async_init())
238483
function (iterator, context) {
        _.forEach(this.members, _.isFunction(iterator) ? iterator.bind(context || this.__parent) : iterator);
    }
427454
public void init(Compiler compiler, int opPos, int stepType)
          throws javax.xml.transform.TransformerException
  {

    super.init(compiler, opPos, stepType);

    // Smooth over an anomily in the opcode map...
    switch (stepType)
    {
    case OpCodes.OP_FUNCTION :
    case OpCodes.OP_EXTFUNCTION :
    	m_mustHardReset = true;
    case OpCodes.OP_GROUP :
    case OpCodes.OP_VARIABLE :
      m_expr = compiler.compile(opPos);
      m_expr.exprSetParent(this);
      //if((OpCodes.OP_FUNCTION == stepType) && (m_expr instanceof org.apache.xalan.templates.FuncKey))
      if(m_expr instanceof org.apache.xpath.operations.Variable)
      {
      	// hack/temp workaround
      	m_canDetachNodeset = false;
      }
      break;
    default :
      m_expr = compiler.compile(opPos + 2);
      m_expr.exprSetParent(this);
    }
//    if(m_expr instanceof WalkingIterator)
//    {
//      WalkingIterator wi = (WalkingIterator)m_expr;
//      if(wi.getFirstWalker() instanceof FilterExprWalker)
//      {
//      	FilterExprWalker fw = (FilterExprWalker)wi.getFirstWalker();
//      	if(null == fw.getNextWalker())
//      	{
//      		m_expr = fw.m_expr;
//      		m_expr.exprSetParent(this);
//      	}
//      }
//      		
//    }
  }
349634
function invoke() {
        parent::invoke();

        $result = true;

        // Set own core attributes
        //$this->does_generate = ACTION_NONE;
        $this->does_generate = ACTION_GENERATE_HTML;

        // These are always here
        global $CFG, $XMLDB;

        // Do the job, setting result as needed

        if (!data_submitted()) { // Basic prevention
            print_error('wrongcall', 'error');
        }

        // Get parameters
        $dirpath = required_param('dir', PARAM_PATH);
        $dirpath = $CFG->dirroot . $dirpath;

        $tableparam = strtolower(required_param('table', PARAM_PATH));
        $indexparam = strtolower(required_param('index', PARAM_PATH));
        $name = trim(strtolower(optional_param('name', $indexparam, PARAM_PATH)));

        $comment = required_param('comment', PARAM_CLEAN);
        $comment = trim($comment);

        $unique = required_param('unique', PARAM_INT);
        $fields = required_param('fields', PARAM_CLEAN);
        $fields = str_replace(' ', '', trim(strtolower($fields)));
        $hints = required_param('hints', PARAM_CLEAN);
        $hints = str_replace(' ', '', trim(strtolower($hints)));

        $editeddir = $XMLDB->editeddirs[$dirpath];
        $structure = $editeddir->xml_file->getStructure();
        $table = $structure->getTable($tableparam);
        $index = $table->getIndex($indexparam);
        $oldhash = $index->getHash();

        $errors = array(); // To store all the errors found

        // Perform some checks
        // Check empty name
        if (empty($name)) {
            $errors[] = $this->str['indexnameempty'];
        }
        // Check incorrect name
        if ($name == 'changeme') {
            $errors[] = $this->str['incorrectindexname'];
        }
        // Check duplicate name
        if ($indexparam != $name && $table->getIndex($name)) {
            $errors[] = $this->str['duplicateindexname'];
        }
        $fieldsarr = explode(',', $fields);
        // Check the fields isn't empty
        if (empty($fieldsarr[0])) {
            $errors[] = $this->str['nofieldsspecified'];
        } else {
            // Check that there aren't duplicate column names
            $uniquearr = array_unique($fieldsarr);
            if (count($fieldsarr) != count($uniquearr)) {
                $errors[] = $this->str['duplicatefieldsused'];
            }
            // Check that all the fields in belong to the table
            foreach ($fieldsarr as $field) {
                if (!$table->getField($field)) {
                    $errors[] = $this->str['fieldsnotintable'];
                    break;
                }
            }
            // Check that there isn't any key using exactly the same fields
            $tablekeys = $table->getKeys();
            if ($tablekeys) {
                foreach ($tablekeys as $tablekey) {
                    $keyfieldsarr = $tablekey->getFields();
                    // Compare both arrays, looking for differences
                    $diferences = array_merge(array_diff($fieldsarr, $keyfieldsarr), array_diff($keyfieldsarr, $fieldsarr));
                    if (empty($diferences)) {
                        $errors[] = $this->str['fieldsusedinkey'];
                        break;
                    }
                }
            }
            // Check that there isn't any index using exactly the same fields
            $tableindexes = $table->getIndexes();
            if ($tableindexes) {
                foreach ($tableindexes as $tableindex) {
                    // Skip checking against itself
                    if ($indexparam == $tableindex->getName()) {
                        continue;
                    }
                    $indexfieldsarr = $tableindex->getFields();
                    // Compare both arrays, looking for differences
                    $diferences = array_merge(array_diff($fieldsarr, $indexfieldsarr), array_diff($indexfieldsarr, $fieldsarr));
                    if (empty($diferences)) {
                        $errors[] = $this->str['fieldsusedinindex'];
                        break;
                    }
                }
            }
        }
        $hintsarr = array();
        foreach (explode(',', $hints) as $hint) {
            $hint = preg_replace('/[^a-z]/', '', $hint);
            if ($hint === '') {
                continue;
            }
            $hintsarr[] = $hint;
        }

        if (!empty($errors)) {
            $tempindex = new xmldb_index($name);
            $tempindex->setUnique($unique);
            $tempindex->setFields($fieldsarr);
            $tempindex->setHints($hintsarr);
            // Prepare the output
            $o = '<p>' .implode(', ', $errors) . '</p>
                  <p>' . $tempindex->readableInfo() . '</p>';
            $o.= '<a href="index.php?action=edit_index&amp;index=' .$index->getName() . '&amp;table=' . $table->getName() .
                 '&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['back'] . ']</a>';
            $this->output = $o;
        }

        // Continue if we aren't under errors
        if (empty($errors)) {
            // If there is one name change, do it, changing the prev and next
            // attributes of the adjacent fields
            if ($indexparam != $name) {
                $index->setName($name);
                if ($index->getPrevious()) {
                    $prev = $table->getIndex($index->getPrevious());
                    $prev->setNext($name);
                    $prev->setChanged(true);
                }
                if ($index->getNext()) {
                    $next = $table->getIndex($index->getNext());
                    $next->setPrevious($name);
                    $next->setChanged(true);
                }
            }

            // Set comment
            $index->setComment($comment);

            // Set the rest of fields
            $index->setUnique($unique);
            $index->setFields($fieldsarr);
            $index->setHints($hintsarr);

            // If the hash has changed from the old one, change the version
            // and mark the structure as changed
            $index->calculateHash(true);
            if ($oldhash != $index->getHash()) {
                $index->setChanged(true);
                $table->setChanged(true);
                // Recalculate the structure hash
                $structure->calculateHash(true);
                $structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
                // Mark as changed
                $structure->setChanged(true);
            }

            // Launch postaction if exists (leave this here!)
            if ($this->getPostAction() && $result) {
                return $this->launch($this->getPostAction());
            }
        }

        // Return ok if arrived here
        return $result;
    }
609668
private void buildAnnotatedInitBehaviour() {
		Method[] methods = this.getClass().getMethods();
		for (Method method : methods) {
			if (method.isAnnotationPresent(FbBotMillInit.class)) {
				try {
					method.invoke(this);
				} catch (Exception e) {
					logger.error(e.getMessage());
				}
			}
		}
	}
1355366
void writeObjectStart() throws IOException {
        output.append('{');
        currentIndent = currentIndent + indent;
        commaDepth++;
        commaState.set(commaDepth, false);
    }