/* (non-Javadoc)
@see org.kie.spi.Accumulator#init(java.lang.Object, org.kie.spi.Tuple, org.kie.rule.Declaration[], org.kie.WorkingMemory)
329651
public void init(Object workingMemoryContext,
                     Object context,
                     Tuple leftTuple,
                     Declaration[] declarations,
                     WorkingMemory workingMemory) throws Exception {
        ((CollectContext) context).result = this.collect.instantiateResultObject( (InternalWorkingMemory) workingMemory );
    }
77071
private void init(int initCapacity) {
        assert (initCapacity & -initCapacity) == initCapacity; // power of 2
        assert initCapacity >= MINIMUM_CAPACITY;
        assert initCapacity <= MAXIMUM_CAPACITY;

        threshold = (initCapacity * 3)/ 4;
        table = new long[2 * initCapacity];
    }
258835
void init(double[][] proximity) {
        size = proximity.length;
        this.proximity = new float[size * (size+1) / 2];

        // row wise
        /*
        for (int i = 0, k = 0; i < size; i++) {
            double[] pi = proximity[i];
            for (int j = 0; j <= i; j++, k++) {
                this.proximity[k] = (float) pi[j];
            }
        }
        */

        // column wise
        for (int j = 0, k = 0; j < size; j++) {
            for (int i = j; i < size; i++, k++) {
                this.proximity[k] = (float) proximity[i][j];
            }
        }
    }
1135608
private void init() {

		handlers.put(FlowType.Action,   	new ActionHandler());
		handlers.put(FlowType.Decision, 	new DecisionHandler());
		handlers.put(FlowType.Return,   	new ReturnHandler());
		handlers.put(FlowType.ForEach,  	new ForEachHandler());
		handlers.put(FlowType.Store, 		new StoreHandler());
		handlers.put(FlowType.Aggregation,  new AggregationHandler());
		handlers.put(FlowType.Exception, 	new ExceptionHandler());
		handlers.put(FlowType.Filter,		new FilterHandler());
		handlers.put(FlowType.Fork,			new ForkHandler());
	}
1342336
private void init(){

		errorProducerEnabled = MoskitoConfigurationHolder.getConfiguration().getBuiltinProducersConfig().isErrorProducer();

		statsMap = new ConcurrentHashMap<>();
        statsList = new CopyOnWriteArrayList<>();

		cumulatedStats = new ErrorStats("cumulated");
		statsList.add(cumulatedStats);

		catchers = new ConcurrentHashMap<>();

		//it is complicated to actually remove the error producer from the system if disabled, but the flag renders it invisible and
		//disables most methos.
		if (!errorProducerEnabled)
			return;

		ProducerRegistryFactory.getProducerRegistryInstance().registerProducer(this);


		//add charts for cumulated errors.
		AfterStartTasks.submitTask(new Runnable() {
			@Override
			public void run() {
				AccumulatorRepository.getInstance().createAccumulator(createAccumulatorDefinition("Errors.Cumulated.Total", "total", "cumulated"));
			}
		});
		AfterStartTasks.submitTask(new Runnable() {
			@Override
			public void run() {
				AccumulatorRepository.getInstance().createAccumulator(createAccumulatorDefinition("Errors.Cumulated.Initial", "initial", "cumulated"));
			}
		});

		errorHandlingConfig = null;
	}
376954
static void init(boolean includeAddOns) {
        loadedPlugins = new ArrayList<>(CoreFunctionality.getBuiltInActiveScanRules());
        if (includeAddOns) {
            loadedPlugins.addAll(ExtensionFactory.getAddOnLoader().getActiveScanRules());
        }
        //sort by the criteria below.
        Collections.sort(loadedPlugins, riskComparator);

        mapLoadedPlugins = new HashMap<>();
        for (Plugin plugin : loadedPlugins) {
            checkPluginId(plugin);
            mapLoadedPlugins.put(plugin.getId(), plugin);
        }
    }
1268123
@Override
    protected void initializeImpl()
    {
        super.initializeImpl();

        //init maps
        this.faxActionType2ReponseDataPathMap=new HashMap<FaxActionType,String>();
        this.statusString2FaxStatusMap=new HashMap<String,FaxJobStatus>();

        //populate maps
        this.populateFaxActionType2ReponseDataPathMappings();
        this.populateStatusString2FaxStatusMappings();

        //set error values
        Enum<?> configurationKey=this.getErrorDetectionPathPropertyKey();
        this.errorDetectionPath=this.getConfigurationValue(configurationKey);
        configurationKey=this.getErrorDetectionValuePropertyKey();
        this.errorDetectionValue=this.getConfigurationValue(configurationKey);
        configurationKey=this.getErrorMessagePathPropertyKey();
        this.errorMessagePath=this.getConfigurationValue(configurationKey);
    }
1328896
public void init(
            boolean forEncryption,
            KeyParameter params) {

        WorkingKey = generateWorkingKey(params.getKey(), forEncryption);
        this.forEncryption = forEncryption;
    }
1350077
void init()
    {
        view.set(new View(
                         ImmutableList.of(new Memtable(cfstore)),
                         ImmutableList.<Memtable>of(),
                         Collections.<SSTableReader, SSTableReader>emptyMap(),
                         Collections.<SSTableReader>emptySet(),
                         Collections.<SSTableReader>emptySet(),
                         SSTableIntervalTree.empty()));
    }
1319016
public void init(Marshaller marshaller, OperationsFactory operationsFactory,
                    int estimateKeySize, int estimateValueSize, int batchSize) {
      this.defaultMarshaller = marshaller;
      this.operationsFactory = operationsFactory;
      this.estimateKeySize = estimateKeySize;
      this.estimateValueSize = estimateValueSize;
      this.batchSize = batchSize;
      this.dataFormat = defaultDataFormat;
   }
851100
private void initializeIfNeeded() throws BackendInitializationException,
            BackendNewInstanceException {
        if (isClosed()) {
            throw new IllegalStateException("Knowledge source already closed!");
        }
        if (this.inDataSourceGetter == null) {
            this.inDataSourceGetter
                    = new SubtreePropositionDefinitionGetterRegular(this, true);
        }
        if (this.collectSubtreeGetter == null) {
            this.collectSubtreeGetter
                    = new SubtreePropositionDefinitionGetterRegular(this, false);
        }
    }
336192
private void init() {
        // null implies "no expression"
        value_ = type_ = pattern_ = null;
        currencyCode_ = currencySymbol_ = null;
        groupingUsed_ = null;
        maxIntegerDigits_ = minIntegerDigits_ = null;
        maxFractionDigits_ = minFractionDigits_ = null;
    }
549453
@SuppressWarnings("unchecked")
    @SneakyThrows
    public void init(final FillerRuleDefinitionEntity fillerRuleDefinitionEntity) {
        for (FillerRuleEntity each : fillerRuleDefinitionEntity.getRules()) {
            rules.put((Class<? extends SQLSegment>) Class.forName(each.getSqlSegmentClass()), (SQLSegmentFiller) Class.forName(each.getFillerClass()).newInstance());
        }
    }
282147
@Override
    protected void initializeImpl()
    {
        //init data structures
        this.data=new HashMap<FaxClientSpi,Map<FaxJob,FaxJobStatus>>(20);

        //get polling interval
        String value=this.getConfigurationValue(FaxJobMonitorImpl.POLLING_INTERVAL_IN_MILLIES_PROPERTY_KEY);
        this.pollingInterval=5000;
        if(value!=null)
        {
            this.pollingInterval=Long.parseLong(value);
            if(this.pollingInterval<=0)
            {
                throw new FaxException("Polling interval set to an invalid value: "+this.pollingInterval);
            }
        }
        
        //get fixed polling interval flag
        value=this.getConfigurationValue(FaxJobMonitorImpl.FIXED_POLLING_INTERVAL_PROPERTY_KEY);
        this.fixedPollingInterval=Boolean.parseBoolean(value);
        
        //get poller thread priority
        value=this.getConfigurationValue(FaxJobMonitorImpl.POLLING_THREAD_PRIORITY_PROPERTY_KEY);
        this.pollingThreadPriority=2;
        if(value!=null)
        {
            this.pollingThreadPriority=Integer.parseInt(value);
            if((this.pollingThreadPriority<Thread.MIN_PRIORITY)||(this.pollingThreadPriority>Thread.MAX_PRIORITY))
            {
                throw new FaxException("Polling thread priority set to an invalid value: "+this.pollingThreadPriority);
            }
        }
        
        //create poller task
        this.pollerTask=new PollerTask(this);
    }
884735
public final void variableInitializer() throws RecognitionException {
		int variableInitializer_StartIndex = input.index();

		try {
			if ( state.backtracking>0 && alreadyParsedRule(input, 44) ) { return; }

			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:495:5: ( arrayInitializer | expression )
			int alt60=2;
			int LA60_0 = input.LA(1);
			if ( (LA60_0==121) ) {
				alt60=1;
			}
			else if ( ((LA60_0 >= CharacterLiteral && LA60_0 <= DecimalLiteral)||LA60_0==FloatingPointLiteral||(LA60_0 >= HexLiteral && LA60_0 <= Identifier)||(LA60_0 >= OctalLiteral && LA60_0 <= StringLiteral)||LA60_0==29||LA60_0==36||(LA60_0 >= 40 && LA60_0 <= 41)||(LA60_0 >= 44 && LA60_0 <= 45)||LA60_0==53||LA60_0==65||LA60_0==67||(LA60_0 >= 70 && LA60_0 <= 71)||LA60_0==77||(LA60_0 >= 79 && LA60_0 <= 80)||LA60_0==82||LA60_0==85||LA60_0==92||LA60_0==94||(LA60_0 >= 97 && LA60_0 <= 98)||LA60_0==105||LA60_0==108||LA60_0==111||LA60_0==115||LA60_0==118||LA60_0==126) ) {
				alt60=2;
			}

			else {
				if (state.backtracking>0) {state.failed=true; return;}
				NoViableAltException nvae =
					new NoViableAltException("", 60, 0, input);
				throw nvae;
			}

			switch (alt60) {
				case 1 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:495:7: arrayInitializer
					{
					pushFollow(FOLLOW_arrayInitializer_in_variableInitializer1507);
					arrayInitializer();
					state._fsp--;
					if (state.failed) return;
					}
					break;
				case 2 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:496:9: expression
					{
					pushFollow(FOLLOW_expression_in_variableInitializer1517);
					expression();
					state._fsp--;
					if (state.failed) return;
					}
					break;

			}
		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
		}
		finally {
			// do for sure before leaving
			if ( state.backtracking>0 ) { memoize(input, 44, variableInitializer_StartIndex); }

		}
	}
61212
public void accumulate(Object workingMemoryContext,
                           Object context,
                           Tuple tuple,
                           InternalFactHandle handle,
                           Declaration[] declarations,
                           Declaration[] innerDeclarations,
                           WorkingMemory workingMemory) throws Exception {
        Object[]  localVars = ((MVELAccumulatorContext) context).getVariables();
        MVELAccumulatorFactoryContext factoryContext = (MVELAccumulatorFactoryContext)workingMemoryContext;
        VariableResolverFactory factory = factoryContext.getActionFactory();
        actionUnit.updateFactory( handle, tuple, localVars, (InternalWorkingMemory) workingMemory, workingMemory.getGlobalResolver(), factory );

        DroolsVarFactory df = ( DroolsVarFactory ) factory.getNextFactory();
        
        if ( reverse != null ) {
            Object[] shadow = new Object [df.getOtherVarsPos()];
            for ( int i = 0; i < df.getOtherVarsPos(); i++ ) {
                shadow[i] = factory.getIndexedVariableResolver( i ).getValue();
                
                
            }
            // SNAPSHOT variable values
            ((MVELAccumulatorContext) context).getShadow().put( handle.getId(), shadow);
        }
        MVELSafeHelper.getEvaluator().executeExpression( this.action,
                                null,
                                factory );
        
        
        if ( localVars.length > 0 ) {
            for ( int i = 0; i < df.getOtherVarsLength(); i++ ) {
                localVars[i] = factory.getIndexedVariableResolver( df.getOtherVarsPos() + i ).getValue();
            }
        }
        
        ((MVELAccumulatorContext) context).setVariables( localVars );        
    }
850979
@Override
    protected void init(Object target, PropertyInfo propInfo, PropertyGrid propGrid) {
        super.init(target, propInfo, propGrid);

        Iterable<?> iter = (Iterable<?>) propInfo.getPropertyType().getSerializer();

        for (Object value : iter) {
            appendItem(value.toString(), value);
        }

    }