Esempio n. 1
0
		public override void Recover()
		{
			arrayIterator = null;
			nullIteratorI = null;
			nullIteratorJ = null;
			indexArray = new ArrayList();
			status = new QuickSortStatus(this.r,this.low,this.high);
			base.Recover();
		}
 public override void Recover()
 {
     arrayIterator = null;
     nullIteratorI = null;
     nullIteratorJ = null;
     indexArray    = new ArrayList();
     status        = new QuickSortStatus(this.r, this.low, this.high);
     base.Recover();
 }
        public override void Initialize(bool isOpen)
        {
            base.Initialize(isOpen);
            //这里,因为我只演示一次快速排序,所以我low和high总是设置为low和r.Length;
            low    = 1;
            high   = r.Length;
            status = new QuickSortStatus(r, low, high);

            InitGraph();

            WorkbenchSingleton.Workbench.ActiveViewContent.SelectView();
        }
        public override bool GetData()
        {
            statusItemList.Clear();

            StatusItemControl statusItemControl = new StatusItemControl();

            Hashtable table = AlgorithmManager.Algorithms.GetExampleDatas();

            if (table != null)
            {
                XmlNode node = table[typeof(OneQuickPass).ToString()] as XmlElement;

                XmlNodeList childNodes = node.ChildNodes;

                StatusItem statusItem = null;

                foreach (XmlElement el in childNodes)
                {
                    string r = el.Attributes["OriginalString"].Value;

                    statusItem        = new StatusItem(new QuickSortStatus(r, 1, r.Length));
                    statusItem.Height = 145;
                    statusItem.Image  = CreatePreviewImage(r);
                    statusItemList.Add(statusItem);
                }
            }
            DialogType = typeof(OneQuickPassDialog);
            InitDataForm form = new InitDataForm();

            form.StatusItemList = statusItemList;

            if (form.ShowDialog() != DialogResult.OK)
            {
                return(false);
            }
            if (form.SelectedIndex >= 0)             //说明用户是通过选中某个模板来初始化数据的
            {
                StatusItem selectedItem = form.StatusItemList[form.SelectedIndex] as StatusItem;
                if (selectedItem != null)
                {
                    QuickSortStatus tempStatus = selectedItem.ItemInfo as QuickSortStatus;
                    if (tempStatus != null)
                    {
                        r = tempStatus.R;
                    }
                }
            }
            else              //说明用户选择自定义数据
            {
                r = status.R;
            }
            return(true);
        }
Esempio n. 5
0
		public override void Initialize(bool isOpen)
		{
			base.Initialize(isOpen);
			//这里,因为我只演示一次快速排序,所以我low和high总是设置为low和r.Length;
			low = 1;
			high = r.Length;
			status = new QuickSortStatus(r,low,high);

			InitGraph();
			
			WorkbenchSingleton.Workbench.ActiveViewContent.SelectView();
		}