private MapTaskHost( IMapFunction <TMapInput, TMapOutput> mapTask, IGroupCommClient groupCommunicationsClient, [Parameter(typeof(InvokeGC))] bool invokeGC) { _mapTask = mapTask; var cg = groupCommunicationsClient.GetCommunicationGroup(IMRUConstants.CommunicationGroupName); _dataAndMessageReceiver = cg.GetBroadcastReceiver <MapInputWithControlMessage <TMapInput> >(IMRUConstants.BroadcastOperatorName); _dataReducer = cg.GetReduceSender <TMapOutput>(IMRUConstants.ReduceOperatorName); _invokeGC = invokeGC; }
private MapTaskHost( IMapFunction <TMapInput, TMapOutput> mapTask, IGroupCommClient groupCommunicationsClient, TaskCloseCoordinator taskCloseCoordinator, [Parameter(typeof(InvokeGC))] bool invokeGc, [Parameter(typeof(TaskConfigurationOptions.Identifier))] string taskId) : base(groupCommunicationsClient, taskCloseCoordinator, invokeGc) { Logger.Log(Level.Info, "Entering constructor of MapTaskHost for task id {0}", taskId); _mapTask = mapTask; _dataAndMessageReceiver = _communicationGroupClient.GetBroadcastReceiver <MapInputWithControlMessage <TMapInput> >(IMRUConstants.BroadcastOperatorName); _dataReducer = _communicationGroupClient.GetReduceSender <TMapOutput>(IMRUConstants.ReduceOperatorName); Logger.Log(Level.Info, "MapTaskHost initialized."); }
private MapTaskHost( IMapFunction <TMapInput, TMapOutput> mapTask, IGroupCommClient groupCommunicationsClient, TaskCloseCoordinator taskCloseCoordinator, [Parameter(typeof(InvokeGC))] bool invokeGC) { _mapTask = mapTask; _groupCommunicationsClient = groupCommunicationsClient; var cg = groupCommunicationsClient.GetCommunicationGroup(IMRUConstants.CommunicationGroupName); _dataAndMessageReceiver = cg.GetBroadcastReceiver <MapInputWithControlMessage <TMapInput> >(IMRUConstants.BroadcastOperatorName); _dataReducer = cg.GetReduceSender <TMapOutput>(IMRUConstants.ReduceOperatorName); _invokeGC = invokeGC; _taskCloseCoordinator = taskCloseCoordinator; _cancellationSource = new CancellationTokenSource(); }
/// <summary> /// If the specified function is already in the list of functions, this will properly test the yield style of various /// map functions that are currently on and then activate the function. If this function is not in the list, then /// it will add it to the list. If you need to control the position, then insert the function before using this /// method to activate. Be warned that calling "Activate" directly on your function will activate your function /// but not disable any other functions. You can set "Map.FunctionMode = FunctionModes.None" first, and then /// specifically activate the function that you want. /// </summary> /// <param name="function">The MapFunction to activate, or add.</param> public void ActivateMapFunction(IMapFunction function) { if (!MapFunctions.Contains(function)) { MapFunctions.Add(function); } foreach (MapFunction f in MapFunctions) { if ((f.YieldStyle & YieldStyles.AlwaysOn) == YieldStyles.AlwaysOn) continue; // ignore "Always On" functions int test = (int)(f.YieldStyle & function.YieldStyle); if (test > 0) f.Deactivate(); // any overlap of behavior leads to deactivation } function.Activate(); }
/// <summary> /// Applies a Map transformation on a <see cref="DataStream{T}"/>. The transformation calls a <see cref="IMapFunction{TInput,TOutput}"/> for each element of the DataStream. /// </summary> /// <typeparam name="TOutput">The output type</typeparam> /// <param name="mapper">The MapFunction that is called for each element of the DataStream.</param> /// <returns>The transformed <see cref="DataStream{T}"/>.</returns> public SingleOutputStreamOperator <TOutput> Map <TOutput>(IMapFunction <TElement, TOutput> mapper) { return(null); }
/// <summary> /// Handles the Key Down situation. /// </summary> /// <param name="e">The event args.</param> protected override void OnKeyDown(KeyEventArgs e) { // Allow panning if the space is pressed. if (e.KeyCode == Keys.Space && !_isPanningTemporarily) { _previousFunctionMode = Map.FunctionMode; _previousFunctions.Clear(); IMapFunction pan = Map.MapFunctions.FirstOrDefault(x => x is MapFunctionPan); foreach (var f in Map.MapFunctions) { if (!f.Enabled || (f.YieldStyle & YieldStyles.AlwaysOn) == YieldStyles.AlwaysOn) { continue; // ignore "Always On" functions } int test = (int)(f.YieldStyle & pan.YieldStyle); if (test > 0) { _previousFunctions.Add(f); } } Map.FunctionMode = FunctionMode.Pan; _isPanningTemporarily = true; } // Arrow-Key Panning if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down || e.KeyCode == Keys.Left || e.KeyCode == Keys.Right) { if (!BusySet) { Map.IsBusy = true; BusySet = true; } var source = Map.MapFrame.View; switch (e.KeyCode) { case Keys.Up: Map.MapFrame.View = new Rectangle(source.X, source.Y + 20, source.Width, source.Height); break; case Keys.Down: Map.MapFrame.View = new Rectangle(source.X, source.Y - 20, source.Width, source.Height); break; case Keys.Left: Map.MapFrame.View = new Rectangle(source.X + 20, source.Y, source.Width, source.Height); break; case Keys.Right: Map.MapFrame.View = new Rectangle(source.X - 20, source.Y, source.Width, source.Height); break; } _keyPanCount++; if (_keyPanCount == 16) { Map.MapFrame.ResetExtents(); _keyPanCount = 0; } else { Map.Invalidate(); } } // Zoom Out if (e.KeyCode == (Keys.LButton | Keys.MButton | Keys.Back | Keys.ShiftKey | Keys.Space | Keys.F17) || e.KeyCode == Keys.Subtract) { Map.IsBusy = true; Rectangle r = Map.MapFrame.View; r.Inflate(r.Width / 2, r.Height / 2); Map.MapFrame.View = r; Map.MapFrame.ResetExtents(); Map.IsBusy = false; } // Zoom In if (e.KeyCode == (Keys.LButton | Keys.RButton | Keys.Back | Keys.ShiftKey | Keys.Space | Keys.F17) || e.KeyCode == Keys.Add) { Map.IsBusy = true; Rectangle r = Map.MapFrame.View; r.Inflate(-r.Width / 4, -r.Height / 4); Map.MapFrame.View = r; Map.MapFrame.ResetExtents(); Map.IsBusy = false; } }
public StreamMap(IMapFunction <TInput, TOutput> userFunction) : base(userFunction) { ChainingStrategy = ChainingStrategy.Always; }