internal string[] FormatOutputs(IOutputPortMgr outPortMgr) { string[] results = null; if (outPortMgr != null && outPortMgr.Count > 0) { results = new string[outPortMgr.Count]; for (int i = 0; i < outPortMgr.Count; i++) { results[i] = string.Format("{0} ({1})", outPortMgr[i].ContentType, outPortMgr[i].OutputStatus); } } else results = new string[0]; return results; }
public void Execute(IParamMgr paramMgr, IInputPortMgr inPortMgr, ISimpleSettingsMgr settings, IOutputPortMgr outPortMgr) { IsAsynch = false; WorkerStatus = FxWorkerStatus.ExecutingSynch; CompletionCalled = false; PercentProgress = 0; ExecWorker(paramMgr, inPortMgr, settings, outPortMgr); }
public void Execute(IParamMgr paramMgr, IInputPortMgr inPortMgr, ICompoundSettingsMgr settings, IOutputPortMgr outPortMgr) { SetStatus(FxStatus.Validating, StatusChangeDriver.NormalTransition, "Beginning pre-execution validations."); if (paramMgr != null) { var myParamMgr = paramMgr as IDataPropertiesElementParamMgr; if (myParamMgr != null) { #region Log _Logger.Info("Execute() begin"); #endregion // begin execution ------------------------------------------------ SetStatus(FxStatus.Executing, StatusChangeDriver.NormalTransition, "Beginning execution."); //1) get the input data IInputDataPort inPort = inPortMgr[0] as IInputDataPort; var retriever = new FramePropertyRetrieverToPlainText(); Properties = retriever.GetProperties(inPort.InputDataObj); // inform listeners that values/items at the core have been modified and to refesh the UI. OnCoreModified(new CoreModifiedEventArgs()); // now set the input data as the item to be displaed in the secondary fx M } else SetStatus(FxStatus.UnInitialized, StatusChangeDriver.ValidationFailure, "ParamMgr is not of type IDataPropertiesElementParamMgr."); } else { SetStatus(FxStatus.UnInitialized, StatusChangeDriver.ValidationFailure, "ParamMgr is null."); } }
internal void WrapUp(bool isValidContinue, INetwork outputNet0, IOutputPortMgr outPortMgr, Exception ex) { if (isValidContinue && !IsCancelled) { IOutputNetworkPort oPort0 = outPortMgr[0] as IOutputNetworkPort; oPort0.OutputNetwork = outputNet0; // --- set status's to completed when all is done WorkerStatus = FxWorkerStatus.Completed; Status = FxStatus.Complete; ExecComplete(PercentProgress, false, ex, FormatMessage(outputNet0)); } else if (IsCancelled) { Status = FxStatus.UnInitialized; ExecComplete(PercentProgress, IsCancelled, ex, Properties.Resources.MssgFxExecCancel); } else { // ex cannot be null if an error occured if (ex == null) ex = new FxExecutionErrorException(Properties.Resources.MssgFxExceptionIsNull); WorkerStatus = FxWorkerStatus.Error; Status = FxStatus.Error; ExecComplete(PercentProgress, IsCancelled, ex, Properties.Resources.MssgFxExecError); } }
internal void ExecWorker(IParamMgr paramMgr, IInputPortMgr inPortMgr, ISimpleSettingsMgr settings, IOutputPortMgr outPortMgr) { #region Log _Logger.Debug("ExecWorker() begin"); #endregion Exception ex = null; bool isValidContinue = false; // --- begin execution ------------------------------------------------ UpdateStatus(FxStatus.Executing, StatusChangeDriver.NormalTransition, "Beginning execution."); try { int numNodes = 0; int numOfNodesRemoved = 0; int kValue = -1; INetwork inputNet = null; INetwork outputNet = null; IFrame frame1 = null; // Singular frame returns count of isolates removed // --- //1) Validate the parameters var myParamMgr = paramMgr as IExtractKthCoreParamMgr; isValidContinue = ValidateParams(myParamMgr, out kValue, out ex); if (isValidContinue && !IsCancelled) { //2) Get the input network and validate it GetInputs(inPortMgr, out inputNet, out numNodes); isValidContinue = ValidateInputNetwork(inputNet, out ex); if (isValidContinue && !IsCancelled) { //3) Validate the input network combined with the input parameters isValidContinue = ValidateCombinedInputs(inputNet, kValue, out ex); if (isValidContinue && !IsCancelled) { //4) Create and validate a copy of the input network (the copy will be modified) outputNet = CopyInputNetwork(inputNet); isValidContinue = ValidateNetworkCopy(inputNet, outputNet, out ex); if (isValidContinue && !IsCancelled) { //5) Perform the kth core extraction numOfNodesRemoved = ExtractKthCore(outputNet, kValue); //6) Validate the output isValidContinue = ValidateOutputNetwork0(outputNet, numNodes, numOfNodesRemoved, out ex); } } } } WrapUp(isValidContinue, outputNet, outPortMgr, ex); } catch (Exception x) { // update the status if the ex is not recoverable ExecWorkerCleanUp(x); } }
internal override void _outPortMgr_ConnectionChanging(IOutputPortMgr sender, ConnectionChangingEventArgs ea) { _outPortMgr_ConnectionChanging_TimesCalled++; }
internal virtual void _outPortMgr_ConnectionChanging(IOutputPortMgr sender, ConnectionChangingEventArgs ea) { throw new NotImplementedException("The method or operation is not implemented."); }
public virtual void ExecWorker(IParamMgr paramMgr, IInputPortMgr inPortMgr, ISimpleSettingsMgr settings, IOutputPortMgr outPortMgr) { #region Log _logger.Debug("ExecWorker() begin"); #endregion // --- begin execution ------------------------------------------------ UpdateStatus(FxStatus.Executing, StatusChangeDriver.NormalTransition, "Beginning execution."); try { ExecuteCore(paramMgr, inPortMgr, settings, outPortMgr); // WrapUp(IsValidContinue, outputFrame, outPortMgr, ex); ****** WrapUp(outPortMgr); } catch (Exception x) { _logger.ErrorException("ExecWorker() handled the exception and passed it to ExecWorkerCleanUp()", x); // update the status if the ex is not recoverable ExecWorkerCleanUp(x); } }
public override void ExecWorker(Common.Params.IParamMgr paramMgr, IInputPortMgr inPortMgr, Common.Settings.ISimpleSettingsMgr settings, IOutputPortMgr outPortMgr) { ExecuteWorkerCalled = true; base.ExecWorker(paramMgr, inPortMgr, settings, outPortMgr); }
internal void PersistOutPortMgr(IOutputPortMgr outPortMgr, System.Xml.XmlWriter writer) { writer.WriteStartElement("OutputPortMgr"); IOutputPort port = null; for (int i = 0; i < outPortMgr.Count; i++) { port = outPortMgr[i]; PersistOutPort(port, writer); } writer.WriteEndElement(); }
public void ConnectionChanging_DummyHandler(IOutputPortMgr sender, ConnectionChangingEventArgs ea) { ConnectionChanging_TimesCalled++; RecievedEventArgs = ea; RecievedSender = sender; }
internal void _outPortMgr_ConnectionChanging(IOutputPortMgr sender, ConnectionChangingEventArgs ea) { // Do nothing here since there is no need to change the status of the element; // (used to throw a NotImplementedException here but it interfered with testing compound elements). }
internal void _Execute( IParamMgr paramMgr, IInputPortMgr inPortMgr, ICompoundSettingsMgr settings, IOutputPortMgr outPortMgr) { SetStatus(FxStatus.Validating, StatusChangeDriver.NormalTransition, "Beginning pre-execution validations."); if (paramMgr != null) { // IDataPropertiesElementParamMgr myParamMgr = paramMgr as IDataPropertiesElementParamMgr; // if (myParamMgr != null) // { // #region Log // Log(BlueSpider.Common.Constants.LogEntryTitle_Start, null); // #endregion // // begin execution ------------------------------------------------ // SetStatus(FxStatus.Executing, StatusChangeDriver.NormalTransition, "Beginning execution."); // //1) get the input data // IInputDataPort inPort = inPortMgr[0] as IInputDataPort; // InputData = inPort.InputDataObj; // // inform listeners that values/items at the core have been modified and to refesh the UI. // OnCoreModified(new CoreModifiedEventArgs()); // // now set the input data as the item to be displaed in the secondary fx M // } // else // SetStatus(FxStatus.UnInitialized, StatusChangeDriver.ValidationFailure, "ParamMgr is not of type IDataPropertiesElementParamMgr."); } else { SetStatus(FxStatus.UnInitialized, StatusChangeDriver.ValidationFailure, "ParamMgr is null."); } }
public void ExecuteAsync(IParamMgr paramMgr, IInputPortMgr inPortMgr, ISimpleSettingsMgr settings, IOutputPortMgr outPortMgr) { throw new Exception("The method or operation is not implemented."); }
public void ExecuteAsync(IParamMgr paramMgr, IInputPortMgr inPortMgr, ISimpleSettingsMgr settings, IOutputPortMgr outPortMgr) { if (IsBusy) { CancelAsync(); Reset(); } IsAsynch = true; WorkerStatus = FxWorkerStatus.ExecutingAsynch; CompletionCalled = false; PercentProgress = 0; AsynchOp = AsyncOperationManager.CreateOperation(null); new ExecDelegate(ExecWorker).BeginInvoke(paramMgr, inPortMgr, settings, outPortMgr, null, null); }
public abstract void ExecuteCore(IParamMgr paramMgr, IInputPortMgr inPortMgr, ISimpleSettingsMgr settings, IOutputPortMgr outPortMgr);
internal void ExecWorker(IParamMgr paramMgr, IInputPortMgr inPortMgr, ISimpleSettingsMgr settings, IOutputPortMgr outPortMgr) { #region Log _Logger.Info("ExecWorker() begin"); #endregion Exception ex = null; bool isValidContinue = false; // --- begin execution ------------------------------------------------ UpdateStatus(FxStatus.Executing, StatusChangeDriver.NormalTransition, "Beginning execution."); try { int nodeCount, edgeCount = 0; bool isDirected, allowCycles, allowSelfLoops, allowMultiEdges; string networkName = null; INetwork outputNet = null; IRandomNetGenParamMgr myParamMgr = paramMgr as IRandomNetGenParamMgr; isValidContinue = ValidateParams(myParamMgr, out nodeCount, out edgeCount, out isDirected, out networkName, out allowCycles, out allowSelfLoops, out allowMultiEdges, out ex); if (isValidContinue && !IsCancelled) { outputNet = CreateNetwork(Guid.NewGuid(), myParamMgr); isValidContinue = ValidateOutputNetwork(outputNet, nodeCount, edgeCount, isDirected, out ex); } WrapUp(isValidContinue, IsCancelled, outputNet, outPortMgr, ex); } catch (Exception x) { // update the status if the ex is not recoverable ExecWorkerCleanUp(x); } }
internal void WrapUp(IOutputPortMgr outPortMgr) { if (IsValidContinue && !IsCancelled) { // --- set status's to completed when all is done WorkerStatus = FxWorkerStatus.Completed; Status = FxStatus.Complete; ExecComplete(PercentProgress, false, OutputException, OutputMssg); } else if (IsCancelled) { Status = FxStatus.UnInitialized; ExecComplete(PercentProgress, IsCancelled, OutputException, Properties.Resources.MssgFxExecCancel); } else { // ex cannot be null if an error occured if (OutputException == null) OutputException = new FxExecutionErrorException(Properties.Resources.MssgFxExceptionIsNull); WorkerStatus = FxWorkerStatus.Error; Status = FxStatus.Error; ExecComplete(PercentProgress, IsCancelled, OutputException, string.IsNullOrEmpty(OutputMssg) ? Properties.Resources.MssgFxExecError : OutputMssg); } }
internal void ExecWorker(IParamMgr paramMgr, IInputPortMgr inPortMgr, ISimpleSettingsMgr settings, IOutputPortMgr outPortMgr) { #region Log _Logger.Info("ExecWorker() begin"); #endregion Exception ex = null; bool isValidContinue = false; // --- begin execution ------------------------------------------------ UpdateStatus(FxStatus.Executing, StatusChangeDriver.NormalTransition, "Beginning execution."); try { string fileName = null; bool exportNodeAttributes = false; bool exportEdgeAttributes = false; NetworkFileTypes fileType = NetworkFileTypes.GraphML; INetwork inputNet = null; // --- IExportNetworkParamMgr myParamMgr = paramMgr as IExportNetworkParamMgr; isValidContinue = ValidateParams(myParamMgr, out fileName, out exportNodeAttributes, out exportEdgeAttributes, out fileType, out ex); if (isValidContinue && !IsCancelled) { GetInputs(inPortMgr, out inputNet); // --- isValidContinue = ValidateInputNetwork(inputNet, exportNodeAttributes, exportEdgeAttributes, out ex); if (isValidContinue && !IsCancelled) { WriteFile((IBasicAdjList)inputNet, fileName, exportNodeAttributes, exportEdgeAttributes, fileType); } } WrapUp(isValidContinue, fileName, outPortMgr, ex); } catch (Exception x) { // update the status if the ex is not recoverable ExecWorkerCleanUp(x); } }