public bool Generate(int sampleID) { wfc = new WFCOverlayMode(sampleTextures[sampleID], N, Width, Height, PeriodicInput, PeriodicOutput, Symmetry, Ground); bool ret = false; if (UseSeed) { ret = wfc.Run(Seed, Limit); } else { ret = wfc.Run(Limit); } Bitmap bmp = wfc.Graphics(); if (wfc.Success) { _callback?.Invoke(bmp); } if (renderer != null) { Texture tex = TextureLoader.BitmapToTexture(bmp, "WFCGeneratedMap"); ChangeTexture(tex); } return(ret); }
private void ScheduleCallback() { _isCallbackScheduled = true; var current = _context.StatementContext.SchedulingService.Time; if ((ExecutionPathDebugLog.IsEnabled) && (Log.IsDebugEnabled)) { Log.Debug( ".scheduleCallback Scheduled new callback for " + " now=" + current + " currentReferencePoint=" + _currentReferencePoint + " spec=" + _factory.ScheduleSpec); } var callback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = extensionServicesContext => Instrument.With( i => i.QOutputRateConditionScheduledEval(), i => i.AOutputRateConditionScheduledEval(), () => { _isCallbackScheduled = false; OutputCallback.Invoke(DO_OUTPUT, FORCE_UPDATE); ScheduleCallback(); }) }; var handle = new EPStatementHandleCallback(_context.EpStatementAgentInstanceHandle, callback); var schedulingService = _context.StatementContext.SchedulingService; var nextScheduledTime = ScheduleComputeHelper.ComputeDeltaNextOccurance( _factory.ScheduleSpec, schedulingService.Time, _context.StatementContext.MethodResolutionService.EngineImportService.TimeZone); schedulingService.Add(nextScheduledTime, handle, _scheduleSlot); }
public override void UpdateOutputCondition(int newDataCount, int oldDataCount) { if (_variableReader != null) { var value = _variableReader.Value; if (value != null) { _eventRate = value.AsLong(); } } _newEventsCount += newDataCount; _oldEventsCount += oldDataCount; if ((ExecutionPathDebugLog.IsEnabled) && (Log.IsDebugEnabled)) { Log.Debug(".updateBatchCondition, " + " newEventsCount==" + _newEventsCount + " oldEventsCount==" + _oldEventsCount); } if (IsSatisfied) { if ((ExecutionPathDebugLog.IsEnabled) && (Log.IsDebugEnabled)) { Log.Debug(".UpdateOutputCondition() condition satisfied"); } _newEventsCount = 0; _oldEventsCount = 0; OutputCallback.Invoke(DO_OUTPUT, FORCE_UPDATE); } }
private void ContinueOutputProcessing(bool forceUpdate) { var doOutput = !_witnessedFirst; OutputCallback.Invoke(doOutput, forceUpdate); _witnessedFirst = false; }
private void ScheduleCallback() { _isCallbackScheduled = true; long current = _agentInstanceContext.StatementContext.SchedulingService.Time; if ((ExecutionPathDebugLog.IsEnabled) && (Log.IsDebugEnabled)) { Log.Debug( ".scheduleCallback Scheduled new callback for " + " afterMsec=" + 0 + " now=" + current); } ScheduleHandleCallback callback = new ProxyScheduleHandleCallback() { ProcScheduledTrigger = extensionServicesContext => Instrument.With( i => i.QOutputRateConditionScheduledEval(), i => i.AOutputRateConditionScheduledEval(), () => { _isCallbackScheduled = false; OutputCallback.Invoke(true, true); ResetBuiltinProperties(); }) }; _scheduleHandle = new EPStatementHandleCallback( _agentInstanceContext.EpStatementAgentInstanceHandle, callback); _agentInstanceContext.StatementContext.SchedulingService.Add(0, _scheduleHandle, _scheduleSlot); _agentInstanceContext.AddTerminationCallback(Stop); // execute assignments ExecuteThenAssignments(); }
public override void UpdateOutputCondition(int newEventsCount, int oldEventsCount) { if (!_witnessedFirst) { _witnessedFirst = true; const bool doOutput = true; const bool forceUpdate = false; OutputCallback.Invoke(doOutput, forceUpdate); } _innerCondition.UpdateOutputCondition(newEventsCount, oldEventsCount); }
public void WriteLine(string line) { lock (_locker) { if (_streamWriter != null) { _streamWriter.WriteLine(line); } _callback?.Invoke(line); } }
public override void UpdateOutputCondition(int newEventsCount, int oldEventsCount) { _totalNewEventsCount += newEventsCount; _totalOldEventsCount += oldEventsCount; _totalNewEventsSum += newEventsCount; _totalOldEventsSum += oldEventsCount; bool isOutput = Evaluate(_parent.WhenExpressionNodeEval); if (isOutput) { ExecuteThenAssignments(); OutputCallback.Invoke(true, true); ResetBuiltinProperties(); } }
private void ScheduleCallback() { _isCallbackScheduled = true; var current = _context.StatementContext.SchedulingService.Time; var delta = _parent.TimePeriod.NonconstEvaluator().DeltaAddWReference(current, _currentReferencePoint.Value, null, true, _context); var deltaTime = delta.Delta; _currentReferencePoint = delta.LastReference; _currentScheduledTime = deltaTime; if ((ExecutionPathDebugLog.IsEnabled) && (Log.IsDebugEnabled)) { Log.Debug(".scheduleCallback Scheduled new callback for " + " afterMsec=" + deltaTime + " now=" + current + " currentReferencePoint=" + _currentReferencePoint); } var callback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = (extensionServicesContext) => { if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().QOutputRateConditionScheduledEval(); } _isCallbackScheduled = false; OutputCallback.Invoke(DO_OUTPUT, FORCE_UPDATE); ScheduleCallback(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().AOutputRateConditionScheduledEval(); } } }; _handle = new EPStatementHandleCallback(_context.EpStatementAgentInstanceHandle, callback); _context.StatementContext.SchedulingService.Add(deltaTime, _handle, _scheduleSlot); _context.AddTerminationCallback(this); }
private void ScheduleCallback() { _isCallbackScheduled = true; long current = _context.StatementContext.SchedulingService.Time; ExprTimePeriodEvalDeltaResult delta = _parent.TimePeriod.NonconstEvaluator().DeltaMillisecondsAddWReference( current, _currentReferencePoint.Value, null, true, _context); long afterMSec = delta.Delta; _currentReferencePoint = delta.LastReference; _currentScheduledTime = afterMSec; if ((ExecutionPathDebugLog.IsEnabled) && (Log.IsDebugEnabled)) { Log.Debug( ".scheduleCallback Scheduled new callback for " + " afterMsec=" + afterMSec + " now=" + current + " currentReferencePoint=" + _currentReferencePoint); } ScheduleHandleCallback callback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = extensionServicesContext => Instrument.With( i => i.QOutputRateConditionScheduledEval(), i => i.AOutputRateConditionScheduledEval(), () => { _isCallbackScheduled = false; OutputCallback.Invoke(DO_OUTPUT, FORCE_UPDATE); ScheduleCallback(); }) }; _handle = new EPStatementHandleCallback(_context.EpStatementAgentInstanceHandle, callback); _context.StatementContext.SchedulingService.Add(afterMSec, _handle, _scheduleSlot); _context.AddTerminationCallback(new ProxyStopCallback(Stop)); }
public virtual void Terminated() { OutputCallback.Invoke(true, true); }
public override void Terminated() { OutputCallback.Invoke(true, true); }
public override void UpdateOutputCondition(int newEventsCount, int oldEventsCount) { OutputCallback.Invoke(DO_OUTPUT, FORCE_UPDATE); }
private void OnOutputCallback(OutputCallbackEventArgs e) { OutputCallback?.Invoke(this, e); }