public override void OnClick() { MyIODATA_FRM myIODATA_FRM = new MyIODATA_FRM(); if (myIODATA_FRM.ShowDialog() != DialogResult.OK) { return; } ISODataClassification_Exchange_Info iSODataClassification = new ISODataClassification_Exchange_Info(); iSODataClassification = MyIODATA_FRM.ISODataParams; ISODataClassificationAlgo iSODataClassificationAlgo = new ISODataClassificationAlgo { Params = iSODataClassification }; AlgoFactory.Instance().AsynExecuteAlgo(iSODataClassificationAlgo); ISystemAlgoEvents systemAlgoEvents = iSODataClassificationAlgo as ISystemAlgoEvents; systemAlgoEvents.OnExecuteCompleted += OnAlgoExecuteCompleted; //systemAlgoEvents.OnProgressChanged += OnAlgoProgresChanged; //PIE.AxControls.IStatusBar statusBar = m_Application.StatusBar; //statusBar.ShowProgress(0, 100, ""); //Application.DoEvents(); ProgressBar progressBar = new ProgressBar(); }
public void CreateConstantAlgoTest() { Assert.Throws <Exception>(() => AlgoFactory.CreateAlgo(AlgoType.Constant, 1)); AlgoFactory.AddFactory(AlgoType.Constant); var algo = AlgoFactory.CreateAlgo(AlgoType.Constant, 1); Assert.True(algo is ConstantAlgo); Assert.Equal(1, algo.GetNext()); Assert.Equal(1, algo.GetNext()); }
public void CreateIncrementAlgoTest() { Assert.Throws <Exception>(() => AlgoFactory.CreateAlgo(AlgoType.Increment, 1, 5)); AlgoFactory.AddFactory(AlgoType.Increment); var algo = AlgoFactory.CreateAlgo(AlgoType.Increment, 1, 5); Assert.True(algo is IncrementAlgo); Assert.Equal(1, algo.GetNext()); Assert.Equal(6, algo.GetNext()); Assert.Equal(11, algo.GetNext()); }
public void CreateMultipleAlgoTest() { Assert.Throws <Exception>(() => AlgoFactory.CreateAlgo(AlgoType.Multiple, 1, 2)); AlgoFactory.AddFactory(AlgoType.Multiple); var algo = AlgoFactory.CreateAlgo(AlgoType.Multiple, 1, 2); Assert.True(algo is MultipleAlgo); Assert.Equal(1, algo.GetNext()); Assert.Equal(2, algo.GetNext()); Assert.Equal(4, algo.GetNext()); }
public void CreateExpAlgoTest() { Assert.Throws <Exception>(() => AlgoFactory.CreateAlgo(AlgoType.Exp, 3)); AlgoFactory.AddFactory(AlgoType.Exp); var algo = AlgoFactory.CreateAlgo(AlgoType.Exp, 3); Assert.True(algo is ExpAlgo); Assert.Equal(3, algo.GetNext()); Assert.Equal(9, algo.GetNext()); Assert.Equal(27, algo.GetNext()); }
public void CreateFibonacciAlgoTest() { Assert.Throws <Exception>(() => AlgoFactory.CreateAlgo(AlgoType.Fibonacci)); AlgoFactory.AddFactory(AlgoType.Fibonacci); var algo = AlgoFactory.CreateAlgo(AlgoType.Fibonacci); Assert.True(algo is FibonacciAlgo); Assert.Equal(1, algo.GetNext()); Assert.Equal(1, algo.GetNext()); Assert.Equal(2, algo.GetNext()); Assert.Equal(3, algo.GetNext()); }
static void Main(string[] args) { int[] array = { 71, 52, 44, 33, 34, 23, 14, 6, 5, 4 }; var t = AlgoFactory <int> .GetSortingAlgo(AlgoType.Selection); //t.Sort(array); //t = AlgoFactory<int>.GetSortingAlgo(AlgoType.Bubble); //t.Sort(array); t = AlgoFactory <int> .GetSortingAlgo(AlgoType.Merge); t.Sort(array); }
public override void OnClick() { FrmKmeansClassification frmKmeansClassification = new FrmKmeansClassification(); if (frmKmeansClassification.ShowDialog() != DialogResult.OK) return; KmeansClassification_Exchange_Info KmeansClassification = new KmeansClassification_Exchange_Info(); KmeansClassification = frmKmeansClassification.ExChangeData; KmeansClassificationAlgo kmeansClassificationAlgo = new KmeansClassificationAlgo { Params = KmeansClassification }; Application.DoEvents(); AlgoFactory.Instance().AsynExecuteAlgo(kmeansClassificationAlgo); ISystemAlgoEvents systemAlgoEvents = kmeansClassificationAlgo as ISystemAlgoEvents; systemAlgoEvents.OnExecuteCompleted += OnAlgoExecuteCompleted; systemAlgoEvents.OnProgressChanged += OnAlgoProgresChanged; }
public void CreateMoreIncrementAlgoTest() { Assert.Throws <Exception>(() => AlgoFactory.CreateAlgo(AlgoType.Increment, 1, 3)); AlgoFactory.AddFactory(AlgoType.Increment); var algo = AlgoFactory.CreateAlgo(AlgoType.Increment, 1, 3); var algo2 = AlgoFactory.CreateAlgo(AlgoType.Increment, 2, 4); Assert.True(algo is IncrementAlgo); Assert.True(algo2 is IncrementAlgo); Assert.Equal(1, algo.GetNext()); Assert.Equal(4, algo.GetNext()); Assert.Equal(7, algo.GetNext()); Assert.Equal(10, algo.GetNext()); Assert.Equal(2, algo2.GetNext()); Assert.Equal(6, algo2.GetNext()); Assert.Equal(10, algo2.GetNext()); }
public void CreateMoreMultipleAlgoTest() { Assert.Throws <Exception>(() => AlgoFactory.CreateAlgo(AlgoType.Multiple, 1, 2)); AlgoFactory.AddFactory(AlgoType.Multiple); var algo = AlgoFactory.CreateAlgo(AlgoType.Multiple, 1, 2); var algo2 = AlgoFactory.CreateAlgo(AlgoType.Multiple, 2, 1.5); Assert.True(algo is MultipleAlgo); Assert.True(algo2 is MultipleAlgo); Assert.Equal(1, algo.GetNext()); Assert.Equal(2, algo.GetNext()); Assert.Equal(4, algo.GetNext()); Assert.Equal(2, algo2.GetNext()); Assert.Equal(3, algo2.GetNext()); Assert.Equal(5, algo2.GetNext()); //4,5 Assert.Equal(7, algo2.GetNext()); //6,75 }
public PlayerTests() { ConfigurationManager.SetJson(Utility.CONFIGFILE_JSON); AlgoFactory.CleanFactories(); AlgoFactory.AddFactory(AlgoType.Constant); AlgoFactory.AddFactory(AlgoType.Exp); AlgoFactory.AddFactory(AlgoType.Fibonacci); AlgoFactory.AddFactory(AlgoType.Increment); AlgoFactory.AddFactory(AlgoType.Multiple); UnitFactory.CleanFactories(); GathererUnitRegister gathererVisitor = new GathererUnitRegister(); UnitFactory.AddFactory(gathererVisitor); BuilderUnitRegister builderVisitor = new BuilderUnitRegister(); UnitFactory.AddFactory(builderVisitor); FarmerUnitRegister farmerVisitor = new FarmerUnitRegister(); UnitFactory.AddFactory(farmerVisitor); ResearcherUnitRegister researcherVisitor = new ResearcherUnitRegister(); UnitFactory.AddFactory(researcherVisitor); BuildingFactory.CleanFactories(); ForestCampBuildingRegister forestCampVisitor = new ForestCampBuildingRegister(); BuildingFactory.AddFactory(forestCampVisitor); MiningVillageBuildingRegister miningVillageVisitor = new MiningVillageBuildingRegister(); BuildingFactory.AddFactory(miningVillageVisitor); FarmBuildingRegister farmVisitor = new FarmBuildingRegister(); BuildingFactory.AddFactory(farmVisitor); LabBuildingRegister labVisitor = new LabBuildingRegister(); BuildingFactory.AddFactory(labVisitor); Market.ResetMarket(); Player.GetInstance().ResetPlayer(); }
public void CreateFailTest() { AlgoFactory.AddFactory(AlgoType.Constant); AlgoFactory.AddFactory(AlgoType.Increment); AlgoFactory.AddFactory(AlgoType.Multiple); AlgoFactory.AddFactory(AlgoType.Exp); AlgoFactory.AddFactory(AlgoType.Fibonacci); Assert.Throws <Exception>(() => AlgoFactory.CreateAlgo(AlgoType.Constant, 3, 1)); Assert.Throws <Exception>(() => AlgoFactory.CreateAlgo(AlgoType.Constant)); Assert.Throws <Exception>(() => AlgoFactory.CreateAlgo(AlgoType.Increment, 1)); Assert.Throws <Exception>(() => AlgoFactory.CreateAlgo(AlgoType.Increment)); Assert.Throws <Exception>(() => AlgoFactory.CreateAlgo(AlgoType.Multiple, 8)); Assert.Throws <Exception>(() => AlgoFactory.CreateAlgo(AlgoType.Multiple)); Assert.Throws <Exception>(() => AlgoFactory.CreateAlgo(AlgoType.Exp, 1, 7)); Assert.Throws <Exception>(() => AlgoFactory.CreateAlgo(AlgoType.Exp)); Assert.Throws <Exception>(() => AlgoFactory.CreateAlgo(AlgoType.Fibonacci, 10, 1)); Assert.Throws <Exception>(() => AlgoFactory.CreateAlgo(AlgoType.Fibonacci, 7)); }
public MainForm() { InitializeComponent(); List <Image> sourceImages = getFolderImages(Properties.Settings.Default.SourceImagesFolder); List <Image> targetImages = getFolderImages(Properties.Settings.Default.TargetImagesFolder); fillImageList(SourcesFilmStrip, sourceImages); fillImageList(TargetsFilmStrip, targetImages); m_Factory = new AlgoFactory(); m_currPCAalgo = new CPCA(); m_currHausdorffalgo = new CHausdorffDistance(); m_currShapeContextalgo = new CShapeContext(); m_currPipedalgo = new CComboAlgorithm(); propertyGrid1.SelectedObject = m_currPCAalgo; propertyGrid2.SelectedObject = m_currHausdorffalgo; propertyGrid3.SelectedObject = m_currShapeContextalgo; propertyGrid4.SelectedObject = m_currPipedalgo; }
public override void OnClick() { Neural_FRM neural_From = new Neural_FRM(); if (neural_From.ShowDialog() != DialogResult.OK) { return; } NeuralNetworkCluster_Exchange_Info neuralNet = new NeuralNetworkCluster_Exchange_Info(); neuralNet = Neural_FRM.NeuralEx; //访问静态成员 NeuralNetworkClusterAlgo neuralN_Algo = new NeuralNetworkClusterAlgo { Params = neuralNet }; AlgoFactory.Instance().AsynExecuteAlgo(neuralN_Algo); ISystemAlgoEvents systemAlgoEvents = neuralN_Algo as ISystemAlgoEvents; systemAlgoEvents.OnExecuteCompleted += OnAlgoExecuteCompleted; ///?? systemAlgoEvents.OnProgressChanged += OnAlgoProgresChanged; }
public override void OnClick() { Form_KMeans form_KMeans = new Form_KMeans(); if (form_KMeans.ShowDialog() != DialogResult.OK) { return; } KmeansClassification_Exchange_Info exchange_Info = new KmeansClassification_Exchange_Info(); exchange_Info = Form_KMeans.KMeansParam; KmeansClassificationAlgo kmeansAlgo = new KmeansClassificationAlgo { Params = exchange_Info }; Application.DoEvents(); AlgoFactory.Instance().AsynExecuteAlgo(kmeansAlgo); ISystemAlgoEvents systemAlgoEvents = kmeansAlgo as ISystemAlgoEvents; systemAlgoEvents.OnExecuteCompleted += OnAlgoExecuteCompleted; systemAlgoEvents.OnProgressChanged += OnAlgoProgresChanged; }
public override void OnClick() { PCAfusion_FRM pCAfusion_FRM = new PCAfusion_FRM(); if (pCAfusion_FRM.ShowDialog() != DialogResult.OK) { return; } Pansharp_Exchange_Info PCAfusionParams = new Pansharp_Exchange_Info(); PCAfusionParams = PCAfusion_FRM.PCAfusionParam; PansharpFuseAlgo PCAfusionAlgo = new PansharpFuseAlgo { Params = PCAfusionParams }; Application.DoEvents(); AlgoFactory.Instance().AsynExecuteAlgo(PCAfusionAlgo); ISystemAlgoEvents systemAlgoEvents = PCAfusionAlgo as ISystemAlgoEvents; systemAlgoEvents.OnExecuteCompleted += OnAlgoExecuteCompleted; systemAlgoEvents.OnProgressChanged += OnAlgoProgresChanged; }
public override void OnClick() { ISODATA_FRM myIODATA_FRM = new ISODATA_FRM(); if (myIODATA_FRM.ShowDialog() != DialogResult.OK) { return; } ISODataClassification_Exchange_Info iSODataClassification = new ISODataClassification_Exchange_Info(); iSODataClassification = ISODATA_FRM.ISODataParams; ISODataClassificationAlgo iSODataClassificationAlgo = new ISODataClassificationAlgo { Params = iSODataClassification }; Application.DoEvents(); AlgoFactory.Instance().AsynExecuteAlgo(iSODataClassificationAlgo); ISystemAlgoEvents systemAlgoEvents = iSODataClassificationAlgo as ISystemAlgoEvents; systemAlgoEvents.OnExecuteCompleted += OnAlgoExecuteCompleted; systemAlgoEvents.OnProgressChanged += OnAlgoProgresChanged; }
public AlgoFactoryTests() { AlgoFactory.CleanFactories(); }