示例#1
0
 public abstract void ExecuteCore(IParamMgr paramMgr, IInputPortMgr inPortMgr, ISimpleSettingsMgr settings, IOutputPortMgr outPortMgr);
示例#2
0
        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);
            }
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
        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);
            }
        }
示例#6
0
        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);
            }
        }
示例#7
0
 public void ExecuteAsync(IParamMgr paramMgr, IInputPortMgr inPortMgr, ISimpleSettingsMgr settings, IOutputPortMgr outPortMgr)
 {
     throw new Exception("The method or operation is not implemented.");
 }
示例#8
0
 internal void PersistSettingsMgr(ISimpleSettingsMgr settingsMgr, System.Xml.XmlWriter writer)
 {
     SettingsPersister.PersistSettings(settingsMgr, writer);
     SettingsPersister.Reset();
 }
示例#9
0
        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);
            }
        }