public Conference(string json_str) { dynamic json = JObject.Parse(json_str); var conference = json["conference"]; cid = (int)conference["cid"]; string desc = (string)conference["desc"]; this.desc = Encoding.GetEncoding("gbk").GetString(Convert.FromBase64String(desc)); mode = (string)conference["mode"]; uptime = (double)conference["uptime"]; Streams = new List<Stream>(); foreach (var stream in conference["streams"]) { Stream s = new Stream(); s.streamid = stream["streamid"]; string d = stream["desc"]; if (d == "audio(iLBC)") s.desc = d; else { byte[] raw = Convert.FromBase64String(d); s.desc = Encoding.GetEncoding("gbk").GetString(raw); } s.stat = new Stream.Stat(); s.stat.bytes_recv = stream["stat"]["bytes_recv"]; s.stat.bytes_sent = stream["stat"]["bytes_sent"]; s.stat.jitter = stream["stat"]["jitter"]; s.stat.packet_lost_recv = stream["stat"]["packet_lost_recv"]; s.stat.packet_lost_sent = stream["stat"]["packet_lost_sent"]; s.stat.packet_recv = stream["stat"]["packet_recv"]; s.stat.packet_sent = stream["stat"]["packet_sent"]; Streams.Add(s); } // TODO: Sources = new List<Source>(); Sinks = new List<Sink>(); foreach (var sink in conference["sinks"]) { Sink s = new Sink(); s.sinkid = sink["sinkid"]; string d = sink["desc"]; if (d == "audio(iLBC)") s.desc = d; else { byte[] raw = Convert.FromBase64String(d); s.desc = Encoding.GetEncoding("gbk").GetString(raw); } d = sink["who"]; byte[] who_raw = Convert.FromBase64String(d); s.who = Encoding.GetEncoding("gbk").GetString(who_raw); s.stat = new Sink.Stat(); s.stat.jitter = sink["stat"]["jitter"]; s.stat.packets_lost = sink["stat"]["packets_lost"]; s.stat.packets = sink["stat"]["packets"]; s.stat.sent = sink["stat"]["sent"]; Sinks.Add(s); } }
public Translator getTranslator(Sink sink, IDictionary<IUnit, IContractProvider> contractProviders, IDictionary<IUnit, PdbReader> pdbReaders) { TraverserFactory factory; if (isWholeProgram) factory= new WholeProgram(); else factory= new CLRSemantics(); // Translator translator= factory.MakeMetadataTraverser(sink, contractProviders, pdbReaders); Translator translator= factory.getTranslator(sink, contractProviders, pdbReaders); return translator; }
static void Main(string[] args) { using (var context = ZmqContext.Create()) { var ventilator = new Ventilator(context); var sink = new Sink(context); var stopWatch = new Stopwatch(); stopWatch.Start(); ventilator.Start(); sink.Start(); Console.WriteLine("Hit enter to start"); while (Console.ReadKey(true).Key != ConsoleKey.Enter) { } const int workersCount = 4; var workers = new Thread[workersCount]; for (int i = 0; i < workersCount; i++) { (workers[i] = new Thread(() => new TaskWorker(context).Run())).Start(); } var fileList = EnumerateDirectory(@"C:\Users\keithbloom\Downloads", "*.*", SearchOption.AllDirectories); ventilator.Run(fileList); var result = sink.Run(fileList.Length); Console.WriteLine(); Console.WriteLine("Found the length of {0} files in {1} milliseconds.\nDirectory size is {2}",fileList.Length, stopWatch.ElapsedMilliseconds, result); while (Console.ReadKey(true).Key != ConsoleKey.Enter) { } foreach (var thread in workers) { thread.Abort(); } ventilator.Stop(); sink.Stop(); } }
public void addNavigationUriHavocer(Sink sink) { Sink.ProcedureInfo procInfo = sink.FindOrCreateProcedure(getUriHavocerMethod(sink).ResolvedMethod); procInfo.Decl.AddAttribute("inline", new Bpl.LiteralExpr(Bpl.Token.NoToken, Microsoft.Basetypes.BigNum.ONE)); Bpl.StmtListBuilder builder= new Bpl.StmtListBuilder(); Bpl.HavocCmd havoc= new Bpl.HavocCmd(Bpl.Token.NoToken, new List<Bpl.IdentifierExpr>(new List<Bpl.IdentifierExpr>(new Bpl.IdentifierExpr[] { new Bpl.IdentifierExpr(Bpl.Token.NoToken, sink.FindOrCreateFieldVariable(PhoneCodeHelper.CurrentURIFieldDefinition))}))); builder.Add(havoc); Bpl.Implementation impl = new Bpl.Implementation(Bpl.Token.NoToken, procInfo.Decl.Name, new List<Bpl.TypeVariable>(), new List<Bpl.Variable>(), new List<Bpl.Variable>(), new List<Bpl.Variable>(), builder.Collect(Bpl.Token.NoToken)); sink.TranslatedProgram.AddTopLevelDeclaration(impl); }
public static void Remove(Sink s) { lock (working_mtx) { if (working) { removes.Add(s); } else { Clear(s); } } }
public PhoneFeedbackTranslator(Sink sink) { this.sink = sink; }
private void UpdatePathGeometry() { if (Source != null && Sink != null) { PathGeometry geometry = new PathGeometry(); List <Point> linePoints = PathFinderHelper.GetConnectionLine(Source.GetInfo(), Sink.GetInfo(), true); if (linePoints.Count > 0) { PathFigure figure = new PathFigure(); figure.StartPoint = linePoints[0]; linePoints.Remove(linePoints[0]); figure.Segments.Add(new PolyLineSegment(linePoints, true)); geometry.Figures.Add(figure); this.PathGeometry = geometry; } } }
public async Task CommittablePartitionedSource_Should_handle_exceptions_in_stream_without_commit_failures() { var partitionsCount = 3; var topic = CreateTopic(1); var group = CreateGroup(1); var totalMessages = 100; var exceptionTriggered = new AtomicBoolean(false); var allTopicPartitions = Enumerable.Range(0, partitionsCount).Select(i => new TopicPartition(topic, i)).ToList(); var consumerSettings = CreateConsumerSettings <string>(group).WithStopTimeout(TimeSpan.FromSeconds(2)); var createdSubSources = new ConcurrentSet <TopicPartition>(); var commitFailures = new ConcurrentSet <(TopicPartition, Exception)>(); await ProduceStrings(i => new TopicPartition(topic, i % partitionsCount), Enumerable.Range(1, totalMessages), ProducerSettings); var control = KafkaConsumer.CommittablePartitionedSource(consumerSettings, Subscriptions.Topics(topic)) .GroupBy(partitionsCount, tuple => tuple.Item1) .SelectAsync(6, tuple => { var(topicPartition, source) = tuple; createdSubSources.TryAdd(topicPartition); return(source .Log($"Subsource for partition #{topicPartition.Partition.Value}", m => m.Record.Value) .SelectAsync(3, async message => { // fail on first partition; otherwise delay slightly and emit if (topicPartition.Partition.Value == 0) { Log.Debug($"Failing {topicPartition} source"); exceptionTriggered.GetAndSet(true); throw new Exception("FAIL"); } else { await Task.Delay(50); } return message; }) .Log($"Subsource {topicPartition} pre commit") .SelectAsync(1, async message => { try { await message.CommitableOffset.Commit(); } catch (Exception ex) { Log.Error("Commit failure: " + ex); commitFailures.TryAdd((topicPartition, ex)); } return message; }) .Scan(0, (c, _) => c + 1) .RunWith(Sink.Last <int>(), Materializer) .ContinueWith(t => { Log.Info($"sub-source for {topicPartition} completed: Received {t.Result} messages in total."); return t.Result; })); })
public void PagedSource_should_close_stream_when_received_empty_page() { var t = _source.RunWith(Sink.Seq <string>(), Sys.Materializer()); t.AwaitResult().ShouldBeEquivalentTo(new[] { "a", "b", "c", "d", "e" }, o => o.WithStrictOrdering()); }
public void PagedSource_should_return_the_items_in_the_proper_order() { var t = _source.Take(4).RunWith(Sink.Seq <string>(), Sys.Materializer()); t.AwaitResult().ShouldBeEquivalentTo(new[] { "a", "b", "c", "d" }, o => o.WithStrictOrdering()); }
public void PagedSource_should_close_stream_when_received_empty_link() { var t = _source.RunWith(Sink.Seq <int>(), Sys.Materializer()); t.AwaitResult().ShouldBeEquivalentTo(new[] { 1, 2, 3, 4, 5 }, o => o.WithStrictOrdering()); }
private Bpl.Cmd getNavigationCheckAssign(Sink sink, bool value) { List<Bpl.AssignLhs> lhs = new List<Bpl.AssignLhs>(); List<Bpl.Expr> rhs = new List<Bpl.Expr>(); Bpl.AssignLhs assignee = new Bpl.SimpleAssignLhs(Bpl.Token.NoToken, new Bpl.IdentifierExpr(Bpl.Token.NoToken, sink.FindOrCreateGlobalVariable(PhoneCodeHelper.BOOGIE_NAVIGATION_CHECK_VARIABLE, Bpl.Type.Bool))); lhs.Add(assignee); rhs.Add(value ? Bpl.IdentifierExpr.True : Bpl.IdentifierExpr.False); Bpl.AssignCmd assignCmd = new Bpl.AssignCmd(Bpl.Token.NoToken, lhs, rhs); return assignCmd; }
public Bpl.Cmd getAddNavigationCheck(Sink sink) { return getNavigationCheckAssign(sink, true); }
public Bpl.Cmd getResetNavigationCheck(Sink sink) { return getNavigationCheckAssign(sink, false); }
public IMethodReference getUriHavocerMethod(Sink sink) { if (uriHavocMethod == null) { MethodBody body = new MethodBody(); MethodDefinition havocDef = new MethodDefinition() { InternFactory = host.InternFactory, ContainingTypeDefinition = PhoneCodeHelper.instance().getMainAppTypeReference().ResolvedType, IsStatic = true, Name = sink.host.NameTable.GetNameFor(PhoneCodeHelper.BOOGIE_DO_HAVOC_CURRENTURI), Type = sink.host.PlatformType.SystemVoid, Body = body, }; body.MethodDefinition = havocDef; uriHavocMethod = havocDef; } return uriHavocMethod; }
private static IPublisher <TOut> ToPublisher <TOut, TMat>(Source <TOut, TMat> source, ActorMaterializer materializer) => source.RunWith(Sink.AsPublisher <TOut>(false), materializer);
private static Tuple <ISubscriber <TIn>, IPublisher <TOut> > MaterializeIntoSubscriberAndPublisher <TIn, TOut, TMat>( Flow <TIn, TOut, TMat> flow, ActorMaterializer materializer) => flow.RunWith(Source.AsSubscriber <TIn>(), Sink.AsPublisher <TOut>(false), materializer);
public void Setup(BenchmarkContext context) { _system = ActorSystem.Create("Test"); var settings = ActorMaterializerSettings.Create(_system) .WithFuzzingMode(false) .WithSyncProcessingLimit(int.MaxValue) .WithAutoFusing(false); // We fuse manually in this test in the setup _materializer = _system.Materializer(settings); _testElements = Enumerable.Repeat(0, ElementCount).Select(i => new MutableElement(i)).ToArray(); var testSource = Source.FromGraph(new TestSource(_testElements)); var testSink = Sink.FromGraph(new CompletionLatch()); var identityStage = new IdentityStage(); _singleIdentity = Fuse(testSource.Via(identityStage).ToMaterialized(testSink, Keep.Right)); _chainOfIdentities = Fuse( testSource.Via(identityStage) .Via(identityStage) .Via(identityStage) .Via(identityStage) .Via(identityStage) .Via(identityStage) .Via(identityStage) .Via(identityStage) .Via(identityStage) .Via(identityStage) .ToMaterialized(testSink, Keep.Right)); _singleSelect = Fuse(testSource.Select(Add).ToMaterialized(testSink, Keep.Right)); _chainOfSelects = Fuse( testSource.Select(Add) .Select(Add) .Select(Add) .Select(Add) .Select(Add) .Select(Add) .Select(Add) .Select(Add) .Select(Add) .Select(Add) .ToMaterialized(testSink, Keep.Right)); _repeatTakeSelectAndAggregate = Fuse(Source.Repeat(new MutableElement(0)) .Take(ElementCount) .Select(Add) .Select(Add) .Aggregate(new MutableElement(0), (acc, x) => { acc.Value += x.Value; return(acc); }).ToMaterialized(testSink, Keep.Right)); _singleBuffer = Fuse(testSource.Buffer(10, OverflowStrategy.Backpressure).ToMaterialized(testSink, Keep.Right)); _chainOfBuffers = Fuse( testSource.Buffer(10, OverflowStrategy.Backpressure) .Buffer(10, OverflowStrategy.Backpressure) .Buffer(10, OverflowStrategy.Backpressure) .Buffer(10, OverflowStrategy.Backpressure) .Buffer(10, OverflowStrategy.Backpressure) .Buffer(10, OverflowStrategy.Backpressure) .Buffer(10, OverflowStrategy.Backpressure) .Buffer(10, OverflowStrategy.Backpressure) .Buffer(10, OverflowStrategy.Backpressure) .Buffer(10, OverflowStrategy.Backpressure) .ToMaterialized(testSink, Keep.Right)); var broadcastZipFLow = Flow.FromGraph(GraphDsl.Create(b => { var bcast = b.Add(new Broadcast <MutableElement>(2)); var zip = b.Add(new Zip <MutableElement, MutableElement>()); b.From(bcast).To(zip.In0); b.From(bcast).To(zip.In1); var outlet = b.From(zip.Out).Via(Flow.Create <Tuple <MutableElement, MutableElement> >().Select(t => t.Item1)); return(new FlowShape <MutableElement, MutableElement>(bcast.In, outlet.Out)); })); var balanceMergeFlow = Flow.FromGraph(GraphDsl.Create(b => { var balance = b.Add(new Balance <MutableElement>(2)); var merge = b.Add(new Merge <MutableElement>(2)); b.From(balance).To(merge); b.From(balance).To(merge); return(new FlowShape <MutableElement, MutableElement>(balance.In, merge.Out)); })); _broadcastZip = Fuse(testSource.Via(broadcastZipFLow).ToMaterialized(testSink, Keep.Right)); _balanceMerge = Fuse(testSource.Via(balanceMergeFlow).ToMaterialized(testSink, Keep.Right)); _broadcastZipBalanceMerge = Fuse(testSource.Via(broadcastZipFLow).Via(balanceMergeFlow).ToMaterialized(testSink, Keep.Right)); }
public void StreamLayout_should_not_fail_fusing_and_materialization_when_building_a_large_graph_with_simple_computation_when_starting_from_a_Flow() { var g = Flow.FromGraph(Fuse.Aggressive(Enumerable.Range(1, TooDeepForStack) .Aggregate(Flow.Create <int>().MapMaterializedValue(_ => 1), (source, i) => source.Select(x => x)))); var t = g.RunWith(Source.Single(42).MapMaterializedValue(_ => 1), Sink.Seq <int>(), _materializer); var materialized = t.Item1; var result = t.Item2.AwaitResult(VeryPatient); materialized.Should().Be(1); result.Count.Should().Be(1); result.Should().Contain(42); }
public void A_BidiFlow_must_work_as_a_Flow_that_is_open_to_the_left() { var f = Bidi().Join(Flow.Create <long>().Select(x => ByteString.FromString($"Hello {x}"))); var result = Source.From(Enumerable.Range(1, 3)).Via(f).Limit(10).RunWith(Sink.Seq <string>(), Materializer); result.Wait(TimeSpan.FromSeconds(3)).Should().BeTrue(); result.Result.ShouldAllBeEquivalentTo(new[] { "Hello 3", "Hello 4", "Hello 5" }); }
/// <summary> /// Run the validation of the supplied source document, optionally /// writing the validated document to the supplied destination. /// </summary> public void Run() { JAugmentedSource aug = JAugmentedSource.makeAugmentedSource(source); aug.setSchemaValidationMode(lax ? JValidation.LAX : JValidation.STRICT); JReceiver receiver; PipelineConfiguration pipe = config.makePipelineConfiguration(); if (destination == null) { receiver = new Sink(pipe); } else if (destination is Serializer) { receiver = ((Serializer)destination).GetReceiver(config); } else { Result result = destination.GetResult(pipe); if (result is JReceiver) { receiver = (JReceiver)result; } else { throw new ArgumentException("Unknown type of destination"); } } pipe.setUseXsiSchemaLocation(useXsiSchemaLocation); receiver.setPipelineConfiguration(pipe); if (errorList != null) { pipe.setErrorListener(new ErrorGatherer(errorList)); } Sender.send(aug, receiver, null); }
public void A_BidiFlow_must_work_when_atop_its_inverse() { var f = Bidi().Atop(Inverse()).Join(Flow.Create <int>().Select(x => x.ToString())); var result = Source.From(Enumerable.Range(1, 3)).Via(f).Limit(10).RunWith(Sink.Seq <string>(), Materializer); result.Wait(TimeSpan.FromSeconds(3)).Should().BeTrue(); result.Result.ShouldAllBeEquivalentTo(new[] { "5", "6", "7" }); }
public override string GetInteractionName(Sim actor, Sink target, InteractionObjectPair iop) { return base.GetInteractionName(actor, target, new InteractionObjectPair(sOldSingleton, target)); }
public void A_BidiFlow_must_work_when_reversed() { // just reversed from the case above; observe that Flow inverts itself automatically by being on the left side var f = Flow.Create <int>().Select(x => x.ToString()).Join(Inverse().Reversed()).Join(Bidi().Reversed()); var result = Source.From(Enumerable.Range(1, 3)).Via(f).Limit(10).RunWith(Sink.Seq <string>(), Materializer); result.Wait(TimeSpan.FromSeconds(3)).Should().BeTrue(); result.Result.ShouldAllBeEquivalentTo(new[] { "5", "6", "7" }); }
public PhoneInitializationTranslator(Sink sink) { this.sink = sink; }
/// <summary> /// Legt die Methode zur Übermittelung der Rohdaten in den Direct Show /// graphen fest. /// </summary> /// <param name="sink">Methode zur Übermittelung der Rohdaten in den Graphen.</param> /// <exception cref="ArgumentNullException">Die Übermittelungsmethode darf nicht <i>null</i> /// sein.</exception> protected void SetSink( Sink sink ) { // Validate if (null == sink) throw new ArgumentNullException( "sink" ); // Remember m_Sink = sink; }
public ScrubAnxiety(Sink target, int required) : base(required) { // Listen for scrubs instead of clicks ClickRcvr cr = this.incrementCount; target.onScrub (cr); }
/// <summary> /// Erzeugt eine neue Vermittlungsinstanz. /// </summary> /// <param name="count">Anzahl der Direct Show Speicherblöcke, die /// vorzuhalten sind.</param> /// <param name="size">Größe eines einzelnen Direct Show Speicherblocks.</param> /// <param name="sink">Methode zur Übermittelung der Rohdaten in den Graphen.</param> /// <exception cref="ArgumentNullException">Die Übermittelungsmethode darf nicht <i>null</i> /// sein.</exception> public Injector( int count, int size, Sink sink ) : this( count, size ) { // Forward SetSink( sink ); }
protected Sink() { prev = next = null; }
public override string Decorate(LogLevel logLevel, string input, string originalMessage, Sink sink) { return(logLevel switch { LogLevel.Info => EncodeAnsiIfConsole("INF", sink, 255, 255, 255), LogLevel.Warning => EncodeAnsiIfConsole("WRN", sink, 255, 255, 0), LogLevel.Error => EncodeAnsiIfConsole("ERR", sink, 255, 0, 0), LogLevel.Debug => EncodeAnsiIfConsole("DBG", sink, 255, 0, 255), LogLevel.Exception => EncodeAnsiIfConsole("EXC", sink, 0, 255, 255), LogLevel.ReflectionTypeLoadException => EncodeAnsiIfConsole("RTL", sink, 0, 255, 255), _ => "???" });
public void Remove(Sink component) { children.Remove(component); }
public override bool Run() { try { BuffInstance element = Actor.BuffManager.GetElement(BuffNames.ReallyHasToPee); if ((element != null) && (element.mTimeoutCount <= Urinal.kTimeoutRemainingForBladderEmergency)) { RequestWalkStyle(Sim.WalkStyle.Run); } if (!Target.Line.WaitForTurn(this, SimQueue.WaitBehavior.DefaultAllowSubstitution, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), Urinal.kTimeToWaitInLine)) { return(false); } if (!Target.RouteToUrinalAndCheckInUse(Actor)) { return(false); } ClearRequestedWalkStyles(); if (Shooless.Settings.GetPrivacy(Target)) { mSituation = Urinal.UrinalSituation.Create(Actor, Actor.LotCurrent); } if (mSituation != null) { if (!mSituation.Start()) { return(false); } if (!Target.RouteToUrinalAndCheckInUse(Actor)) { return(false); } } CancellableByPlayer = false; StandardEntry(); mCurrentStateMachine = Target.GetStateMachine(Actor); Glass.CarryingGlassPosture posture = Actor.Posture as Glass.CarryingGlassPosture; if (posture != null) { mDrinkInHand = posture.ObjectBeingCarried as Glass; CarrySystem.ExitCarry(Actor); mDrinkInHand.FadeOut(true); mDrinkInHand.UnParent(); Actor.PopPosture(); SetParameter("hasDrink", true); SetActor("drink", mDrinkInHand); if (Target.HasDrinkSlot && (Target.GetContainedObject(Slot.ContainmentSlot_0) == null)) { mDrinkInHand.ParentToSlot(Target, Slot.ContainmentSlot_0); mDrinkInHand.FadeIn(); } } mCensorEnabled = true; Actor.EnableCensor(Sim.CensorType.LowerBody); AddOneShotScriptEventHandler(0x78, OnAnimationEvent); AnimateSim("use"); if (element != null) { element.mTimeoutPaused = true; } if (Actor.HasTrait(TraitNames.Inappropriate)) { mWillFart = RandomUtil.RandomChance01(Urinal.kChanceInappropriateFart); if (mWillFart) { mFartTime = RandomUtil.RandomFloatGaussianDistribution(0.1f, 0.9f); } } BeginCommodityUpdate(CommodityKind.Bladder, 0f); BeginCommodityUpdates(); bool succeeded = false; try { Actor.Motives.LerpToFill(this, CommodityKind.Bladder, Urinal.kMaxLengthUseToilet); StartStages(); succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.BuffFailureState | ExitReason.MaxSkillPointsReached | ExitReason.HigherPriorityNext), new Interaction <Sim, Urinal> .InsideLoopFunction(LoopFunc), mCurrentStateMachine); } finally { EndCommodityUpdates(succeeded); } if (succeeded) { Motive motive = Actor.Motives.GetMotive(CommodityKind.Bladder); if (motive != null) { motive.PotionBladderDecayOverride = false; } } if (element != null) { element.mTimeoutPaused = false; } if (Target.IsCleanable) { Target.Cleanable.DirtyInc(Actor); } bool flag2 = Target.Line.MemberCount() > 0x1; InteractionInstance instance = null; if ((mSituation == null) || !mSituation.SomeoneDidIntrude) { if (Target.AutoFlushes) { Target.FlushToilet(Actor, mCurrentStateMachine, false); } else { Target.ToiletVolume++; if (Target.ShouldFlush(Actor, Autonomous)) { Target.FlushToilet(Actor, mCurrentStateMachine, true); } } if (((mDrinkInHand == null) && Urinal.ShouldWashHands(Actor)) && !flag2) { Sink target = Toilet.FindClosestSink(Actor); if (target != null) { instance = Sink.WashHands.Singleton.CreateInstance(target, Actor, GetPriority(), false, true); } } } AddOneShotScriptEventHandler(0x68, OnAnimationEvent); AddOneShotScriptEventHandler(0x64, OnAnimationEvent); AnimateSim("exit"); if (mSituation != null) { mSituation.ExitUrinalSituation(); } if (mDrinkInHand != null) { CarrySystem.EnterWhileHolding(Actor, mDrinkInHand); Actor.Posture = new Glass.CarryingGlassPosture(Actor, mDrinkInHand); mDrinkInHand.FadeIn(); } if (flag2) { PrivacySituation.RouteToAdjacentRoom(Actor); } StandardExit(); if (instance != null) { Actor.InteractionQueue.PushAsContinuation(instance, true); } if (!flag2 && (instance == null)) { Actor.RouteAway(Urinal.kMinDistanceToMoveAwayAfterUsingUrinal, Urinal.kMaxDistanceToMoveAwayAfterUsingUrinal, false, GetPriority(), true, true, true, RouteDistancePreference.NoPreference); } return(succeeded); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } }
private static IPublisher <TOut> ToFanoutPublisher <TOut, TMat>(Source <TOut, TMat> source, ActorMaterializer materializer, int elasticity) => source.RunWith( Sink.AsPublisher <TOut>(true).WithAttributes(Attributes.CreateInputBuffer(elasticity, elasticity)), materializer);
protected FakeMailbox(EndPoint simpleEndPoint, Sink sink, Func <string, T> deserializer) : base(simpleEndPoint, sink, deserializer) { throw new NotImplementedException(); }
/// <summary> /// Returns two things: an object that determines the heap representation, /// and (optionally) an initial program that contains declarations needed /// for the heap representation. /// </summary> /// <param name="sink"> /// The heap might need to generate declarations so it needs access to the Sink. /// </param> /// <returns> /// false if and only if an error occurrs and the heap and/or program are not in a /// good state to be used. /// </returns> public abstract bool MakeHeap(Sink sink, out Heap heap, out Bpl.Program /*?*/ program);
private static Sink <T, Task> ConsoleSink <T>() where T : class => Sink.ForEach <T>(Console.WriteLine);
private void UpdatePathGeometry() { if (Source != null && Sink != null) { PathGeometry geometry = new PathGeometry(); pointsList = PathFinderHelper.GetPathFinder(this.pathFinder).GetConnectionLine(Source.GetInfo(), Sink.GetInfo(), true); if (pointsList.Count > 0) { PathFigure figure = new PathFigure(); figure.IsClosed = false; figure.StartPoint = pointsList[0]; pointsList.Remove(pointsList[0]); figure.Segments.Add(new PolyLineSegment(pointsList, true)); geometry.Figures.Add(figure); this.PathGeometry = geometry; this.Points = pointsList; } } }
public _(Sink <TSource> forward) { _forward = forward; }
private Sink <Tcp.IncomingConnection, Task> EchoHandler() => Sink.ForEach <Tcp.IncomingConnection>(c => c.Flow.Join(Flow.Create <ByteString>()).Run(Materializer));
internal ForEachTask(PipelineHelper <T> helper, Spliterator <S> spliterator, Sink <S> sink) : base(null) { this.Sink = sink; this.Helper = helper; this.Spliterator = spliterator; this.TargetSize = 0L; }
public void connect <T>(Source <T> source, Sink <T> sink) { source.producer.addHandler(sink.handler); }
protected internal ForEachOrderedTask(PipelineHelper <T> helper, Spliterator <S> spliterator, Sink <T> action) : base(null) { this.Helper = helper; this.Spliterator = spliterator; this.TargetSize = AbstractTask.SuggestTargetSize(spliterator.EstimateSize()); // Size map to avoid concurrent re-sizes this.CompletionMap = new ConcurrentDictionary <>(System.Math.Max(16, AbstractTask.LEAF_TARGET << 1)); this.Action = action; this.LeftPredecessor = null; }
public Translator getTranslator(Sink sink, IDictionary<IUnit, IContractProvider> contractProviders, IDictionary<IUnit, PdbReader> pdbReaders) { return new PhoneFeedbackTranslator(sink); }
public void Dispose() { Sink.OnCompleted(); Listener.Dispose(); }
/// <summary> /// Set up the manager /// </summary> private void ManagerInitialize() { //Initialize the ABG class and prepare all the diagnoses abg = new ABG("NursingInterventions"); listWaitingChairs = new List<WaitingChair>(); listExamRooms = new List<ExamRoom>(); //listPatients = new List<Patient>(); //Populate the list of waiting chairs. GameObject[] wc = GameObject.FindGameObjectsWithTag("WaitingChair"); foreach (GameObject w in wc) { listWaitingChairs.Add(w.GetComponent<WaitingChair>()); } //Populate the list of exam rooms. GameObject[] er = GameObject.FindGameObjectsWithTag("ExamRoom"); foreach (GameObject e in er) { listExamRooms.Add(e.GetComponent<ExamRoom>()); } //Find the triage triage = GameObject.FindGameObjectWithTag("Triage").GetComponent<Triage>(); //Find the nurse nurse = GameObject.FindGameObjectWithTag("Nurse").GetComponent<Nurse>(); //Find the Sink sink = GameObject.FindGameObjectWithTag("Sink").GetComponent<Sink>(); //prepare the patients. for (int i = 0; i < prefabPatients.Length; i++) { GameObject temp = prefabPatients[i]; int rand = Random.Range(0, prefabPatients.Length); prefabPatients[i] = prefabPatients[rand]; prefabPatients[rand] = temp; } //Reset the score scorePatientsSeen = 0; scoreAngryPatients = 0; scoreCorrectDiagnoses = 0; scoreCorrectInitialAssessment = 0; scoreSatisfaction = 100f; currentPatients = 0; //reset the spawn timer timerSpawnUsed = 0.1f; //set the manager _manager = this; gameplayUI.satisfaction.SatisfactionUpdate(scoreSatisfaction); UpdatePatientsTreated(); }
public SinkAlteration(Sink.Tuning tuning, float factor) { Add(new WashHandsAlteration(tuning, factor)); Add(new BrushTeethAlteration(tuning, factor)); Add(new WashDishesAlteration(tuning, factor)); }
public static void FindMSG(SelectableSource store, Entity node, StatementSink msg) { if (node.Uri != null) throw new ArgumentException("node must be anonymous"); ResSet nodesSeen = new ResSet(); ResSet nodesToAdd = new ResSet(); nodesToAdd.Add(node); while (nodesToAdd.Count > 0) { ResSet nodes = nodesToAdd; nodesToAdd = new ResSet(); Sink sink = new Sink(msg, nodesToAdd); foreach (Entity n in nodes) { if (nodesSeen.Contains(n)) continue; nodesSeen.Add(n); store.Select(new Statement(n, null, null, null), sink); store.Select(new Statement(null, n, null, null), sink); store.Select(new Statement(null, null, n, null), sink); } } }
public TuningAlteration(Sink.Tuning tuning, float factor, float minimum) : base(factor, minimum) { mTuning = tuning; }
public BrushTeethAlteration(Sink.Tuning tuning, float factor) : base(tuning, factor, sDefaultMinimum) { }
public WashDishesAlteration(Sink.Tuning tuning, float factor) : base(tuning, factor, sDefaultMinimum) { }
public PhoneNavigationTranslator(Sink sink) { this.sink = sink; }
/// <summary> /// When error=null => error cleared. When msg==null => exceptions surfaced from DoPulse() /// </summary> internal void FailoverDestination(Sink sink, Exception error, Message msg) { if (!Running) { return; } if (m_NestedFailureCount >= MAX_NESTED_FAILURES) { return; //stop cascade recursion } m_NestedFailureCount++; try { if (error == null)//error lifted { if (sink == m_FailoverErrorSink) { m_FailoverErrorSink = null; m_FailoverError = null; } return; } var failoverName = sink.Failover; if (string.IsNullOrEmpty(failoverName)) { failoverName = this.DefaultFailover; } if (string.IsNullOrEmpty(failoverName)) { return; //nowhere to failover } var failover = m_Sinks[failoverName]; if (failover == null) { return; } if (failover == sink) { return; //circular reference, cant fail into destination that failed } try { if (msg != null) //null on error from OnPulse() { failover.SendRegularAndFailures(msg); } if (sink.GenerateFailoverMessages || failover.GenerateFailoverMessages) { var emsg = new Message(); emsg.Type = MessageType.Error; emsg.From = sink.Name; emsg.Topic = CoreConsts.LOG_TOPIC; emsg.Text = string.Format( StringConsts.LOGSVC_FAILOVER_MSG_TEXT, (msg?.Guid.ToString()).Default("--none--"), sink.Name, failover.Name, sink.AverageProcessingTimeMs); if (msg != null) { emsg.RelatedTo = msg.Guid; } emsg.Exception = error; failover.SendRegularAndFailures(emsg); } failover.DoPulse(); } catch (Exception failoverError) { m_FailoverErrorSink = failover; m_FailoverError = failoverError; } } finally { m_NestedFailureCount--; } }
/// <summary>Applies a geometry type call sequence to the specified <paramref name="sink" />.</summary> /// <param name="sink">The sink to populate.</param> /// <remarks> /// <para>The call sequence is a set of figures, lines, and points for geometry types.</para> /// </remarks> public void Populate(IGeometrySink sink) { var sgs=sink as SqlTypes.IGeographySink110; if (sgs==null) sgs=new Sink(sink); _Geography.Populate(sgs); }
void ISinkOwnerRegistration.Unregister(Sink sink) => m_Sinks.Unregister(sink);
public static void Add(Sink s) { if (s.prev != null || s.next != null) throw new ArgumentException(); lock (sinks_mtx) { if (sink == null) { sink = s; sink.prev = s; } else { sink.prev.next = s; s.prev = sink.prev; sink.prev = s; } } }
public static BufferedSink Buffer(Sink sink) { return(new RealBufferedSink(sink)); }
private static void Clear(Sink s) { lock (sinks_mtx) { if (sink == s) { sink = s.next; } if (s.next != null) { s.next.prev = s.prev; } if (s.prev.next != null) { s.prev.next = s.next; } s.prev = s.next = null; } }
public void Add(Sink component) { children.Add(component); }
static Log() { debug = true; new Thread(() => { while (true) { Monitor.Enter(works_mtx); while (works.Count == 0) { Monitor.Wait(works_mtx, 1000); if (Application.RunState.IsCancellationRequested) return; } { var tmp = works_swap; works_swap = works; works = tmp; } Monitor.Exit(works_mtx); lock (working_mtx) { working = true; } Sink s; lock (sinks_mtx) { s = sink; sink = null; } for (int i = 0; i != works_swap.Count; ++i) { var work = works_swap[i]; for (Sink sk = s; sk != null; sk = sk.next) { sk.Start(work.Key); sk.Write(work.Key, work.Value); sk.Flush(work.Key); } } works_swap.Clear(); lock (sinks_mtx) { if (sink == null) { sink = s; } else if (s != null) { var tmp = s.prev; s.prev = sink.prev; sink.prev = tmp; s.prev.next = sink; sink = s; } } lock (working_mtx) { working = false; } while (removes.TryTake(out s)) { Clear(s); } } }).Start(); }
public static void updateInlinedMethods(Sink sink, IEnumerable<IMethodDefinition> doInline) { foreach (IMethodDefinition method in doInline) { Sink.ProcedureInfo procInfo = sink.FindOrCreateProcedure(method); procInfo.Decl.AddAttribute("inline", new Bpl.LiteralExpr(Bpl.Token.NoToken, Microsoft.Basetypes.BigNum.ONE)); } }